===================================================================
@@ -12565,11 +12564,25 @@
(set_attr "btver2_decode" "direct, double")
(set_attr "mode" "<MODE>")])
+(define_insn "*bmi_andn_<mode>_ccno"
+ [(set (reg FLAGS_REG)
+ (compare
+ (and:SWI48
+ (not:SWI48 (match_operand:SWI48 1 "register_operand" "r,r"))
+ (match_operand:SWI48 2 "nonimmediate_operand" "r,m"))
+ (const_int 0)))
+ (clobber (match_scratch:SWI48 0 "=r,r"))]
+ "TARGET_BMI && ix86_match_ccmode (insn, CCNOmode)"
+ "andn\t{%2, %1, %0|%0, %1, %2}"
+ [(set_attr "type" "bitmanip")
+ (set_attr "btver2_decode" "direct, double")
+ (set_attr "mode" "<MODE>")])
+
(define_insn "bmi_bextr_<mode>"
[(set (match_operand:SWI48 0 "register_operand" "=r,r")
(unspec:SWI48 [(match_operand:SWI48 1 "nonimmediate_operand" "r,m")
- (match_operand:SWI48 2 "register_operand" "r,r")]
- UNSPEC_BEXTR))
+ (unspec:SWI48 [(match_operand:SWI48 1 "nonimmediate_operand" "r,m")
+ (match_operand:SWI48 2 "register_operand" "r,r")]
+ UNSPEC_BEXTR))
(clobber (reg:CC FLAGS_REG))]
"TARGET_BMI"
"bextr\t{%2, %1, %0|%0, %1, %2}"
===================================================================
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mbmi" } */
+
+int foo (int x, int y)
+{
+ if (~x & y)
+ return 1;
+
+ return 0;
+}
+
+int bar (int x, int y)
+{
+ if ((~x & y) > 0)
+ return 1;
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "test" } } */