]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/57623 (BEXTR intrinsic has memory operands switched around...
authorJakub Jelinek <jakub@redhat.com>
Wed, 7 May 2014 15:54:34 +0000 (17:54 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 7 May 2014 15:54:34 +0000 (17:54 +0200)
Backported from mainline
2013-06-27  Jakub Jelinek  <jakub@redhat.com>

PR target/57623
* config/i386/i386.md (bmi2_bzhi_<mode>3): Swap AND arguments
to match RTL canonicalization.  Swap predicates and
constraints of operand 1 and 2.

* gcc.target/i386/bmi2-bzhi-1.c: New test.

From-SVN: r210166

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/bmi2-bzhi-1.c [new file with mode: 0644]

index 8e1bbfc8083ddfe754302cd61ccc37edc60fa222..90a411b8969cf08fe1c8a378ad3d1045f4f83663 100644 (file)
@@ -1,3 +1,13 @@
+2014-05-07  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2013-06-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/57623
+       * config/i386/i386.md (bmi2_bzhi_<mode>3): Swap AND arguments
+       to match RTL canonicalization.  Swap predicates and
+       constraints of operand 1 and 2.
+
 2014-05-07  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
index f85f17af1a1b7dbbbdafc6aea6f7acaeda9126b8..781e671036d498c6ce44668a8d1f77938341da29 100644 (file)
 ;; BMI2 instructions.
 (define_insn "bmi2_bzhi_<mode>3"
   [(set (match_operand:SWI48 0 "register_operand" "=r")
-       (and:SWI48 (match_operand:SWI48 1 "register_operand" "r")
-                  (lshiftrt:SWI48 (const_int -1)
-                                  (match_operand:SWI48 2 "nonimmediate_operand" "rm"))))
+       (and:SWI48 (lshiftrt:SWI48 (const_int -1)
+                                  (match_operand:SWI48 2 "register_operand" "r"))
+                  (match_operand:SWI48 1 "nonimmediate_operand" "rm")))
    (clobber (reg:CC FLAGS_REG))]
   "TARGET_BMI2"
   "bzhi\t{%2, %1, %0|%0, %1, %2}"
index 9ae3e94ca1f669d1f0b303aa5b6189bbebf67f47..897dfbcc086621f557094ea8c054e90eaa3f9de6 100644 (file)
@@ -1,3 +1,11 @@
+2014-05-07  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2013-06-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/57623
+       * gcc.target/i386/bmi2-bzhi-1.c: New test.
+
 2014-05-07  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.target/i386/bmi2-bzhi-1.c b/gcc/testsuite/gcc.target/i386/bmi2-bzhi-1.c
new file mode 100644 (file)
index 0000000..42e002d
--- /dev/null
@@ -0,0 +1,31 @@
+/* PR target/57623 */
+/* { dg-do assemble { target bmi2 } } */
+/* { dg-options "-O2 -mbmi2" } */
+
+#include <x86intrin.h>
+
+unsigned int
+f1 (unsigned int x, unsigned int *y)
+{
+  return _bzhi_u32 (x, *y);
+}
+
+unsigned int
+f2 (unsigned int *x, unsigned int y)
+{
+  return _bzhi_u32 (*x, y);
+}
+
+#ifdef  __x86_64__
+unsigned long long
+f3 (unsigned long long x, unsigned long long *y)
+{
+  return _bzhi_u64 (x, *y);
+}
+
+unsigned long long
+f4 (unsigned long long *x, unsigned long long y)
+{
+  return _bzhi_u64 (*x, y);
+}
+#endif