8000 [Aarch64] `lsr v, v, #56`+`ldr d0, [x9, x8, lsl #3]` optimized to `lsr v, v, #53`+`and v, v, #0x7f8`+`ldr d0, [x9, x8]` · Issue #107526 · llvm/llvm-project · GitHub
[go: up one dir, main page]

Skip to content
[Aarch64] lsr v, v, #56+ldr d0, [x9, x8, lsl #3] optimized to lsr v, v, #53+and v, v, #0x7f8+ldr d0, [x9, x8] #107526
Closed
@Validark

Description

@Validark

Godbolt link

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

Compiled for the Apple M3:

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

I think it should be:

foo:
        lsr     x8, x0, #56
        ldr     x8, [x2, x8, lsl #3]
        str     x8, [x1]
        ret

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0