From: Jakub Jelinek Date: Tue, 3 Apr 2018 16:06:19 +0000 (+0200) Subject: re PR target/85169 (wrong code with vector member insert) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4304d6180adc0b3ef2c9fe2a63e829d5f518a12d;p=gcc.git re PR target/85169 (wrong code with vector member insert) PR target/85169 * config/i386/i386.c (ix86_expand_vector_set): Use HOST_WIDE_INT_1U << elt instead of 1 << elt. Formatting fix. * gcc.c-torture/execute/pr85169.c: New test. * gcc.target/i386/avx512f-pr85169.c: New test. * gcc.target/i386/avx512bw-pr85169.c: New test. From-SVN: r259037 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f1030b4fd64..efd155e36a4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-04-03 Jakub Jelinek + + PR target/85169 + * config/i386/i386.c (ix86_expand_vector_set): Use + HOST_WIDE_INT_1U << elt instead of 1 << elt. Formatting fix. + 2018-04-03 Uros Bizjak * config/i386/i386.c (emit_i387_cw_initialization): Always use logic diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 44ef60e5639..03e5c433574 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -44127,12 +44127,14 @@ quarter: where the mask is clear and second input operand otherwise. */ emit_insn (gen_blendm (target, target, tmp, force_reg (mmode, - gen_int_mode (1 << elt, mmode)))); + gen_int_mode (HOST_WIDE_INT_1U << elt, + mmode)))); } else if (use_vec_merge) { tmp = gen_rtx_VEC_DUPLICATE (mode, val); - tmp = gen_rtx_VEC_MERGE (mode, tmp, target, GEN_INT (1 << elt)); + tmp = gen_rtx_VEC_MERGE (mode, tmp, target, + GEN_INT (HOST_WIDE_INT_1U << elt)); emit_insn (gen_rtx_SET (target, tmp)); } else @@ -44141,7 +44143,7 @@ quarter: emit_move_insn (mem, target); - tmp = adjust_address (mem, inner_mode, elt*GET_MODE_SIZE (inner_mode)); + tmp = adjust_address (mem, inner_mode, elt * GET_MODE_SIZE (inner_mode)); emit_move_insn (tmp, val); emit_move_insn (target, mem); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 407bb4f5727..a53d46b6bac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-04-03 Jakub Jelinek + + PR target/85169 + * gcc.c-torture/execute/pr85169.c: New test. + * gcc.target/i386/avx512f-pr85169.c: New test. + * gcc.target/i386/avx512bw-pr85169.c: New test. + 2018-04-03 Segher Boessenkool PR target/85126 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr85169.c b/gcc/testsuite/gcc.c-torture/execute/pr85169.c new file mode 100644 index 00000000000..a21ed9b7264 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr85169.c @@ -0,0 +1,22 @@ +/* PR target/85169 */ + +typedef char V __attribute__((vector_size (64))); + +static void __attribute__ ((noipa)) +foo (V *p) +{ + V v = *p; + v[63] = 1; + *p = v; +} + +int +main () +{ + V v = (V) { }; + foo (&v); + for (unsigned i = 0; i < 64; i++) + if (v[i] != (i == 63)) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr85169.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr85169.c new file mode 100644 index 00000000000..be2dcfd95d6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr85169.c @@ -0,0 +1,18 @@ +/* PR target/85169 */ +/* { dg-do run { target avx512bw } } */ +/* { dg-options "-O2 -mavx512bw" } */ + +#include "avx512bw-check.h" + +int do_main (void); + +static void +avx512bw_test (void) +{ + do_main (); +} + +#undef main +#define main() do_main () + +#include "../../gcc.c-torture/execute/pr85169.c" diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr85169.c b/gcc/testsuite/gcc.target/i386/avx512f-pr85169.c new file mode 100644 index 00000000000..be1913bc9c6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-pr85169.c @@ -0,0 +1,18 @@ +/* PR target/85169 */ +/* { dg-do run { target avx512f } } */ +/* { dg-options "-O2 -mavx512f" } */ + +#include "avx512f-check.h" + +int do_main (void); + +static void +avx512f_test (void) +{ + do_main (); +} + +#undef main +#define main() do_main () + +#include "../../gcc.c-torture/execute/pr85169.c"