(compare:CCZ (neg:SWI (match_dup 0)) (const_int 0)))
(set (match_dup 0) (neg:SWI (match_dup 0)))])])
+;; Optimize *negsi_1 followed by *cmpsi_ccno_1 (PR target/91384) with APX_F
+(define_peephole2
+ [(parallel [(set (match_operand:SWI 0 "general_reg_operand")
+ (neg:SWI (match_operand:SWI 1 "general_reg_operand")))
+ (clobber (reg:CC FLAGS_REG))])
+ (set (reg:CCZ FLAGS_REG) (compare:CCZ (match_dup 1) (const_int 0)))]
+ "TARGET_APX_NDD"
+ [(parallel [(set (reg:CCZ FLAGS_REG)
+ (compare:CCZ (neg:SWI (match_dup 1)) (const_int 0)))
+ (set (match_dup 0) (neg:SWI (match_dup 1)))])])
+
;; Special expand pattern to handle integer mode abs
(define_expand "abs<mode>2"
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mapxf" } */
+
+void foo (void);
+void bar (void);
+
+int
+test (int a)
+{
+ int r;
+
+ if (r = -a)
+ foo ();
+ else
+ bar ();
+
+ return r;
+}
+
+/* { dg-final { scan-assembler-not "testl" } } */