Bug 11417 – rotate with immediate not recognized by optimizer
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-01T19:16:00Z
Last change time
2015-06-09T05:11:38Z
Keywords
pull
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2013-11-01T19:16:22Z
cat > bug.d << CODE
uint rol(uint n)(in uint x)
{
return x << n | x >> 32 - n;
}
uint ror(uint n)(in uint x)
{
return x >> n | x << 32 - n;
}
alias rol8 = rol!8;
alias ror8 = ror!8;
CODE
dmd -O -release -inline bug
obj2asm bug.o
----
shl EAX,8
shr EDI,018h
or EAX,EDI
shr EAX,8
shl EDI,018h
or EAX,EDI
----
While Issue 6829 which uses an runtime shift works the instruction with an immediate shift isn't recognized by the compiler.