Commit 0cf0bc67 by Claudiu Zissulescu Committed by Claudiu Zissulescu

[ARC] Update (u)maddsidi patterns.

The accumulator registers are freely used by the compiler. However,
there are a number of instructions which are having an intrinsic use
of these registers. Update patterns to inform the compiler which ones.

gcc/
2017-09-19  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.md (maddsidi4, maddsidi4_split): Update pattern.
	(umaddsidi4,umaddsidi4): Likewise.

gcc/testsuite
2017-09-19  Claudiu Zissulescu  <claziss@synopsys.com>

	* gcc.target/arc/tumaddsidi4.c: New test.

From-SVN: r255779
parent 2bd36eba
2017-12-18 Claudiu Zissulescu <claziss@synopsys.com> 2017-12-18 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.md (maddsidi4, maddsidi4_split): Update pattern.
(umaddsidi4, umaddsidi_split): Likewise.
2017-12-18 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.c (arc_legitimate_constant_p): Always check all * config/arc/arc.c (arc_legitimate_constant_p): Always check all
constants. constants.
...@@ -6155,13 +6155,25 @@ ...@@ -6155,13 +6155,25 @@
[(set_attr "length" "0")]) [(set_attr "length" "0")])
;; MAC and DMPY instructions ;; MAC and DMPY instructions
(define_insn_and_split "maddsidi4" (define_expand "maddsidi4"
[(match_operand:DI 0 "register_operand" "")
(match_operand:SI 1 "register_operand" "")
(match_operand:SI 2 "extend_operand" "")
(match_operand:DI 3 "register_operand" "")]
"TARGET_PLUS_DMPY"
"{
emit_insn (gen_maddsidi4_split (operands[0], operands[1], operands[2], operands[3]));
DONE;
}")
(define_insn_and_split "maddsidi4_split"
[(set (match_operand:DI 0 "register_operand" "=r") [(set (match_operand:DI 0 "register_operand" "=r")
(plus:DI (plus:DI
(mult:DI (mult:DI
(sign_extend:DI (match_operand:SI 1 "register_operand" "%r")) (sign_extend:DI (match_operand:SI 1 "register_operand" "%r"))
(sign_extend:DI (match_operand:SI 2 "extend_operand" "ri"))) (sign_extend:DI (match_operand:SI 2 "extend_operand" "ri")))
(match_operand:DI 3 "register_operand" "r")))] (match_operand:DI 3 "register_operand" "r")))
(clobber (reg:DI ARCV2_ACC))]
"TARGET_PLUS_DMPY" "TARGET_PLUS_DMPY"
"#" "#"
"TARGET_PLUS_DMPY && reload_completed" "TARGET_PLUS_DMPY && reload_completed"
...@@ -6243,13 +6255,25 @@ ...@@ -6243,13 +6255,25 @@
(set_attr "predicable" "no") (set_attr "predicable" "no")
(set_attr "cond" "nocond")]) (set_attr "cond" "nocond")])
(define_insn_and_split "umaddsidi4" (define_expand "umaddsidi4"
[(match_operand:DI 0 "register_operand" "")
(match_operand:SI 1 "register_operand" "")
(match_operand:SI 2 "extend_operand" "")
(match_operand:DI 3 "register_operand" "")]
"TARGET_PLUS_DMPY"
"{
emit_insn (gen_umaddsidi4_split (operands[0], operands[1], operands[2], operands[3]));
DONE;
}")
(define_insn_and_split "umaddsidi4_split"
[(set (match_operand:DI 0 "register_operand" "=r") [(set (match_operand:DI 0 "register_operand" "=r")
(plus:DI (plus:DI
(mult:DI (mult:DI
(zero_extend:DI (match_operand:SI 1 "register_operand" "%r")) (zero_extend:DI (match_operand:SI 1 "register_operand" "%r"))
(zero_extend:DI (match_operand:SI 2 "extend_operand" "ri"))) (zero_extend:DI (match_operand:SI 2 "extend_operand" "ri")))
(match_operand:DI 3 "register_operand" "r")))] (match_operand:DI 3 "register_operand" "r")))
(clobber (reg:DI ARCV2_ACC))]
"TARGET_PLUS_DMPY" "TARGET_PLUS_DMPY"
"#" "#"
"TARGET_PLUS_DMPY && reload_completed" "TARGET_PLUS_DMPY && reload_completed"
......
2017-12-18 Claudiu Zissulescu <claziss@synopsys.com> 2017-12-18 Claudiu Zissulescu <claziss@synopsys.com>
* gcc.target/arc/tumaddsidi4.c: New test.
2017-12-18 Claudiu Zissulescu <claziss@synopsys.com>
* gcc.target/arc/tls-1.c: New test. * gcc.target/arc/tls-1.c: New test.
2017-12-18 Richard Biener <rguenther@suse.de> 2017-12-18 Richard Biener <rguenther@suse.de>
......
/* { dg-do compile } */
/* { dg-options "-mcpu=archs -O1 -mmpy-option=plus_dmpy" } */
/* Check how we generate umaddsidi4 patterns. */
long a;
long long b;
unsigned c, d;
void fn1(void)
{
b = d * (long long)c + a;
}
/* { dg-final { scan-assembler "macu 0,r" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment