re PR target/57623 (BEXTR intrinsic has memory operands switched around (fails to...
authorJakub Jelinek <jakub@redhat.com>
Thu, 27 Jun 2013 16:48:05 +0000 (18:48 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 27 Jun 2013 16:48:05 +0000 (18:48 +0200)
PR target/57623
* config/i386/i386.md (bmi_bextr_<mode>): Swap predicates and
constraints of operand 1 and 2.

* gcc.target/i386/bmi-bextr-3.c: New test.

From-SVN: r200479

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/bmi-bextr-3.c [new file with mode: 0644]

index 74cf1b4056538fba4cb0114a091eddae3f2aaf28..ee0130ebe05928c6a4b38e34c9162e0b07fc4f49 100644 (file)
@@ -1,5 +1,9 @@
 2013-06-27  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/57623
+       * config/i386/i386.md (bmi_bextr_<mode>): Swap predicates and
+       constraints of operand 1 and 2.
+
        PR target/57623
        * config/i386/i386.md (bmi2_bzhi_<mode>3): Swap AND arguments
        to match RTL canonicalization.  Swap predicates and
index e0e1a63fa5f85f2f80856a468248ac26bddaeb5d..a6e2946584b04088e5352534d95d088ba5d20eed 100644 (file)
 
 (define_insn "bmi_bextr_<mode>"
   [(set (match_operand:SWI48 0 "register_operand" "=r,r")
-        (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r,r")
-                       (match_operand:SWI48 2 "nonimmediate_operand" "r,m")]
+        (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"
index 43f6caf630c7f8ce5f623c83f85db2df76f860ca..7bf618df1af01fb6740361d4fb621925509384e5 100644 (file)
@@ -1,5 +1,8 @@
 2013-06-27  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/57623
+       * gcc.target/i386/bmi-bextr-3.c: New test.
+
        PR target/57623
        * gcc.target/i386/bmi2-bzhi-1.c: New test.
 
diff --git a/gcc/testsuite/gcc.target/i386/bmi-bextr-3.c b/gcc/testsuite/gcc.target/i386/bmi-bextr-3.c
new file mode 100644 (file)
index 0000000..fe342b9
--- /dev/null
@@ -0,0 +1,31 @@
+/* PR target/57623 */
+/* { dg-do assemble { target bmi } } */
+/* { dg-options "-O2 -mbmi" } */
+
+#include <x86intrin.h>
+
+unsigned int
+f1 (unsigned int x, unsigned int *y)
+{
+  return __bextr_u32 (x, *y);
+}
+
+unsigned int
+f2 (unsigned int *x, unsigned int y)
+{
+  return __bextr_u32 (*x, y);
+}
+
+#ifdef  __x86_64__
+unsigned long long
+f3 (unsigned long long x, unsigned long long *y)
+{
+  return __bextr_u64 (x, *y);
+}
+
+unsigned long long
+f4 (unsigned long long *x, unsigned long long y)
+{
+  return __bextr_u64 (*x, y);
+}
+#endif