On 2/24/21 11:59 AM, Jakub Jelinek via Gcc-patches wrote:
> Hi!
>
> The r10-2806 change regressed following testcases, instead of doing
> int -> unsigned long sign-extension once and then add 8, 16, ... 56 to it
> for each of the memory access, it adds 8, 16, ... 56 in int mode and then
> sign extends each. So that means:
> + movq $0, (%rsp,%rax,8)
> + leal 1(%rdx), %eax
> + cltq
> + movq $0, (%rsp,%rax,8)
> + leal 2(%rdx), %eax
> + cltq
> + movq $0, (%rsp,%rax,8)
> + leal 3(%rdx), %eax
> + cltq
> + movq $0, (%rsp,%rax,8)
> + leal 4(%rdx), %eax
> + cltq
> + movq $0, (%rsp,%rax,8)
> + leal 5(%rdx), %eax
> + cltq
> + movq $0, (%rsp,%rax,8)
> + leal 6(%rdx), %eax
> + addl $7, %edx
> + cltq
> + movslq %edx, %rdx
> + movq $0, (%rsp,%rax,8)
> movq $0, (%rsp,%rdx,8)
> - movq $0, 8(%rsp,%rdx,8)
> - movq $0, 16(%rsp,%rdx,8)
> - movq $0, 24(%rsp,%rdx,8)
> - movq $0, 32(%rsp,%rdx,8)
> - movq $0, 40(%rsp,%rdx,8)
> - movq $0, 48(%rsp,%rdx,8)
> - movq $0, 56(%rsp,%rdx,8)
> GCC 9 -> 10 change or:
> - movq $0, (%rsp,%rdx,8)
> - movq $0, 8(%rsp,%rdx,8)
> - movq $0, 16(%rsp,%rdx,8)
> - movq $0, 24(%rsp,%rdx,8)
> - movq $0, 32(%rsp,%rdx,8)
> - movq $0, 40(%rsp,%rdx,8)
> - movq $0, 48(%rsp,%rdx,8)
> - movq $0, 56(%rsp,%rdx,8)
> + movq $0, (%rsp,%rax,8)
> + leal 1(%rdx), %eax
> + movq $0, (%rsp,%rax,8)
> + leal 2(%rdx), %eax
> + movq $0, (%rsp,%rax,8)
> + leal 3(%rdx), %eax
> + movq $0, (%rsp,%rax,8)
> + leal 4(%rdx), %eax
> + movq $0, (%rsp,%rax,8)
> + leal 5(%rdx), %eax
> + movq $0, (%rsp,%rax,8)
> + leal 6(%rdx), %eax
> + movq $0, (%rsp,%rax,8)
> + leal 7(%rdx), %eax
> + movq $0, (%rsp,%rax,8)
> change on the other test. While for the former case of
> int there is due to signed integer overflow (unless -fwrapv)
> the possibility to undo it e.g. during expansion, for the unsigned
> case information is unfortunately lost.
>
> The following patch adds single_use case which restores these testcases
> but keeps the testcases the patch meant to improve as is.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2021-02-24 Jakub Jelinek <ja...@redhat.com>
>
> PR target/95798
> * match.pd ((T)(A) + CST -> (T)(A + CST)): Add single_use check.
>
> * gcc.target/i386/pr95798-1.c: New test.
> * gcc.target/i386/pr95798-2.c: New test.
OK
jeff