https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78117
Chris Metcalf <cmetcalf at mellanox dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |cmetcalf at mellanox dot com --- Comment #6 from Chris Metcalf <cmetcalf at mellanox dot com> --- This is believed to be due to a bug in the architecture-independent code that optimizes vector (SIMD) ops. A smaller test case: unsigned long test(unsigned long a, unsigned long b) { unsigned long result = __insn_v1cmpeq(a, 0); result >>= 8; return result; } This will correctly emit the v1cmpeq and a right shift at -O0, but at higher levels the v1cmpeq is optimized away and replaced with a zero, thus also causing the right shift to be optimized away, and the function just returns zero. Without the right shift, the v1cmpeq is preserved at all optimization levels.