Shift/And lowering is producing invalid code. I'm not sure but I think that this is the issue: LBB1_2: ;cond_next67 lbz r2, 0(r29) li r3, 1 cmplwi cr0, r2, 32 slw r3, r3, r2 bgt cr0, LBB1_4 ;bb101.preheader This allows a shift of 32. On PPC, this will produce the same value as shifting by 31. On X86, this produces the same value as shifting by 0. This is the switch in question: switch i8 %tmp69, label %cond_next67.bb101_crit_edge [ i8 32, label %cond_next67.bb37_crit_edge i8 9, label %cond_next67.bb37_crit_edge2 i8 10, label %cond_next67.bb37_crit_edge3 i8 13, label %cond_next67.bb37_crit_edge4 i8 12, label %cond_next67.bb37_crit_edge5 ] That said, it is an impressive code size win :) -Chris
Created attachment 773 [details] Test .ll file
Created attachment 774 [details] .s file with shift/and enabled
Created attachment 775 [details] .s file with shift/and disabled
This also broke ppc bootstrap.
Mine. However, I thought this case was fixed before my commit :) Ok. Will investigate.
Fixed with: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070409/047507.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070409/047506.html Sorry for the breakage. I wasn't be able to test things on PowerPC and I cannot understand PowerPC assembler yet :) Chris, could you please verify? I also fixed some "latent" bug, which can be only triggered on 64-bit platforms. Jeff, could you please check, whether this fixes some bugs for you or not.
It seems to work on freebsd/amd64.
Verified that 253.perlbmk passes on ppc now. ppc bootstrap still broken, I'll file a new bug if it's shift/ and.