diff options
| author | Avinash Jayakar <avinashd@linux.ibm.com> | 2025-10-28 09:49:21 +0530 |
|---|---|---|
| committer | Avinash Jayakar <avinashd@linux.ibm.com> | 2025-10-28 09:56:24 +0530 |
| commit | abbed7806672d0d6cfd6169d084d031d6e737fe1 (patch) | |
| tree | 0de227d0dfca546dd9ec74cade69f38f69ba74b5 /contrib/gcc-changelog/git_commit.py | |
| parent | 71233d31704fa5eff6d3a7921f1af18257630405 (diff) | |
| download | gcc-abbed7806672d0d6cfd6169d084d031d6e737fe1.zip gcc-abbed7806672d0d6cfd6169d084d031d6e737fe1.tar.gz gcc-abbed7806672d0d6cfd6169d084d031d6e737fe1.tar.bz2 | |
vect: Add vector lowering for MULT_EXPR for constant pow2 multiplication.
Use logic similar to lowering the vector operation for MULT_EXPR as done in
expand_mult in expmed.cc, but in this commit only bare bones version of what
is done in vect_synth_mult_by_constant is implemented that only works if
constant is a positive power of 2 constant.
Previously, if the source code is written in a vector dialect, for example the
vector types of altivec.h, the vectorizer would lower the MULT_EXPR to scalar
variant if the target did not support the vector insn for that type. But better
code could be generated had it recognized the pattern and transformed it to
shifts.
For example, this code
vector unsigned long long
lshift1_64_altivec (vector unsigned long long a)
{
return a * (vector unsigned long long) { 4, 4 };
}
generates the scalar code in power8/9
.cfi_startproc
xxpermdi 0,34,34,3
mfvsrd 9,34
mfvsrd 10,0
sldi 9,9,2
mtvsrd 0,9
sldi 10,10,2
mtvsrd 34,10
xxpermdi 34,0,34,0
blr
.long 0
.byte 0,0,0,0,0,0,0,0
.cfi_endproc
although it has a vector insn for left shift. With this change now the
following is generated
.cfi_startproc
lxvd2x 32,0,3
vspltisw 1,2
vsld 0,0,1
stxvd2x 32,0,3
blr
.long 0
.byte 0,0,0,0,0,0,0,0
.cfi_endproc
2025-11-28 Avinash Jayakar <avinashd@linux.ibm.com>
gcc/ChangeLog:
PR tree-optimization/122065
* tree-vect-generic.cc (add_rshift): Update name and add code parameter.
(add_shift): Update name.
(expand_vector_mult): New lowering for MULT_EXPR.
(expand_vector_divmod): Use updated function name.
(expand_vector_operation): Use updated function name.
Diffstat (limited to 'contrib/gcc-changelog/git_commit.py')
0 files changed, 0 insertions, 0 deletions
