From: Jakub Jelinek Date: Fri, 6 May 2016 13:15:24 +0000 (+0200) Subject: sse.md (ashr3): Move before the ashr3 pattern. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dd3b6464c54804dcfa82bba61a10c46706a65bed;p=gcc.git sse.md (ashr3): Move before the ashr3 pattern. * config/i386/sse.md (ashr3): Move before the ashr3 pattern. * gcc.target/i386/avx512bw-vpsraw-3.c: New test. * gcc.target/i386/avx512vl-vpsrad-3.c: New test. From-SVN: r235972 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 14ca88749af..886905dbc8a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2016-05-06 Jakub Jelinek + * config/i386/sse.md (ashr3): Move + before the ashr3 pattern. + * config/i386/sse.md (*avx2_pmaddwd, *sse2_pmaddwd): Use v instead of x in vex or maybe_vex alternatives, use maybe_evex instead of vex in prefix. diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index b7b8966d294..bb0d217583e 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -10088,6 +10088,20 @@ DONE; }) +(define_insn "ashr3" + [(set (match_operand:VI24_AVX512BW_1 0 "register_operand" "=v,v") + (ashiftrt:VI24_AVX512BW_1 + (match_operand:VI24_AVX512BW_1 1 "nonimmediate_operand" "v,vm") + (match_operand:SI 2 "nonmemory_operand" "v,N")))] + "TARGET_AVX512VL" + "vpsra\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "type" "sseishft") + (set (attr "length_immediate") + (if_then_else (match_operand 2 "const_int_operand") + (const_string "1") + (const_string "0"))) + (set_attr "mode" "")]) + (define_insn "ashr3" [(set (match_operand:VI24_AVX2 0 "register_operand" "=x,x") (ashiftrt:VI24_AVX2 @@ -10107,20 +10121,6 @@ (set_attr "prefix" "orig,vex") (set_attr "mode" "")]) -(define_insn "ashr3" - [(set (match_operand:VI24_AVX512BW_1 0 "register_operand" "=v,v") - (ashiftrt:VI24_AVX512BW_1 - (match_operand:VI24_AVX512BW_1 1 "nonimmediate_operand" "v,vm") - (match_operand:SI 2 "nonmemory_operand" "v,N")))] - "TARGET_AVX512VL" - "vpsra\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "type" "sseishft") - (set (attr "length_immediate") - (if_then_else (match_operand 2 "const_int_operand") - (const_string "1") - (const_string "0"))) - (set_attr "mode" "")]) - (define_insn "ashrv2di3" [(set (match_operand:V2DI 0 "register_operand" "=v,v") (ashiftrt:V2DI diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b7a06a27988..75fa9c6d94e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-05-06 Jakub Jelinek + * gcc.target/i386/avx512bw-vpsraw-3.c: New test. + * gcc.target/i386/avx512vl-vpsrad-3.c: New test. + * gcc.target/i386/avx512bw-vpmaddwd-3.c: New test. 2016-05-06 Yuri Rumyantsev diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-vpsraw-3.c b/gcc/testsuite/gcc.target/i386/avx512bw-vpsraw-3.c new file mode 100644 index 00000000000..305dbccb9a0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512bw-vpsraw-3.c @@ -0,0 +1,44 @@ +/* { dg-do assemble { target { avx512bw && { avx512vl && { ! ia32 } } } } } */ +/* { dg-options "-O2 -mavx512bw -mavx512vl" } */ + +#include + +void +f1 (__m128i x, int y) +{ + register __m128i a __asm ("xmm16"); + a = x; + asm volatile ("" : "+v" (a)); + a = _mm_srai_epi16 (a, y); + asm volatile ("" : "+v" (a)); +} + +void +f2 (__m128i x) +{ + register __m128i a __asm ("xmm16"); + a = x; + asm volatile ("" : "+v" (a)); + a = _mm_srai_epi16 (a, 16); + asm volatile ("" : "+v" (a)); +} + +void +f3 (__m256i x, int y) +{ + register __m256i a __asm ("xmm16"); + a = x; + asm volatile ("" : "+v" (a)); + a = _mm256_srai_epi16 (a, y); + asm volatile ("" : "+v" (a)); +} + +void +f4 (__m256i x) +{ + register __m256i a __asm ("xmm16"); + a = x; + asm volatile ("" : "+v" (a)); + a = _mm256_srai_epi16 (a, 16); + asm volatile ("" : "+v" (a)); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpsrad-3.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpsrad-3.c new file mode 100644 index 00000000000..2e3f92b58b7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpsrad-3.c @@ -0,0 +1,44 @@ +/* { dg-do assemble { target { avx512vl && { ! ia32 } } } } */ +/* { dg-options "-O2 -mavx512vl" } */ + +#include + +void +f1 (__m128i x, int y) +{ + register __m128i a __asm ("xmm16"); + a = x; + asm volatile ("" : "+v" (a)); + a = _mm_srai_epi32 (a, y); + asm volatile ("" : "+v" (a)); +} + +void +f2 (__m128i x) +{ + register __m128i a __asm ("xmm16"); + a = x; + asm volatile ("" : "+v" (a)); + a = _mm_srai_epi32 (a, 16); + asm volatile ("" : "+v" (a)); +} + +void +f3 (__m256i x, int y) +{ + register __m256i a __asm ("xmm16"); + a = x; + asm volatile ("" : "+v" (a)); + a = _mm256_srai_epi32 (a, y); + asm volatile ("" : "+v" (a)); +} + +void +f4 (__m256i x) +{ + register __m256i a __asm ("xmm16"); + a = x; + asm volatile ("" : "+v" (a)); + a = _mm256_srai_epi32 (a, 16); + asm volatile ("" : "+v" (a)); +}