aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2024-06-09 12:09:13 +0200
committerUros Bizjak <ubizjak@gmail.com>2024-06-09 12:10:28 +0200
commit8bb6b2f4ae19c3aab7d7a5e5c8f5965f89d90e01 (patch)
treeb22aa103dfdd6c37bbedbd139a74aad38d5da2b5 /gcc/ada
parentad2775b0e3d65b0b844bfd13e2f8b15240fb3b93 (diff)
downloadgcc-8bb6b2f4ae19c3aab7d7a5e5c8f5965f89d90e01.zip
gcc-8bb6b2f4ae19c3aab7d7a5e5c8f5965f89d90e01.tar.gz
gcc-8bb6b2f4ae19c3aab7d7a5e5c8f5965f89d90e01.tar.bz2
i386: Implement .SAT_SUB for unsigned scalar integers [PR112600]
The following testcase: unsigned sub_sat (unsigned x, unsigned y) { unsigned res; res = x - y; res &= -(x >= y); return res; } currently compiles (-O2) to: sub_sat: movl %edi, %edx xorl %eax, %eax subl %esi, %edx cmpl %esi, %edi setnb %al negl %eax andl %edx, %eax ret We can expand through ussub{m}3 optab to use carry flag from the subtraction and generate code using SBB instruction implementing: unsigned res = x - y; res &= ~(-(x < y)); sub_sat: subl %esi, %edi sbbl %eax, %eax notl %eax andl %edi, %eax ret PR target/112600 gcc/ChangeLog: * config/i386/i386.md (ussub<mode>3): New expander. (sub<mode>_3): Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/pr112600-b.c: New test.
Diffstat (limited to 'gcc/ada')
0 files changed, 0 insertions, 0 deletions