* config/i386/sse.md (pbroadcast_evex_isa): New mode attr.
(avx2_pbroadcast<mode>): Add another alternative with v instead
of x constraints in it, using <pbroadcast_evex_isa> isa.
(avx2_pbroadcast<mode>_1): Similarly, add two such alternatives.
* gcc.target/i386/avx512bw-vpbroadcast-1.c: New test.
* gcc.target/i386/avx512bw-vpbroadcast-2.c: New test.
* gcc.target/i386/avx512bw-vpbroadcast-3.c: New test.
* gcc.target/i386/avx512vl-vpbroadcast-1.c: New test.
* gcc.target/i386/avx512vl-vpbroadcast-2.c: New test.
* gcc.target/i386/avx512vl-vpbroadcast-3.c: New test.
From-SVN: r236369
2016-05-18 Jakub Jelinek <jakub@redhat.com>
+ * config/i386/sse.md (pbroadcast_evex_isa): New mode attr.
+ (avx2_pbroadcast<mode>): Add another alternative with v instead
+ of x constraints in it, using <pbroadcast_evex_isa> isa.
+ (avx2_pbroadcast<mode>_1): Similarly, add two such alternatives.
+
* config/i386/sse.md (<ssse3_avx2>_palignr<mode>): Use
constraint x instead of v in second alternative, add avx512bw
alternative.
(set_attr "btver2_decode" "vector")
(set_attr "mode" "OI")])
+(define_mode_attr pbroadcast_evex_isa
+ [(V64QI "avx512bw") (V32QI "avx512bw") (V16QI "avx512bw")
+ (V32HI "avx512bw") (V16HI "avx512bw") (V8HI "avx512bw")
+ (V16SI "avx512f") (V8SI "avx512f") (V4SI "avx512f")
+ (V8DI "avx512f") (V4DI "avx512f") (V2DI "avx512f")])
+
(define_insn "avx2_pbroadcast<mode>"
- [(set (match_operand:VI 0 "register_operand" "=x")
+ [(set (match_operand:VI 0 "register_operand" "=x,v")
(vec_duplicate:VI
(vec_select:<ssescalarmode>
- (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "xm")
+ (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "xm,vm")
(parallel [(const_int 0)]))))]
"TARGET_AVX2"
"vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}"
- [(set_attr "type" "ssemov")
+ [(set_attr "isa" "*,<pbroadcast_evex_isa>")
+ (set_attr "type" "ssemov")
(set_attr "prefix_extra" "1")
- (set_attr "prefix" "vex")
+ (set_attr "prefix" "vex,evex")
(set_attr "mode" "<sseinsnmode>")])
(define_insn "avx2_pbroadcast<mode>_1"
- [(set (match_operand:VI_256 0 "register_operand" "=x,x")
+ [(set (match_operand:VI_256 0 "register_operand" "=x,x,v,v")
(vec_duplicate:VI_256
(vec_select:<ssescalarmode>
- (match_operand:VI_256 1 "nonimmediate_operand" "m,x")
+ (match_operand:VI_256 1 "nonimmediate_operand" "m,x,m,v")
(parallel [(const_int 0)]))))]
"TARGET_AVX2"
"@
+ vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
+ vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}"
- [(set_attr "type" "ssemov")
+ [(set_attr "isa" "*,*,<pbroadcast_evex_isa>,<pbroadcast_evex_isa>")
+ (set_attr "type" "ssemov")
(set_attr "prefix_extra" "1")
(set_attr "prefix" "vex")
(set_attr "mode" "<sseinsnmode>")])
2016-05-18 Jakub Jelinek <jakub@redhat.com>
+ * gcc.target/i386/avx512bw-vpbroadcast-1.c: New test.
+ * gcc.target/i386/avx512bw-vpbroadcast-2.c: New test.
+ * gcc.target/i386/avx512bw-vpbroadcast-3.c: New test.
+ * gcc.target/i386/avx512vl-vpbroadcast-1.c: New test.
+ * gcc.target/i386/avx512vl-vpbroadcast-2.c: New test.
+ * gcc.target/i386/avx512vl-vpbroadcast-3.c: New test.
+
* gcc.target/i386/avx512vl-vpalignr-3.c: New test.
* gcc.target/i386/avx512bw-vpalignr-3.c: New test.
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx512vl -mavx512bw" } */
+
+#include <x86intrin.h>
+
+void
+f1 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = _mm_broadcastb_epi8 (a);
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastb\[^\n\r]*xmm16\[^\n\r]*xmm16" } } */
+
+void
+f2 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = _mm_broadcastw_epi16 (a);
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastw\[^\n\r]*xmm16\[^\n\r]*xmm16" } } */
+
+void
+f3 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = _mm_broadcastd_epi32 (a);
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastd\[^\n\r]*xmm16\[^\n\r]*xmm16" } } */
+
+void
+f4 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = _mm_broadcastq_epi64 (a);
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastq\[^\n\r]*xmm16\[^\n\r]*xmm16" } } */
+
+void
+f5 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ register __m256i b __asm ("xmm17");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ b = _mm256_broadcastb_epi8 (a);
+ asm volatile ("" : "+v" (b));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastb\[^\n\r]*(xmm1\[67]\[^\n\r]*ymm1\[67]|ymm1\[67]\[^\n\r]*xmm1\[67])" } } */
+
+void
+f6 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ register __m256i b __asm ("xmm17");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ b = _mm256_broadcastw_epi16 (a);
+ asm volatile ("" : "+v" (b));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastw\[^\n\r]*(xmm1\[67]\[^\n\r]*ymm1\[67]|ymm1\[67]\[^\n\r]*xmm1\[67])" } } */
+
+void
+f7 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ register __m256i b __asm ("xmm17");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ b = _mm256_broadcastd_epi32 (a);
+ asm volatile ("" : "+v" (b));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastd\[^\n\r]*(xmm1\[67]\[^\n\r]*ymm1\[67]|ymm1\[67]\[^\n\r]*xmm1\[67])" } } */
+
+void
+f8 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ register __m256i b __asm ("xmm17");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ b = _mm256_broadcastq_epi64 (a);
+ asm volatile ("" : "+v" (b));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastq\[^\n\r]*(xmm1\[67]\[^\n\r]*ymm1\[67]|ymm1\[67]\[^\n\r]*xmm1\[67])" } } */
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx512vl -mavx512bw" } */
+
+typedef char V1 __attribute__((vector_size (16)));
+typedef short V2 __attribute__((vector_size (16)));
+typedef char V5 __attribute__((vector_size (32)));
+typedef short V6 __attribute__((vector_size (32)));
+typedef int V7 __attribute__((vector_size (32)));
+
+void
+f1 (V1 x)
+{
+ register V1 a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = __builtin_shuffle (a, (V1) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastb\[^\n\r]*xmm16\[^\n\r]*xmm16" } } */
+
+void
+f2 (V2 x)
+{
+ register V2 a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = __builtin_shuffle (a, (V2) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastw\[^\n\r]*xmm16\[^\n\r]*xmm16" } } */
+
+void
+f5 (V5 x)
+{
+ register V5 a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = __builtin_shuffle (a, (V5) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastb\[^\n\r]*(xmm16\[^\n\r]*ymm16|ymm16\[^\n\r]*xmm16)" } } */
+
+void
+f6 (V6 x)
+{
+ register V6 a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = __builtin_shuffle (a, (V6) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastw\[^\n\r]*(xmm16\[^\n\r]*ymm16|ymm16\[^\n\r]*xmm16)" } } */
+
+void
+f7 (V7 x)
+{
+ register V7 a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = __builtin_shuffle (a, (V7) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastd\[^\n\r]*(xmm16\[^\n\r]*ymm16|ymm16\[^\n\r]*xmm16)" } } */
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx512vl -mavx512bw" } */
+
+typedef char V1 __attribute__((vector_size (16)));
+typedef short V2 __attribute__((vector_size (16)));
+typedef char V5 __attribute__((vector_size (32)));
+typedef short V6 __attribute__((vector_size (32)));
+typedef int V7 __attribute__((vector_size (32)));
+
+void
+f1 (V1 *x)
+{
+ register V1 a __asm ("xmm16");
+ a = __builtin_shuffle (*x, (V1) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastb\[^\n\r]*xmm16" } } */
+
+void
+f2 (V2 *x)
+{
+ register V2 a __asm ("xmm16");
+ a = __builtin_shuffle (*x, (V2) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastw\[^\n\r]*xmm16" } } */
+
+void
+f5 (V5 *x)
+{
+ register V5 a __asm ("xmm16");
+ a = __builtin_shuffle (*x, (V5) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastb\[^\n\r]*ymm16" } } */
+
+void
+f6 (V6 *x)
+{
+ register V6 a __asm ("xmm16");
+ a = __builtin_shuffle (*x, (V6) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastw\[^\n\r]*ymm16" } } */
+
+void
+f7 (V7 *x)
+{
+ register V7 a __asm ("xmm16");
+ a = __builtin_shuffle (*x, (V7) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastd\[^\n\r]*ymm16" } } */
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx512vl -mno-avx512bw" } */
+
+#include <x86intrin.h>
+
+void
+f1 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = _mm_broadcastb_epi8 (a);
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler-not "vpbroadcastb\[^\n\r]*xmm16" } } */
+
+void
+f2 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = _mm_broadcastw_epi16 (a);
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler-not "vpbroadcastw\[^\n\r]*xmm16" } } */
+
+void
+f3 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = _mm_broadcastd_epi32 (a);
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastd\[^\n\r]*xmm16\[^\n\r]*xmm16" } } */
+
+void
+f4 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = _mm_broadcastq_epi64 (a);
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastq\[^\n\r]*xmm16\[^\n\r]*xmm16" } } */
+
+void
+f5 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ register __m256i b __asm ("xmm17");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ b = _mm256_broadcastb_epi8 (a);
+ asm volatile ("" : "+v" (b));
+}
+
+/* { dg-final { scan-assembler-not "vpbroadcastb\[^\n\r]*\[xy]mm1\[67]" } } */
+
+void
+f6 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ register __m256i b __asm ("xmm17");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ b = _mm256_broadcastw_epi16 (a);
+ asm volatile ("" : "+v" (b));
+}
+
+/* { dg-final { scan-assembler-not "vpbroadcastw\[^\n\r]*\[xy]mm1\[67]" } } */
+
+void
+f7 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ register __m256i b __asm ("xmm17");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ b = _mm256_broadcastd_epi32 (a);
+ asm volatile ("" : "+v" (b));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastd\[^\n\r]*(xmm1\[67]\[^\n\r]*ymm1\[67]|ymm1\[67]\[^\n\r]*xmm1\[67])" } } */
+
+void
+f8 (__m128i x)
+{
+ register __m128i a __asm ("xmm16");
+ register __m256i b __asm ("xmm17");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ b = _mm256_broadcastq_epi64 (a);
+ asm volatile ("" : "+v" (b));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastq\[^\n\r]*(xmm1\[67]\[^\n\r]*ymm1\[67]|ymm1\[67]\[^\n\r]*xmm1\[67])" } } */
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx512vl -mno-avx512bw" } */
+
+typedef char V1 __attribute__((vector_size (16)));
+typedef short V2 __attribute__((vector_size (16)));
+typedef char V5 __attribute__((vector_size (32)));
+typedef short V6 __attribute__((vector_size (32)));
+typedef int V7 __attribute__((vector_size (32)));
+
+void
+f1 (V1 x)
+{
+ register V1 a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = __builtin_shuffle (a, (V1) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler-not "vpbroadcastb\[^\n\r]*xmm16" } } */
+
+void
+f2 (V2 x)
+{
+ register V2 a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = __builtin_shuffle (a, (V2) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler-not "vpbroadcastw\[^\n\r]*xmm16" } } */
+
+void
+f5 (V5 x)
+{
+ register V5 a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = __builtin_shuffle (a, (V5) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler-not "vpbroadcastb\[^\n\r]*\[xy]mm16" } } */
+
+void
+f6 (V6 x)
+{
+ register V6 a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = __builtin_shuffle (a, (V6) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler-not "vpbroadcastw\[^\n\r]*\[xy]mm16" } } */
+
+void
+f7 (V7 x)
+{
+ register V7 a __asm ("xmm16");
+ a = x;
+ asm volatile ("" : "+v" (a));
+ a = __builtin_shuffle (a, (V7) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastd\[^\n\r]*(xmm16\[^\n\r]*ymm16|ymm16\[^\n\r]*xmm16)" } } */
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx512vl -mno-avx512bw" } */
+
+typedef char V1 __attribute__((vector_size (16)));
+typedef short V2 __attribute__((vector_size (16)));
+typedef char V5 __attribute__((vector_size (32)));
+typedef short V6 __attribute__((vector_size (32)));
+typedef int V7 __attribute__((vector_size (32)));
+
+void
+f1 (V1 *x)
+{
+ register V1 a __asm ("xmm16");
+ a = __builtin_shuffle (*x, (V1) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler-not "vpbroadcastb\[^\n\r]*xmm16" } } */
+
+void
+f2 (V2 *x)
+{
+ register V2 a __asm ("xmm16");
+ a = __builtin_shuffle (*x, (V2) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler-not "vpbroadcastw\[^\n\r]*xmm16" } } */
+
+void
+f5 (V5 *x)
+{
+ register V5 a __asm ("xmm16");
+ a = __builtin_shuffle (*x, (V5) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler-not "vpbroadcastb\[^\n\r]*ymm16" } } */
+
+void
+f6 (V6 *x)
+{
+ register V6 a __asm ("xmm16");
+ a = __builtin_shuffle (*x, (V6) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler-not "vpbroadcastw\[^\n\r]*ymm16" } } */
+
+void
+f7 (V7 *x)
+{
+ register V7 a __asm ("xmm16");
+ a = __builtin_shuffle (*x, (V7) { 0 });
+ asm volatile ("" : "+v" (a));
+}
+
+/* { dg-final { scan-assembler "vpbroadcastd\[^\n\r]*ymm16" } } */