]> git.ipfire.org Git - thirdparty/gcc.git/commit
prefer Zicond primitive semantics to SFB
authorFei Gao <gaofei@eswincomputing.com>
Tue, 28 Nov 2023 02:32:24 +0000 (02:32 +0000)
committerFei Gao <gaofei@eswincomputing.com>
Mon, 4 Dec 2023 06:55:47 +0000 (06:55 +0000)
commitfc98a41c8def1cab4f9b8359be84e8623eab88e2
tree8eaf60dfa1578c71be3bbf283f1714098f29f043
parentba94969bad24d57895b02cc2d4663462f8fb5bc5
prefer Zicond primitive semantics to SFB

Move Zicond md files ahead of SFB to recognize Zicond first.

Take the following case for example.

CFLAGS: -mtune=sifive-7-series -march=rv64gc_zicond -mabi=lp64d

long primitiveSemantics_00(long a, long b) { return a == 0 ? 0 : b; }

before patch:
primitiveSemantics_00:
bne a0,zero,1f # movcc
mv a1,zero
1:
mv a0,a1
ret

after patch:
primitiveSemantics_00:
czero.eqz a0,a1,a0
ret

Co-authored-by: Xiao Zeng<zengxiao@eswincomputing.com>
gcc/ChangeLog:

* config/riscv/riscv.md (*mov<GPR:mode><X:mode>cc):move to sfb.md
* config/riscv/sfb.md: New file.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/zicond-sfb-primitiveSemantics.c: New test.
gcc/config/riscv/riscv.md
gcc/config/riscv/sfb.md [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zicond-sfb-primitiveSemantics.c [new file with mode: 0644]