[Bug middle-end/78809] Inline strcmp with small constant strings
qing.zhao at oracle dot com
gcc-bugzilla@gcc.gnu.org
Fri Oct 13 21:56:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78809
Qing Zhao <qing.zhao at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |qing.zhao at oracle dot com
--- Comment #3 from Qing Zhao <qing.zhao at oracle dot com> ---
with the latest upstream GCC, we got the following assembly for the testing
case with -O2 on aarch64:
t1:
adrp x1, .LC0
add x1, x1, :lo12:.LC0
b strcmp
t2:
adrp x1, .LC0
add x1, x1, :lo12:.LC0
b strcmp
As I checked on X86, the same testing case has the following assembly with -O2:
t1:
movq %rdi, %rsi
movl $2, %ecx
movl $.LC0, %edi
repz; cmpsb
seta %al
setb %dl
subl %edx, %eax
movsbl %al, %eax
ret
t2:
movq %rdi, %rsi
movl $2, %ecx
movl $.LC0, %edi
repz; cmpsb
seta %al
setb %dl
subl %edx, %eax
movsbl %al, %eax
ret
on X86, both routines have the exact assembly and both are inlined by GCC.
More information about the Gcc-bugs
mailing list