aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.cc
diff options
context:
space:
mode:
authorLi Wei <liwei@loongson.cn>2024-01-11 19:36:19 +0800
committerLulu Cheng <chenglulu@loongson.cn>2024-01-12 09:48:01 +0800
commit493bebb3cdee6c4dc4828695f7d3b36a9844d0f8 (patch)
tree1e68f056d69275ff4e5a301a4aecb5d3c964d23a /gcc/fold-const.cc
parent1a80e9558dd7fed1a9d22b3606489f72e4dd8c20 (diff)
downloadgcc-493bebb3cdee6c4dc4828695f7d3b36a9844d0f8.zip
gcc-493bebb3cdee6c4dc4828695f7d3b36a9844d0f8.tar.gz
gcc-493bebb3cdee6c4dc4828695f7d3b36a9844d0f8.tar.bz2
LoongArch: Redundant sign extension elimination optimization.
We found that the current combine optimization pass in gcc cannot handle the following redundant sign extension situations: (insn 77 76 78 5 (set (reg:SI 143) (plus:SI (subreg/s/u:SI (reg/v:DI 104 [ len ]) 0) (const_int 1 [0x1]))) {addsi3} (expr_list:REG_DEAD (reg/v:DI 104 [ len ]) (nil))) (insn 78 77 82 5 (set (reg/v:DI 104 [ len ]) (sign_extend:DI (reg:SI 143))) {extendsidi2} (nil)) Because reg:SI 143 is not died or set in insn 78, no replacement merge will be performed for the insn sequence. We adjusted the add template to eliminate redundant sign extensions during the expand pass. Adjusted based on upstream comments: https://gcc.gnu.org/pipermail/gcc-patches/2024-January/641988.html gcc/ChangeLog: * config/loongarch/loongarch.md (add<mode>3): Removed. (*addsi3): New. (addsi3): Ditto. (adddi3): Ditto. (*addsi3_extended): Removed. (addsi3_extended): New. gcc/testsuite/ChangeLog: * gcc.target/loongarch/sign-extend.c: Moved to... * gcc.target/loongarch/sign-extend-1.c: ...here. * gcc.target/loongarch/sign-extend-2.c: New test.
Diffstat (limited to 'gcc/fold-const.cc')
0 files changed, 0 insertions, 0 deletions