https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88097

--- Comment #1 from Daniel Fruzynski <bugzi...@poradnik-webmastera.com> ---
I also tried to swap Word1 and Word2 fields in structure to see what will
happen. It turned out that gcc with -O3 -mmovbe generates code without movbe:
[asm]
test(Test*):
        movzx   eax, WORD PTR [rdi+2]
        movzx   edx, WORD PTR [rdi]
        rorw $8, ax
        rorw $8, dx
        sal     eax, 16
        movzx   edx, dx
        or      eax, edx
        ret
[/asm]

clang generates code with movbe:

[asm]
test(Test*):                          # @test(Test*)
        movbe   cx, word ptr [rdi + 2]
        shl     ecx, 16
        movbe   ax, word ptr [rdi]
        movzx   eax, ax
        or      eax, ecx
        ret
[/asm]

Reply via email to