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

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #4 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Yes this is one case where LLVM is violating the psABI (there are a few open
bugs on their side for this issue).
Changing the testcase to (a C++ testcase as I am too lazy to use a pointer):
```
#include <stdint.h>

uint8_t src(uint8_t &v2_u8) {
  if (!((32 <= v2_u8) && (v2_u8 <= 33))) __builtin_unreachable();
  uint8_t i0_u8 = v2_u8 / 3;
  return i0_u8;
}
```

GCC and LLVM have the similar code generation:
GCC:
```
        movzx   eax, BYTE PTR [rdi]
        imul    ax, ax, 171
        shr     ax, 9
        ret
```
LLVM:
```
        movzx   eax, byte ptr [rdi]
        imul    eax, eax, 171
        shr     eax, 9
        ret
```

GCC tends to use ax as it is smaller. And also I don't trust mca here either.

Reply via email to