Skip to content

[AArch64] Combine and and lsl into ubfiz #118132

@Kmeakin

Description

@Kmeakin

https://godbolt.org/z/jxbMMs3dP

uint64_t u8(uint8_t x) { return x << 1; }
uint64_t u16(uint16_t x) { return x << 1; }

clang output:

u8:
        and     x8, x0, #0xff
        lsl     x0, x8, #1
        ret

u16:
        and     x8, x0, #0xffff
        lsl     x0, x8, #1
        ret

GCC output:

u8:
        ubfiz   x0, x0, 1, 8
        ret
u16:
        ubfiz   x0, x0, 1, 16
        ret

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions