[Bug rtl-optimization/87871] [9 Regression] testcases fail after r265398 on arm
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Apr 18 14:25:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87871
--- Comment #44 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Well, it requires that the RA looks specially for this kind of pattern and if
it ends up being a noop move, nothing simplifies the pattern again back to
normal comparison, and as Segher noted, it can negatively affect other
optimization passes.
Completely untested patch peephole2 patch:
--- gcc/config/arm/arm.md.jj 2019-03-19 11:04:49.283170205 +0100
+++ gcc/config/arm/arm.md 2019-04-18 16:21:18.974543408 +0200
@@ -10928,12 +10928,22 @@
[(set (match_operand:SI 0 "arm_general_register_operand" "")
(match_operand:SI 1 "arm_general_register_operand" ""))
(set (reg:CC CC_REGNUM)
- (compare:CC (match_dup 1) (const_int 0)))]
+ (compare:CC (match_operand:SI 2 "arm_general_register_operand" "")
+ (const_int 0)))]
+ "TARGET_ARM
+ && (rtx_equal_p (operands[2], operands[0])
+ || rtx_equal_p (operands[2], operands[1]))"
+ [(parallel [(set (reg:CC CC_REGNUM) (compare:CC (match_dup 1) (const_int
0)))
+ (set (match_dup 0) (match_dup 1))])])
+
+(define_peephole2
+ [(set (reg:CC CC_REGNUM)
+ (compare:CC (match_operand:SI 1 "arm_general_register_operand" "")
+ (const_int 0)))]
+ (set (match_operand:SI 0 "arm_general_register_operand" "") (match_dup 1))]
"TARGET_ARM"
[(parallel [(set (reg:CC CC_REGNUM) (compare:CC (match_dup 1) (const_int
0)))
- (set (match_dup 0) (match_dup 1))])]
- ""
-)
+ (set (match_dup 0) (match_dup 1))])])
(define_split
[(set (match_operand:SI 0 "s_register_operand" "")
More information about the Gcc-bugs
mailing list