aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-06-27 18:44:17 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2013-06-27 18:44:17 +0200
commit2444244ecf0ab5c23558b5f8952dc8ab2e75e661 (patch)
tree279939af22d61be6ac83a9b5360284c72a055fea
parent2f25972039c2c1c424c03fd29ff00200a64b6b0e (diff)
downloadgcc-2444244ecf0ab5c23558b5f8952dc8ab2e75e661.zip
gcc-2444244ecf0ab5c23558b5f8952dc8ab2e75e661.tar.gz
gcc-2444244ecf0ab5c23558b5f8952dc8ab2e75e661.tar.bz2
re PR target/57623 (BEXTR intrinsic has memory operands switched around (fails to compile code))
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: r200477
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/i386.md6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/bmi2-bzhi-1.c31
4 files changed, 46 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bd319c0..74cf1b4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
2013-06-27 Vladimir Makarov <vmakarov@redhat.com>
* lra-constraints.c (inherit_in_ebb): Process static hard regs
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index e97a457..e0e1a63 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -11733,9 +11733,9 @@
;; 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}"
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 73cf781..43f6caf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/57623
+ * gcc.target/i386/bmi2-bzhi-1.c: New test.
+
2013-06-27 Marc Glisse <marc.glisse@inria.fr>
PR c++/57172
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
index 0000000..42e002d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/bmi2-bzhi-1.c
@@ -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