Skip to content

and 0xff on load of 1 byte #50659

Closed
Closed
@danlark1

Description

@danlark1
Bugzilla Link 51317
Version trunk
OS Linux
CC @avieira-arm,@Arnaud-de-Grandmaison-ARM,@smithp35

Extended Description

Minimal example https://gcc.godbolt.org/z/z8GrK6v95

DecompressBranchless
        ldrb    w8, [x0], #1
.LBB0_1:                                // =>This Inner Loop Header: Depth=1
        and     x9, x8, #0xff           // Redundant!!!!!!!!!
        ldrh    w11, [x5, x9, lsl #1]
        ubfx    x10, x8, #2, #6
        ands    x8, x8, #0x3
        csinc   x8, x8, x10, ne
        add     x10, x2, x11
        add     x9, x0, x8
        add     x11, x3, x10
        ldrb    w8, [x9], #1
        csel    x11, x0, x11, eq
        ldrb    w11, [x11]
        cmp     x9, x1
        strb    w11, [x3, x2]
        b.hs    .LBB0_3
        cmp     x10, x4
        mov     x0, x9
        mov     x2, x10
        b.lt    .LBB0_1
.LBB0_3:
        ret

After adding asm("" ::"r"(tag));, and is removed

DecompressBranchlessBetter
        ldrb    w8, [x0], #1
.LBB1_1:                                // =>This Inner Loop Header: Depth=1
        ldrh    w10, [x5, x8, lsl #1]
        lsr     x9, x8, #2
        ands    x8, x8, #0x3
        csinc   x8, x8, x9, ne
        add     x10, x2, x10
        add     x9, x0, x8
        add     x11, x3, x10
        ldrb    w8, [x9], #1
        csel    x11, x0, x11, eq
        ldrb    w11, [x11]
        cmp     x9, x1
        strb    w11, [x3, x2]
        b.hs    .LBB1_3
        cmp     x10, x4
        mov     x0, x9
        mov     x2, x10
        b.lt    .LBB1_1
.LBB1_3:
        ret

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions