diff options
| author | Xi Ruoyao <xry111@xry111.site> | 2025-02-22 15:34:54 +0800 |
|---|---|---|
| committer | Lulu Cheng <chenglulu@loongson.cn> | 2025-11-05 09:52:18 +0800 |
| commit | d7434f3babc5a954fa68dd0c8ce6d4e917a017c1 (patch) | |
| tree | e57c262d8949bbc3f1ec0cdf17f76926eb443bd2 /libgrust/rustc-lib/stdarch/crates/assert-instr-macro | |
| parent | 84974b9e663cab1e1ed19939e953d6369a84ac05 (diff) | |
| download | gcc-d7434f3babc5a954fa68dd0c8ce6d4e917a017c1.zip gcc-d7434f3babc5a954fa68dd0c8ce6d4e917a017c1.tar.gz gcc-d7434f3babc5a954fa68dd0c8ce6d4e917a017c1.tar.bz2 | |
LoongArch: Avoid unnecessary zero-initialization using LSX for scalar popcount
Now for __builtin_popcountl we are getting things like
vrepli.b $vr0,0
vinsgr2vr.d $vr0,$r4,0
vpcnt.d $vr0,$vr0
vpickve2gr.du $r4,$vr0,0
slli.w $r4,$r4,0
jr $r1
The "vrepli.b" instruction is introduced by the init-regs pass (see
PR61810 and all the issues it references). To work it around, we can
use post-reload instead of define_expand: the "f" constraint will make
the compiler automatically move the scalar between GPR and FPR, and
reload is much later than init-regs so init-regs won't get in our way.
Now the code looks like:
movgr2fr.d $f0,$r4
vpcnt.d $vr0,$vr0
movfr2gr.d $r4,$f0
jr $r1
gcc/ChangeLog:
* config/loongarch/loongarch.md (cntmap): Change to uppercase.
(popcount<GPR:mode>2): Modify to a post reload split.
Diffstat (limited to 'libgrust/rustc-lib/stdarch/crates/assert-instr-macro')
0 files changed, 0 insertions, 0 deletions
