diff options
author | Roger Sayle <roger@nextmovesoftware.com> | 2023-05-08 23:48:46 +0100 |
---|---|---|
committer | Roger Sayle <roger@nextmovesoftware.com> | 2023-05-08 23:48:46 +0100 |
commit | 1e3054d27c83eea54a82c0f87bc858ba1ebd27d2 (patch) | |
tree | fce58e6641c2498bf52f84d9f53d4054fd2b4628 /gcc/fortran | |
parent | 3d9853eeb2de07d26511c2335a29db8eeadb4d98 (diff) | |
download | gcc-1e3054d27c83eea54a82c0f87bc858ba1ebd27d2.zip gcc-1e3054d27c83eea54a82c0f87bc858ba1ebd27d2.tar.gz gcc-1e3054d27c83eea54a82c0f87bc858ba1ebd27d2.tar.bz2 |
[x86_64] Introduce insvti_highpart define_insn_and_split.
This is a repost/respin of a patch that was conditionally approved:
https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609470.html
This patch adds a convenient post-reload splitter for setting/updating
the highpart of a TImode variable, using i386's previously added
split_double_concat infrastructure.
For the new test case below:
__int128 foo(__int128 x, unsigned long long y)
{
__int128 t = (__int128)y << 64;
__int128 r = (x & ~0ull) | t;
return r;
}
mainline GCC with -O2 currently generates:
foo: movq %rdi, %rcx
xorl %eax, %eax
xorl %edi, %edi
orq %rcx, %rax
orq %rdi, %rdx
ret
with this patch, GCC instead now generates the much better:
foo: movq %rdi, %rcx
movq %rcx, %rax
ret
It turns out that the -m32 equivalent of this testcase, already
avoids using explict orl/xor instructions, as it gets optimized
(in combine) by a completely different path. Given that this idiom
isn't seen in 32-bit code (so this pattern doesn't match with -m32),
and also that the shorter 32-bit AND bitmask is represented as a
CONST_INT rather than a CONST_WIDE_INT, this new define_insn_and_split
is implemented for just TARGET_64BIT rather than contort a "generic"
implementation using DWI mode iterators.
2023-05-08 Roger Sayle <roger@nextmovesoftware.com>
Uros Bizjak <ubizjak@gmail.com>
gcc/ChangeLog
* config/i386/i386.md (any_or_plus): Move definition earlier.
(*insvti_highpart_1): New define_insn_and_split to overwrite
(insv) the highpart of a TImode register/memory.
gcc/testsuite/ChangeLog
* gcc.target/i386/insvti_highpart-1.c: New test case.
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions