diff options
author | Roger Sayle <roger@nextmovesoftware.com> | 2024-05-10 20:26:40 +0100 |
---|---|---|
committer | Roger Sayle <roger@nextmovesoftware.com> | 2024-05-10 20:26:40 +0100 |
commit | f5a8cdc1ef5d6aa2de60849c23658ac5298df7bb (patch) | |
tree | f422051468333c424c1f2153c445174635cab2ab /gcc/dwarf2codeview.cc | |
parent | d4d30461c02b50c07f92c8cccb87da528a806d3e (diff) | |
download | gcc-f5a8cdc1ef5d6aa2de60849c23658ac5298df7bb.zip gcc-f5a8cdc1ef5d6aa2de60849c23658ac5298df7bb.tar.gz gcc-f5a8cdc1ef5d6aa2de60849c23658ac5298df7bb.tar.bz2 |
i386: Improve V[48]QI shifts on AVX512/SSE4.1
The following one line patch improves the code generated for V8QI and V4QI
shifts when AV512BW and AVX512VL functionality is available.
For the testcase (from gcc.target/i386/vect-shiftv8qi.c):
typedef signed char v8qi __attribute__ ((__vector_size__ (8)));
v8qi foo (v8qi x) { return x >> 5; }
GCC with -O2 -march=cascadelake currently generates:
foo: movl $67372036, %eax
vpsraw $5, %xmm0, %xmm2
vpbroadcastd %eax, %xmm1
movl $117901063, %eax
vpbroadcastd %eax, %xmm3
vmovdqa %xmm1, %xmm0
vmovdqa %xmm3, -24(%rsp)
vpternlogd $120, -24(%rsp), %xmm2, %xmm0
vpsubb %xmm1, %xmm0, %xmm0
ret
with this patch we now generate the much improved:
foo: vpmovsxbw %xmm0, %xmm0
vpsraw $5, %xmm0, %xmm0
vpmovwb %xmm0, %xmm0
ret
This patch also fixes the FAILs of gcc.target/i386/vect-shiftv[48]qi.c
when run with the additional -march=cascadelake flag, by splitting these
tests into two; one form testing code generation with -msse2 (and
-mno-avx512vl) as originally intended, and the other testing AVX512
code generation with an explicit -march=cascadelake.
2024-05-10 Roger Sayle <roger@nextmovesoftware.com>
Hongtao Liu <hongtao.liu@intel.com>
gcc/ChangeLog
* config/i386/i386-expand.cc (ix86_expand_vecop_qihi_partial):
Don't attempt ix86_expand_vec_shift_qihi_constant on SSE4.1.
gcc/testsuite/ChangeLog
* gcc.target/i386/vect-shiftv4qi.c: Specify -mno-avx512vl.
* gcc.target/i386/vect-shiftv8qi.c: Likewise.
* gcc.target/i386/vect-shiftv4qi-2.c: New test case.
* gcc.target/i386/vect-shiftv8qi-2.c: Likewise.
Diffstat (limited to 'gcc/dwarf2codeview.cc')
0 files changed, 0 insertions, 0 deletions