* [committed] i386: Improve *cmp<dwi>_doubleword splitter [PR113701]
@ 2024-02-01 20:27 Uros Bizjak
0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2024-02-01 20:27 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1359 bytes --]
The fix for PR70321 introduced a splitter that split a doubleword
comparison into a pair of XORs followed by an IOR to set the (zero)
flags register. To help the reload, splitter forced SUBREG pieces of
double-word input values to a pseudo, but this regressed
gcc.target/i386/pr82580.c
int f0 (U x, U y) { return x == y; }
from:
xorq %rdx, %rdi
xorq %rcx, %rsi
xorl %eax, %eax
orq %rsi, %rdi
sete %al
ret
to:
xchgq %rdi, %rsi
movq %rdx, %r8
movq %rcx, %rax
movq %rsi, %rdx
movq %rdi, %rcx
xorq %rax, %rcx
xorq %r8, %rdx
xorl %eax, %eax
orq %rcx, %rdx
sete %al
ret
To mitigate the regression, remove this legacy heuristic (workaround?).
There have been many incremental changes and improvements to x86 TImode
and register allocation, so this legacy workaround is not only no longer
useful, but it actually hurts register allocation. The patched compiler
now produces:
xchgq %rdi, %rsi
xorl %eax, %eax
xorq %rsi, %rdx
xorq %rdi, %rcx
orq %rcx, %rdx
sete %al
ret
PR target/113701
gcc/ChangeLog:
* config/i386/i386.md (*cmp<dwi>_doubleword):
Do not force SUBREG pieces to pseudos.
Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
Uros.
[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 612 bytes --]
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index bac0a6ade67..a82f2e456fe 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -1632,10 +1632,6 @@ (define_insn_and_split "*cmp<dwi>_doubleword"
(set (match_dup 4) (ior:DWIH (match_dup 4) (match_dup 5)))])]
{
split_double_mode (<DWI>mode, &operands[0], 2, &operands[0], &operands[2]);
- /* Placing the SUBREG pieces in pseudos helps reload. */
- for (int i = 0; i < 4; i++)
- if (SUBREG_P (operands[i]))
- operands[i] = force_reg (<MODE>mode, operands[i]);
operands[4] = gen_reg_rtx (<MODE>mode);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-01 20:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01 20:27 [committed] i386: Improve *cmp<dwi>_doubleword splitter [PR113701] Uros Bizjak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).