http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57156

--- Comment #8 from Matthias Kretz <kretz at kde dot org> ---
I just noticed the following in the Intel Optimization Reference Manual
(Version 028 from July 2013), section 2.2 "Sandy Bridge":
2.2.3.1 Renamer
[...]
There is another dependency breaking idiom - the "ones idiom".
• CMPEQ XMM1, XMM1; "ones idiom" set all elements to all "ones"
In this case, the micro-op must execute, however, since it is known that
regardless of the input data the output data is always "all ones" the micro-op
dependency upon its sources does not exist as with the zero idiom and it can
execute as soon as it finds a free execution port.

Therefore I think it makes sense if this feature is exposed somehow. Right now,
according to what you said, it is impossible to make use of this feature when
programming with intrinsics.
I see two solutions right now:
1. Let the cmpeq intrinsic reflect this special behavior: i.e. if the two
inputs are the same variable, this behaves like a function without input.
2. Provide a new intrinsic/builtin analogous to _mm_setzero_* /
_mm256_setzero_*

Reply via email to