* config/i386/sse.md (pinsr_evex_isa): New mode attr.
(<sse2p4_1>_pinsr<ssemodesuffix>): Add 2 alternatives with
v constraints instead of x and <pinsr_evex_isa> isa attribute.
* gcc.target/i386/avx512bw-vpinsr-1.c: New test.
* gcc.target/i386/avx512dq-vpinsr-1.c: New test.
* gcc.target/i386/avx512vl-vpinsr-1.c: New test.
From-SVN: r236165
2016-05-12 Jakub Jelinek <jakub@redhat.com>
+ * config/i386/sse.md (pinsr_evex_isa): New mode attr.
+ (<sse2p4_1>_pinsr<ssemodesuffix>): Add 2 alternatives with
+ v constraints instead of x and <pinsr_evex_isa> isa attribute.
+
PR target/71019
* config/i386/sse.md (<sse2_avx2>_packssdw<mask_name>,
<sse4_1_avx2>_packusdw<mask_name>): Make sure EVEX encoded insn
[(V16QI "sse4_1") (V8HI "sse2")
(V4SI "sse4_1") (V2DI "sse4_1")])
+(define_mode_attr pinsr_evex_isa
+ [(V16QI "avx512bw") (V8HI "avx512bw")
+ (V4SI "avx512dq") (V2DI "avx512dq")])
+
;; sse4_1_pinsrd must come before sse2_loadld since it is preferred.
(define_insn "<sse2p4_1>_pinsr<ssemodesuffix>"
- [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x")
+ [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x,v,v")
(vec_merge:PINSR_MODE
(vec_duplicate:PINSR_MODE
- (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,m,r,m"))
- (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x")
+ (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,m,r,m,r,m"))
+ (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x,v,v")
(match_operand:SI 3 "const_int_operand")))]
"TARGET_SSE2
&& ((unsigned) exact_log2 (INTVAL (operands[3]))
case 1:
return "pinsr<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}";
case 2:
+ case 4:
if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
return "vpinsr<ssemodesuffix>\t{%3, %k2, %1, %0|%0, %1, %k2, %3}";
/* FALLTHRU */
case 3:
+ case 5:
return "vpinsr<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
default:
gcc_unreachable ();
}
}
- [(set_attr "isa" "noavx,noavx,avx,avx")
+ [(set_attr "isa" "noavx,noavx,avx,avx,<pinsr_evex_isa>,<pinsr_evex_isa>")
(set_attr "type" "sselog")
(set (attr "prefix_rex")
(if_then_else
(const_string "*")
(const_string "1")))
(set_attr "length_immediate" "1")
- (set_attr "prefix" "orig,orig,vex,vex")
+ (set_attr "prefix" "orig,orig,vex,vex,evex,evex")
(set_attr "mode" "TI")])
(define_expand "<extract_type>_vinsert<shuffletype><extract_suf>_mask"
2016-05-12 Jakub Jelinek <jakub@redhat.com>
+ * gcc.target/i386/avx512bw-vpinsr-1.c: New test.
+ * gcc.target/i386/avx512dq-vpinsr-1.c: New test.
+ * gcc.target/i386/avx512vl-vpinsr-1.c: New test.
+
PR target/71019
* gcc.target/i386/avx512vl-pack-1.c: New test.
* gcc.target/i386/avx512vl-pack-2.c: New test.
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx512vl -mavx512bw" } */
+
+typedef char v16qi __attribute__((vector_size (16)));
+typedef short v8hi __attribute__((vector_size (16)));
+
+v16qi
+f1 (v16qi a, char b)
+{
+ register v16qi c __asm ("xmm16") = a;
+ asm volatile ("" : "+v" (c));
+ v16qi d = c;
+ ((char *) &d)[3] = b;
+ c = d;
+ asm volatile ("" : "+v" (c));
+ return c;
+}
+
+/* { dg-final { scan-assembler "vpinsrb\[^\n\r]*xmm16" } } */
+
+v8hi
+f2 (v8hi a, short b)
+{
+ register v8hi c __asm ("xmm16") = a;
+ asm volatile ("" : "+v" (c));
+ v8hi d = c;
+ ((short *) &d)[3] = b;
+ c = d;
+ asm volatile ("" : "+v" (c));
+ return c;
+}
+
+/* { dg-final { scan-assembler "vpinsrw\[^\n\r]*xmm16" } } */
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx512vl -mavx512dq" } */
+
+typedef int v4si __attribute__((vector_size (16)));
+typedef long long v2di __attribute__((vector_size (16)));
+
+v4si
+f1 (v4si a, int b)
+{
+ register v4si c __asm ("xmm16") = a;
+ asm volatile ("" : "+v" (c));
+ v4si d = c;
+ ((int *) &d)[3] = b;
+ c = d;
+ asm volatile ("" : "+v" (c));
+ return c;
+}
+
+/* { dg-final { scan-assembler "vpinsrd\[^\n\r]*xmm16" } } */
+
+v2di
+f2 (v2di a, long long b)
+{
+ register v2di c __asm ("xmm16") = a;
+ asm volatile ("" : "+v" (c));
+ v2di d = c;
+ ((long long *) &d)[1] = b;
+ c = d;
+ asm volatile ("" : "+v" (c));
+ return c;
+}
+
+/* { dg-final { scan-assembler "vpinsrq\[^\n\r]*xmm16" } } */
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mavx512vl -mno-avx512bw -mno-avx512dq" } */
+
+typedef char v16qi __attribute__((vector_size (16)));
+typedef short v8hi __attribute__((vector_size (16)));
+typedef int v4si __attribute__((vector_size (16)));
+typedef long long v2di __attribute__((vector_size (16)));
+
+v16qi
+f1 (v16qi a, char b)
+{
+ register v16qi c __asm ("xmm16") = a;
+ asm volatile ("" : "+v" (c));
+ v16qi d = c;
+ ((char *) &d)[3] = b;
+ c = d;
+ asm volatile ("" : "+v" (c));
+ return c;
+}
+
+/* { dg-final { scan-assembler-not "vpinsrb\[^\n\r]*xmm16" } } */
+
+v8hi
+f2 (v8hi a, short b)
+{
+ register v8hi c __asm ("xmm16") = a;
+ asm volatile ("" : "+v" (c));
+ v8hi d = c;
+ ((short *) &d)[3] = b;
+ c = d;
+ asm volatile ("" : "+v" (c));
+ return c;
+}
+
+/* { dg-final { scan-assembler-not "vpinsrw\[^\n\r]*xmm16" } } */
+
+v4si
+f3 (v4si a, int b)
+{
+ register v4si c __asm ("xmm16") = a;
+ asm volatile ("" : "+v" (c));
+ v4si d = c;
+ ((int *) &d)[3] = b;
+ c = d;
+ asm volatile ("" : "+v" (c));
+ return c;
+}
+
+/* { dg-final { scan-assembler-not "vpinsrd\[^\n\r]*xmm16" } } */
+
+v2di
+f4 (v2di a, char b)
+{
+ register v2di c __asm ("xmm16") = a;
+ asm volatile ("" : "+v" (c));
+ v2di d = c;
+ ((long long *) &d)[1] = b;
+ c = d;
+ asm volatile ("" : "+v" (c));
+ return c;
+}
+
+/* { dg-final { scan-assembler-not "vpinsrq\[^\n\r]*xmm16" } } */