Skip to content
  • Chris Lattner's avatar
    Compile · 797dee77
    Chris Lattner authored
    struct S { unsigned int i : 6, j : 11, k : 15; } b;
    void plus2 (unsigned int x) {
      b.j += x;
    }
    
    to:
    
    plus2:
            mov %EAX, DWORD PTR [b]
            mov %ECX, %EAX
            and %ECX, 131008
            mov %EDX, DWORD PTR [%ESP + 4]
            shl %EDX, 6
            add %EDX, %ECX
            and %EDX, 131008
            and %EAX, -131009
            or %EDX, %EAX
            mov DWORD PTR [b], %EDX
            ret
    
    instead of:
    
    plus2:
            mov %EAX, DWORD PTR [b]
            mov %ECX, %EAX
            shr %ECX, 6
            and %ECX, 2047
            add %ECX, DWORD PTR [%ESP + 4]
            shl %ECX, 6
            and %ECX, 131008
            and %EAX, -131009
            or %ECX, %EAX
            mov DWORD PTR [b], %ECX
            ret
    
    llvm-svn: 23385
    797dee77
Loading