Commit 9a55a2d1 by Jakub Jelinek Committed by Jakub Jelinek

re PR target/70341 (cost model for addresses is incorrect, slsr is using reg + reg + CST for arm)

	PR target/70341
	* config/arm/arm.md (arm_casesi_internal): New define_expand.  Rename
	old define_insn to ...
	(*arm_casesi_internal): ... this.  Add mode to LABEL_REFs.
	* config/arm/thumb2.md (thumb2_casesi_internal): New define_expand.
	Rename old define_insn to ...
	(*thumb2_casesi_internal): ... this.  Add mode to LABEL_REFs.
	(thumb2_casesi_internal_pic): New define_expand.  Rename old
	define_insn to ...
	(*thumb2_casesi_internal_pic): ... this.  Add mode to LABEL_REFs.

From-SVN: r269255
parent a8a89444
2019-02-27 Jakub Jelinek <jakub@redhat.com>
PR target/70341
* config/arm/arm.md (arm_casesi_internal): New define_expand. Rename
old define_insn to ...
(*arm_casesi_internal): ... this. Add mode to LABEL_REFs.
* config/arm/thumb2.md (thumb2_casesi_internal): New define_expand.
Rename old define_insn to ...
(*thumb2_casesi_internal): ... this. Add mode to LABEL_REFs.
(thumb2_casesi_internal_pic): New define_expand. Rename old
define_insn to ...
(*thumb2_casesi_internal_pic): ... this. Add mode to LABEL_REFs.
2019-02-27 Richard Biener <rguenther@suse.de> 2019-02-27 Richard Biener <rguenther@suse.de>
PR debug/88878 PR debug/88878
......
...@@ -8939,16 +8939,35 @@ ...@@ -8939,16 +8939,35 @@
;; The USE in this pattern is needed to tell flow analysis that this is ;; The USE in this pattern is needed to tell flow analysis that this is
;; a CASESI insn. It has no other purpose. ;; a CASESI insn. It has no other purpose.
(define_insn "arm_casesi_internal" (define_expand "arm_casesi_internal"
[(parallel [(set (pc)
(if_then_else
(leu (match_operand:SI 0 "s_register_operand")
(match_operand:SI 1 "arm_rhs_operand"))
(match_dup 4)
(label_ref:SI (match_operand 3 ""))))
(clobber (reg:CC CC_REGNUM))
(use (label_ref:SI (match_operand 2 "")))])]
"TARGET_ARM"
{
operands[4] = gen_rtx_MULT (SImode, operands[0], GEN_INT (4));
operands[4] = gen_rtx_PLUS (SImode, operands[4],
gen_rtx_LABEL_REF (SImode, operands[2]));
operands[4] = gen_rtx_MEM (SImode, operands[4]);
MEM_READONLY_P (operands[4]) = 1;
MEM_NOTRAP_P (operands[4]) = 1;
})
(define_insn "*arm_casesi_internal"
[(parallel [(set (pc) [(parallel [(set (pc)
(if_then_else (if_then_else
(leu (match_operand:SI 0 "s_register_operand" "r") (leu (match_operand:SI 0 "s_register_operand" "r")
(match_operand:SI 1 "arm_rhs_operand" "rI")) (match_operand:SI 1 "arm_rhs_operand" "rI"))
(mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4)) (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
(label_ref (match_operand 2 "" "")))) (label_ref:SI (match_operand 2 "" ""))))
(label_ref (match_operand 3 "" "")))) (label_ref:SI (match_operand 3 "" ""))))
(clobber (reg:CC CC_REGNUM)) (clobber (reg:CC CC_REGNUM))
(use (label_ref (match_dup 2)))])] (use (label_ref:SI (match_dup 2)))])]
"TARGET_ARM" "TARGET_ARM"
"* "*
if (flag_pic) if (flag_pic)
......
...@@ -1079,17 +1079,37 @@ ...@@ -1079,17 +1079,37 @@
(set_attr "neg_pool_range" "*,250")] (set_attr "neg_pool_range" "*,250")]
) )
(define_insn "thumb2_casesi_internal" (define_expand "thumb2_casesi_internal"
[(parallel [(set (pc)
(if_then_else
(leu (match_operand:SI 0 "s_register_operand")
(match_operand:SI 1 "arm_rhs_operand"))
(match_dup 4)
(label_ref:SI (match_operand 3 ""))))
(clobber (reg:CC CC_REGNUM))
(clobber (match_scratch:SI 5))
(use (label_ref:SI (match_operand 2 "")))])]
"TARGET_THUMB2 && !flag_pic"
{
operands[4] = gen_rtx_MULT (SImode, operands[0], GEN_INT (4));
operands[4] = gen_rtx_PLUS (SImode, operands[4],
gen_rtx_LABEL_REF (SImode, operands[2]));
operands[4] = gen_rtx_MEM (SImode, operands[4]);
MEM_READONLY_P (operands[4]) = 1;
MEM_NOTRAP_P (operands[4]) = 1;
})
(define_insn "*thumb2_casesi_internal"
[(parallel [(set (pc) [(parallel [(set (pc)
(if_then_else (if_then_else
(leu (match_operand:SI 0 "s_register_operand" "r") (leu (match_operand:SI 0 "s_register_operand" "r")
(match_operand:SI 1 "arm_rhs_operand" "rI")) (match_operand:SI 1 "arm_rhs_operand" "rI"))
(mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4)) (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
(label_ref (match_operand 2 "" "")))) (label_ref:SI (match_operand 2 "" ""))))
(label_ref (match_operand 3 "" "")))) (label_ref:SI (match_operand 3 "" ""))))
(clobber (reg:CC CC_REGNUM)) (clobber (reg:CC CC_REGNUM))
(clobber (match_scratch:SI 4 "=&r")) (clobber (match_scratch:SI 4 "=&r"))
(use (label_ref (match_dup 2)))])] (use (label_ref:SI (match_dup 2)))])]
"TARGET_THUMB2 && !flag_pic" "TARGET_THUMB2 && !flag_pic"
"* return thumb2_output_casesi(operands);" "* return thumb2_output_casesi(operands);"
[(set_attr "conds" "clob") [(set_attr "conds" "clob")
...@@ -1097,18 +1117,39 @@ ...@@ -1097,18 +1117,39 @@
(set_attr "type" "multiple")] (set_attr "type" "multiple")]
) )
(define_insn "thumb2_casesi_internal_pic" (define_expand "thumb2_casesi_internal_pic"
[(parallel [(set (pc)
(if_then_else
(leu (match_operand:SI 0 "s_register_operand")
(match_operand:SI 1 "arm_rhs_operand"))
(match_dup 4)
(label_ref:SI (match_operand 3 ""))))
(clobber (reg:CC CC_REGNUM))
(clobber (match_scratch:SI 5))
(clobber (match_scratch:SI 6))
(use (label_ref:SI (match_operand 2 "")))])]
"TARGET_THUMB2 && flag_pic"
{
operands[4] = gen_rtx_MULT (SImode, operands[0], GEN_INT (4));
operands[4] = gen_rtx_PLUS (SImode, operands[4],
gen_rtx_LABEL_REF (SImode, operands[2]));
operands[4] = gen_rtx_MEM (SImode, operands[4]);
MEM_READONLY_P (operands[4]) = 1;
MEM_NOTRAP_P (operands[4]) = 1;
})
(define_insn "*thumb2_casesi_internal_pic"
[(parallel [(set (pc) [(parallel [(set (pc)
(if_then_else (if_then_else
(leu (match_operand:SI 0 "s_register_operand" "r") (leu (match_operand:SI 0 "s_register_operand" "r")
(match_operand:SI 1 "arm_rhs_operand" "rI")) (match_operand:SI 1 "arm_rhs_operand" "rI"))
(mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4)) (mem:SI (plus:SI (mult:SI (match_dup 0) (const_int 4))
(label_ref (match_operand 2 "" "")))) (label_ref:SI (match_operand 2 "" ""))))
(label_ref (match_operand 3 "" "")))) (label_ref:SI (match_operand 3 "" ""))))
(clobber (reg:CC CC_REGNUM)) (clobber (reg:CC CC_REGNUM))
(clobber (match_scratch:SI 4 "=&r")) (clobber (match_scratch:SI 4 "=&r"))
(clobber (match_scratch:SI 5 "=r")) (clobber (match_scratch:SI 5 "=r"))
(use (label_ref (match_dup 2)))])] (use (label_ref:SI (match_dup 2)))])]
"TARGET_THUMB2 && flag_pic" "TARGET_THUMB2 && flag_pic"
"* return thumb2_output_casesi(operands);" "* return thumb2_output_casesi(operands);"
[(set_attr "conds" "clob") [(set_attr "conds" "clob")
......
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