aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src/std/algorithm/internal.d
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2022-08-03 09:03:17 +0100
committerRoger Sayle <roger@nextmovesoftware.com>2022-08-03 09:03:17 +0100
commite6b011bcfd52c245978ccd540e3f929571c59471 (patch)
treee21eecf84eda974e76f8737f77a801c3edb15269 /libphobos/src/std/algorithm/internal.d
parent7baed397dd0c220a72589c435e7db1676aced01e (diff)
downloadgcc-e6b011bcfd52c245978ccd540e3f929571c59471.zip
gcc-e6b011bcfd52c245978ccd540e3f929571c59471.tar.gz
gcc-e6b011bcfd52c245978ccd540e3f929571c59471.tar.bz2
Improved pre-reload split of double word comparison against -1 on x86.
This patch adds an extra optimization to *cmp<dwi>_doubleword to improve the code generated for comparisons against -1. Hypothetically, if a comparison against -1 reached this splitter we'd currently generate code that looks like: notq %rdx ; 3 bytes notq %rax ; 3 bytes orq %rdx, %rax ; 3 bytes setne %al With this patch we would instead generate the superior: andq %rdx, %rax ; 3 bytes cmpq $-1, %rax ; 4 bytes setne %al which is both faster and smaller, and also what's currently generated thanks to the middle-end splitting double word comparisons against zero and minus one during RTL expansion. Should that change, this would become a missed-optimization regression, but this patch also (potentially) helps suitable comparisons created by CSE and combine. 2022-08-03 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * config/i386/i386.md (*cmp<dwi>_doubleword): Add a special case to split comparisons against -1 using AND and CMP -1 instructions.
Diffstat (limited to 'libphobos/src/std/algorithm/internal.d')
0 files changed, 0 insertions, 0 deletions