diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2020-05-04 18:53:30 +0200 |
---|---|---|
committer | Uros Bizjak <ubizjak@gmail.com> | 2020-05-04 18:53:30 +0200 |
commit | 9decd08b7b153a593a0b61e4f5373cb9574a1973 (patch) | |
tree | c5af1ef9949c4a9658cb54802bf8c280a9bcecc3 /gcc/tree-streamer-in.c | |
parent | 97268c374a348a60c53366a4bee67626c840e4a1 (diff) | |
download | gcc-9decd08b7b153a593a0b61e4f5373cb9574a1973.zip gcc-9decd08b7b153a593a0b61e4f5373cb9574a1973.tar.gz gcc-9decd08b7b153a593a0b61e4f5373cb9574a1973.tar.bz2 |
i386: Use SBB more [PR94650]
When returning 0 or -1, "SBB reg,reg" instruction that borrows carry
flag can be used. Carry flag can be generated by converting compare
with zero to a LTU compare with one, so e.g.
return -(x == 0)
generates:
cmpq $1, %rdi
sbbq %rax, %rax
instead of:
xorl %eax, %eax
testq %rdi, %rdi
sete %al
negq %rax
A similar conversion can be used for
return -(x != 0)
where NEG insn can be used instead of compare. According to x86 ISA,
NEG insn sets carry flag when the source operand is != 0, resulting in:
negq %rdi
sbbq %rax, %rax
The conversion avoids partial register stall with SETcc instructions.
PR target/94795
* config/i386/i386.md (*neg<mode>_ccc): New insn pattern.
(EQ compare->LTU compare splitter): New splitter.
(NE compare->NEG splitter): Ditto.
testsuite/ChangeLog:
PR target/94795
* gcc.target/i386/pr94795-1.c: New test.
* gcc.target/i386/pr94795-2.c: New test.
Diffstat (limited to 'gcc/tree-streamer-in.c')
0 files changed, 0 insertions, 0 deletions