+2018-04-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/85177
+ PR target/85255
+ * config/i386/sse.md
+ (<extract_type>_vinsert<shuffletype><extract_suf>_mask): Fix
+ computation of the VEC_MERGE selector from mask.
+ (<extract_type>_vinsert<shuffletype><extract_suf>_1<mask_name>):
+ Fix decoding of the VEC_MERGE selector into mask.
+
2018-04-10 Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/85286
(match_operand:<avx512fmaskmode> 5 "register_operand")]
"TARGET_AVX512F"
{
- int mask,selector;
+ int mask, selector;
mask = INTVAL (operands[3]);
- selector = GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ?
- 0xFFFF ^ (0xF000 >> mask * 4)
- : 0xFF ^ (0xC0 >> mask * 2);
+ selector = (GET_MODE_UNIT_SIZE (<MODE>mode) == 4
+ ? 0xFFFF ^ (0x000F << mask * 4)
+ : 0xFF ^ (0x03 << mask * 2));
emit_insn (gen_<extract_type>_vinsert<shuffletype><extract_suf>_1_mask
(operands[0], operands[1], operands[2], GEN_INT (selector),
operands[4], operands[5]));
int mask;
int selector = INTVAL (operands[3]);
- if (selector == 0xFFF || selector == 0x3F)
+ if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFFF0 : 0xFC))
mask = 0;
- else if ( selector == 0xF0FF || selector == 0xCF)
+ else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFF0F : 0xF3))
mask = 1;
- else if ( selector == 0xFF0F || selector == 0xF3)
+ else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xF0FF : 0xCF))
mask = 2;
- else if ( selector == 0xFFF0 || selector == 0xFC)
+ else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0x0FFF : 0x3F))
mask = 3;
else
- gcc_unreachable ();
+ gcc_unreachable ();
operands[3] = GEN_INT (mask);
+2018-04-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/85177
+ PR target/85255
+ * gcc.target/i386/avx512f-pr85177.c: New test.
+ * gcc.target/i386/avx512f-pr85255.c: New test.
+
2018-04-10 Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/85286
--- /dev/null
+/* PR target/85177 */
+/* { dg-do run { target { avx512f && int128 } } } */
+/* { dg-options "-O -fno-tree-ccp -fno-tree-sra -mavx512f -mno-avx512bw" } */
+
+#include "avx512f-check.h"
+
+typedef short U __attribute__ ((vector_size (64)));
+typedef __int128 V __attribute__ ((vector_size (64)));
+
+static inline __attribute__((always_inline)) U
+foo (int i, U u)
+{
+ u[i & 1] = 1;
+ return u;
+}
+
+__attribute__((noipa)) int
+bar ()
+{
+ V x = (V) foo (0, (U) { });
+ for (unsigned i = 0; i < 4; i++)
+ if (x[i] != (i == 0)) __builtin_abort ();
+ return 0;
+}
+
+static void
+avx512f_test (void)
+{
+ bar ();
+}
--- /dev/null
+/* PR target/85255 */
+/* { dg-do run { target { avx512f } } } */
+/* { dg-options "-O2 -fno-tree-fre -mavx512f" } */
+
+#include "avx512f-check.h"
+
+typedef short V __attribute__ ((vector_size (64)));
+
+V
+foo (V v)
+{
+ v[v[1]] = 0;
+ return v;
+}
+
+static void
+avx512f_test (void)
+{
+ V v = foo ((V) { 1 });
+ for (unsigned i = 0; i < 32; i++)
+ if (v[i] != 0)
+ __builtin_abort ();
+}