http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51274
Bug #: 51274 Summary: Starting with GCC 4.5, powerpc generated different code for x != 0. Classification: Unclassified Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: meiss...@gcc.gnu.org Host: powerpc64-linux power-linux Target: powerpc64-linux Build: powerpc64-linux In doing some investigation for optimizations of comparisons for power7, I noticed that starting with GCC 4.5, the compiler no longer generates the code it used to for setting x = (y != 0). In the rs6000.md file, these optimizations start with the insn "ne0si". In the 4.4 time frame, for -m32 (and for -m32 -mpowerpc64, which is PR 36557), gcc would generate: addic 9,3,-1 subfe 0,9,3 However, it wouldn't generate this code for -m64. Starting with 4.5, it generates the code for !(x == 0), or: cntlzw 3,3 srwi 3,3,5 xori 3,3,1 We should either remove the insns in rs6000.md that no longer are matching, or fix them so they do match. I suspect that the longer code sequence is actually faster on the newer processors, since you don't need to track the carry between the two insns.