[Bug middle-end/17151] New: x >> (y % WORDSIZE) not optimized
falk at debian dot org
gcc-bugzilla@gcc.gnu.org
Mon Aug 23 13:30:00 GMT 2004
gcc 3.5-tree-ssa-lno 20040823 (merged 20040718)
gcc doesn't optimize shift count modulo word size, but curiously it does when
adding one more bit:
unsigned long f(unsigned long x, unsigned long y) { return x >> (y % 64); }
unsigned long g(unsigned long x, unsigned long y) { return x >> (y % 128); }
f:
and $17,63,$17
srl $16,$17,$0
ret
g:
srl $16,$17,$0
ret
It seems this is not a regression, already 2.95 behaved like this.
--
Summary: x >> (y % WORDSIZE) not optimized
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: minor
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: falk at debian dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: alphaev68-unknown-linux-gnu
GCC host triplet: alphaev68-unknown-linux-gnu
GCC target triplet: alphaev68-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17151
More information about the Gcc-bugs
mailing list