[Bug rtl-optimization/98425] Superfluous sign-extend for constrained integer

2020-12-23 Thread koenigni at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98425

--- Comment #5 from Nicolas Koenig  ---
The advantage of using mov over movs for known-positive integers would be that
32bit moves are also move-eliminated, while movs always has to be executed.

[Bug rtl-optimization/98425] Superfluous sign-extend for constrained integer

2020-12-23 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98425

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek  ---
Sorry, in this case it isn't wrong (that is the passing of char/short case),
the __builtin_unreachable () says that negative values are undefined, therefore
the compiler can use both sign and zero extension interchangeably.
And the undefined signed overflow means when we have:
int i;
...
((unsigned long long) (i + 4)) * 4
we can compute it as
((unsigned long long) (i + 4)) * 4
or
((unsigned long long) i) * 4 + 16
because if i is in [INT_MAX - 3, INT_MAX] it is UB.

[Bug rtl-optimization/98425] Superfluous sign-extend for constrained integer

2020-12-23 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98425

--- Comment #3 from Jakub Jelinek  ---
Yes, it has been reported to LLVM years ago that they violate the psABI, but
they refused to fix that.

[Bug rtl-optimization/98425] Superfluous sign-extend for constrained integer

2020-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98425

--- Comment #2 from Andrew Pinski  ---
Note your optimum code is wrong.
movl %esi, %eax
Is a zero extend.

[Bug rtl-optimization/98425] Superfluous sign-extend for constrained integer

2020-12-23 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98425

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||ABI

--- Comment #1 from Andrew Pinski  ---
Actually this is an abi issue. The upper 32bits of the register is undefined by
the x86_64 ABI iirc. If this is true then clang has a bug.