https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127285
--- Comment #2 from Sai Charan Marrivada Gopala Krishna <saicharan at astrome
dot co> ---
```
"test(char*, char*)":
movzx edx, WORD PTR [rdi]
xor eax, eax
cmp WORD PTR [rsi], dx
je .L5
ret
.L5:
movzx eax, BYTE PTR [rsi+2]
cmp BYTE PTR [rdi+2], al
sete al
ret
```
is even better. GCC16.2 generates the above assembly for the following code.
```
bool test(char *a, char *b) {
if (__builtin_memcmp(a, b, 2) == 0) {
return a[2] == b[2];
}
return false;
}
```
Compiler explorer link: https://godbolt.org/z/jfxdEKnE8