Re: [x86 PATCH] Optimize double word negation of zero extended values.

2022-05-23 Thread Uros Bizjak via Gcc-patches
On Mon, May 23, 2022 at 9:40 PM Roger Sayle wrote: > > > It's not uncommon for GCC to convert between a (zero or one) Boolean > value and a (zero or all ones) mask value, possibly of a wider type, > using negation. > > Currently on x86_64, the following simple test case: > __int128 foo(unsigned lo

[x86 PATCH] Optimize double word negation of zero extended values.

2022-05-23 Thread Roger Sayle
It's not uncommon for GCC to convert between a (zero or one) Boolean value and a (zero or all ones) mask value, possibly of a wider type, using negation. Currently on x86_64, the following simple test case: __int128 foo(unsigned long x) { return -(__int128)x; } compiles with -O2 to: mov