From: Roger Sayle Date: Sun, 31 Dec 2023 21:37:24 +0000 (+0000) Subject: i386: Tweak define_insn_and_split to fix FAIL of gcc.target/i386/pr43644-2.c X-Git-Tag: basepoints/gcc-15~3265 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79e1b23b91477b29deccf2cae92a7e8dd816c54a;p=thirdparty%2Fgcc.git i386: Tweak define_insn_and_split to fix FAIL of gcc.target/i386/pr43644-2.c This patch resolves the failure of pr43644-2.c in the testsuite, a code quality test I added back in July, that started failing as the code GCC generates for 128-bit values (and their parameter passing) has been in flux. The function: unsigned __int128 foo(unsigned __int128 x, unsigned long long y) { return x+y; } currently generates: foo: movq %rdx, %rcx movq %rdi, %rax movq %rsi, %rdx addq %rcx, %rax adcq $0, %rdx ret and with this patch, we now generate: foo: movq %rdi, %rax addq %rdx, %rax movq %rsi, %rdx adcq $0, %rdx which is optimal. 2023-12-31 Uros Bizjak Roger Sayle gcc/ChangeLog PR target/43644 * config/i386/i386.md (*add3_doubleword_concat_zext): Tweak order of instructions after split, to minimize number of moves. gcc/testsuite/ChangeLog PR target/43644 * gcc.target/i386/pr43644-2.c: Expect 2 movq instructions. --- diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index e693d937ba4a..b8e1df4c02bf 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -6411,13 +6411,13 @@ "#" "&& reload_completed" [(set (match_dup 0) (match_dup 4)) - (set (match_dup 5) (match_dup 2)) (parallel [(set (reg:CCC FLAGS_REG) (compare:CCC (plus:DWIH (match_dup 0) (match_dup 1)) (match_dup 0))) (set (match_dup 0) (plus:DWIH (match_dup 0) (match_dup 1)))]) + (set (match_dup 5) (match_dup 2)) (parallel [(set (match_dup 5) (plus:DWIH (plus:DWIH diff --git a/gcc/testsuite/gcc.target/i386/pr43644-2.c b/gcc/testsuite/gcc.target/i386/pr43644-2.c index d470b0adbb54..3316ac63ffb7 100644 --- a/gcc/testsuite/gcc.target/i386/pr43644-2.c +++ b/gcc/testsuite/gcc.target/i386/pr43644-2.c @@ -6,4 +6,4 @@ unsigned __int128 foo(unsigned __int128 x, unsigned long long y) return x+y; } -/* { dg-final { scan-assembler-times "movq" 1 } } */ +/* { dg-final { scan-assembler-times "movq" 2 } } */