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

--- Comment #1 from Mason <slash.tmp at free dot fr> ---
It might be worth pointing out that, when compiled as C++,
foo3 is "correctly" translated, while foo2 remains suboptimal.

foo2(s1*, unsigned int):
        movb    $0, (%rdi)
        movl    %esi, %eax
        movzbl  (%rdi), %esi
        sall    $8, %eax
        orl     %eax, %esi
        movl    %esi, (%rdi)
        ret

foo3(s1*, unsigned int):
        sall    $8, %esi
        movl    %esi, (%rdi)
        ret

I'm guessing foo2 and foo3 are NOT syntactically equivalent in C++ ?

Reply via email to