diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2022-01-02 21:12:10 +0100 |
---|---|---|
committer | Uros Bizjak <ubizjak@gmail.com> | 2022-01-02 21:13:14 +0100 |
commit | 9ff206d3865df5cb8407490aa9481029beac087f (patch) | |
tree | fb8a6fee872e0a4ddc63c25ab4dd90ee7983428e /gcc/fortran/cpp.c | |
parent | 6bec6e3aaa306ca7b87d6e6654acca546fa25e90 (diff) | |
download | gcc-9ff206d3865df5cb8407490aa9481029beac087f.zip gcc-9ff206d3865df5cb8407490aa9481029beac087f.tar.gz gcc-9ff206d3865df5cb8407490aa9481029beac087f.tar.bz2 |
i386: Introduce V2QImode vectorized arithmetic [PR103861]
This patch adds basic V2QImode infrastructure and V2QImode arithmetic
operations (plus, minus and neg). The patched compiler can emit SSE
vectorized QImode operations (e.g. PADDB) with partial QImode vector,
and also synthesized double HI/LO QImode operations with integer registers.
The testcase:
typedef char __v2qi __attribute__ ((__vector_size__ (2)));
__v2qi plus (__v2qi a, __v2qi b) { return a + b; };
compiles with -O2 to:
movl %edi, %edx
movl %esi, %eax
addb %sil, %dl
addb %ah, %dh
movl %edx, %eax
ret
which is much better than what the unpatched compiler produces:
movl %edi, %eax
movl %esi, %edx
xorl %ecx, %ecx
movb %dil, %cl
movsbl %dh, %edx
movsbl %ah, %eax
addl %edx, %eax
addb %sil, %cl
movb %al, %ch
movl %ecx, %eax
ret
The V2QImode vectorization does not require vector registers, so it can
be enabled by default also for 32-bit targets without SSE.
The patch also enables vectorized V2QImode sign/zero extends.
2021-12-30 Uroš Bizjak <ubizjak@gmail.com>
gcc/ChangeLog:
PR target/103861
* config/i386/i386.h (VALID_SSE2_REG_MODE): Add V2QImode.
(VALID_INT_MODE_P): Ditto.
* config/i386/i386.c (ix86_secondary_reload): Handle
V2QImode reloads from SSE register to memory.
(vector_mode_supported_p): Always return true for V2QImode.
* config/i386/i386.md (*subqi_ext<mode>_2): New insn pattern.
(*negqi_ext<mode>_2): Ditto.
* config/i386/mmx.md (movv2qi): New expander.
(movmisalignv2qi): Ditto.
(*movv2qi_internal): New insn pattern.
(*pushv2qi2): Ditto.
(negv2qi2 and splitters): Ditto.
(<plusminus:insn>v2qi3 and splitters): Ditto.
gcc/testsuite/ChangeLog:
PR target/103861
* gcc.dg/store_merging_18.c (dg-options): Add -fno-tree-vectorize.
* gcc.dg/store_merging_29.c (dg-options): Ditto.
* gcc.target/i386/pr103861.c: New test.
* gcc.target/i386/pr92658-avx512vl.c (dg-final):
Remove vpmovqb scan-assembler xfail.
* gcc.target/i386/pr92658-sse4.c (dg-final):
Remove pmovzxbq scan-assembler xfail.
* gcc.target/i386/pr92658-sse4-2.c (dg-final):
Remove pmovsxbq scan-assembler xfail.
* gcc.target/i386/warn-vect-op-2.c (dg-warning): Adjust warnings.
Diffstat (limited to 'gcc/fortran/cpp.c')
0 files changed, 0 insertions, 0 deletions