diff options
author | Xi Ruoyao <xry111@xry111.site> | 2025-07-15 03:01:12 +0800 |
---|---|---|
committer | Xi Ruoyao <xry111@xry111.site> | 2025-07-17 16:05:30 +0800 |
commit | d626debcb3717f18bf2ee88f4281b109b13e1181 (patch) | |
tree | 60e4f90e9135c5880b00874a723106215b583d48 /gcc/tree-ssa-loop-prefetch.cc | |
parent | 246ecf81612518196f4aa45fe96f85831fe408ff (diff) | |
download | gcc-d626debcb3717f18bf2ee88f4281b109b13e1181.zip gcc-d626debcb3717f18bf2ee88f4281b109b13e1181.tar.gz gcc-d626debcb3717f18bf2ee88f4281b109b13e1181.tar.bz2 |
LoongArch: Fix wrong code generated by TARGET_VECTORIZE_VEC_PERM_CONST [PR121064]
When TARGET_VECTORIZE_VEC_PERM_CONST is called, target may be the
same pseudo as op0 and/or op1. Loading the selector into target
would clobber the input, producing wrong code like
vld $vr0, $t0
vshuf.w $vr0, $vr0, $vr1
So don't load the selector into d->target, use a new pseudo to hold the
selector instead. The reload pass will load the pseudo for selector and
the pseudo for target into the same hard register (following our
constraint '0' on the shuf instructions) anyway.
gcc/ChangeLog:
PR target/121064
* config/loongarch/lsx.md (lsx_vshuf_<lsxfmt_f>): Add '@' to
generate a mode-aware helper. Use <VIMODE> as the mode of the
operand 1 (selector).
* config/loongarch/lasx.md (lasx_xvshuf_<lasxfmt_f>): Likewise.
* config/loongarch/loongarch.cc
(loongarch_try_expand_lsx_vshuf_const): Create a new pseudo for
the selector. Use the mode-aware helper to simplify the code.
(loongarch_expand_vec_perm_const): Likewise.
gcc/testsuite/ChangeLog:
PR target/121064
* gcc.target/loongarch/pr121064.c: New test.
Diffstat (limited to 'gcc/tree-ssa-loop-prefetch.cc')
0 files changed, 0 insertions, 0 deletions