From: Jakub Jelinek Date: Thu, 27 Jun 2013 16:44:17 +0000 (+0200) Subject: re PR target/57623 (BEXTR intrinsic has memory operands switched around (fails to... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2444244ecf0ab5c23558b5f8952dc8ab2e75e661;p=gcc.git re PR target/57623 (BEXTR intrinsic has memory operands switched around (fails to compile code)) PR target/57623 * config/i386/i386.md (bmi2_bzhi_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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bd319c03e5b..74cf1b40565 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-06-27 Jakub Jelinek + + PR target/57623 + * config/i386/i386.md (bmi2_bzhi_3): Swap AND arguments + to match RTL canonicalization. Swap predicates and + constraints of operand 1 and 2. + 2013-06-27 Vladimir Makarov * 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 e97a4570501..e0e1a63fa5f 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -11733,9 +11733,9 @@ ;; BMI2 instructions. (define_insn "bmi2_bzhi_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 73cf781d1fe..43f6caf630c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-06-27 Jakub Jelinek + + PR target/57623 + * gcc.target/i386/bmi2-bzhi-1.c: New test. + 2013-06-27 Marc Glisse 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 00000000000..42e002d0630 --- /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 + +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