www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11417] New: rotate with immediate not recognized by optimizer

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11417

           Summary: rotate with immediate not recognized by optimizer
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: code dawg.eu


--- Comment #0 from Martin Nowak <code dawg.eu> 2013-11-01 19:16:22 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 01 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11417


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com
           Severity|normal                      |enhancement


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 01 2013