Skip to content

[AArch64] Suboptimal expansion of __builtin_bswap16 #77222

Open
@Kmeakin

Description

@Kmeakin

https://godbolt.org/z/jcxb4n97o

uint16_t rev16(uint16_t x) { return __builtin_bswap16(x); }

expands to

rev16:
        rev     w8, w0
        lsr     w0, w8, #16
        ret

instead of

rev16:
        rev16   w0, w0
        ret

__builtin_bswap32 and __builtin_bswap64 don't have the same issue

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