aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2023-01-01 17:00:28 +0000
committerRoger Sayle <roger@nextmovesoftware.com>2023-01-01 17:00:28 +0000
commit4f1314f547f69d3a2b1f16ce301267e3bfb4e427 (patch)
treecd81f61942e259e4949991d71322753d0f895857 /gcc/objc
parentd64f877906111645af0217d4d54993a7b2ecbd2e (diff)
downloadgcc-4f1314f547f69d3a2b1f16ce301267e3bfb4e427.zip
gcc-4f1314f547f69d3a2b1f16ce301267e3bfb4e427.tar.gz
gcc-4f1314f547f69d3a2b1f16ce301267e3bfb4e427.tar.bz2
Add post-reload splitter for extendditi2 on x86_64.
This is another step towards a possible solution for PR 105137. This patch introduces a define_insn for extendditi2 that allows DImode to TImode sign-extension to be represented in the early RTL optimizers, before being split post-reload into the exact same idiom as currently produced by RTL expansion. Typically this produces the identical code, so the first new test case: __int128 foo(long long x) { return (__int128)x; } continues to generate: foo: movq %rdi, %rax cqto ret The "magic" is that this representation allows combine and the other RTL optimizers to do a better job. Hence, the second test case: __int128 foo(__int128 a, long long b) { a += ((__int128)b) << 70; return a; } which mainline with -O2 currently generates as: foo: movq %rsi, %rax movq %rdx, %rcx movq %rdi, %rsi salq $6, %rcx movq %rax, %rdi xorl %eax, %eax movq %rcx, %rdx addq %rsi, %rax adcq %rdi, %rdx ret with this patch now becomes: foo: movl $0, %eax salq $6, %rdx addq %rdi, %rax adcq %rsi, %rdx ret i.e. the same code for the signed and unsigned extension variants. 2023-01-01 Roger Sayle <roger@nextmovesoftware.com> Uroš Bizjak <ubizjak@gmail.com> gcc/ChangeLog * config/i386/i386.md (extendditi2): New define_insn. (define_split): Use DWIH mode iterator to treat new extendditi2 identically to existing extendsidi2_1. (define_peephole2): Likewise. (define_peephole2): Likewise. (define_Split): Likewise. gcc/testsuite/ChangeLog * gcc.target/i386/extendditi2-1.c: New test case. * gcc.target/i386/extendditi2-2.c: Likewise.
Diffstat (limited to 'gcc/objc')
0 files changed, 0 insertions, 0 deletions