Issue 107526
Summary `lsr v, v, #56`+`ldr d0, [x9, x8, lsl #3]` optimized to `lsr v, v, #53`+`and v, v, #0x7f8`+`ldr d0, [x9, x8]`
Labels new issue
Assignees
Reporter Validark
    [Godbolt link](https://zig.godbolt.org/z/sbefWdEcf)

```zig
export fn foo(bitstring: u64, dest: [*]u8, src: [*][8]u8) void {
    dest[0..8].* = src[bitstring >> 56];
}
```

Compiled for the Apple M3:

```asm
foo:
        lsr     x8, x0, #53
        and x8, x8, #0x7f8
        ldr     x8, [x2, x8]
        str     x8, [x1]
        ret
```

I think it should be:

```asm
foo:
        lsr     x8, x0, #56
        ldr x8, [x2, x8, lsl #3]
        str     x8, [x1]
        ret
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to