Issue 171752
Summary [aarch64] Unnecessary masking of lower bits after ubfiz
Labels new issue
Assignees
Reporter purplesyringa
    [Godbolt](https://godbolt.org/z/oo6ocGK55)

```cpp
#include <stdint.h>

uint8_t f(uint8_t x, uint64_t n) {
    return (uint16_t)((x << 1) | (x << 8)) >> n;
}
```

```asm
f(unsigned char, unsigned long):
 ubfiz   w8, w0, #1, #8
        orr     w8, w8, w0, lsl #8
        and w8, w8, #0xfffe ; why is this `and` here?
        lsr     w0, w8, w1
 ret
```

Happens during isel, not sure why.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to