//+build !noasm !appengine

// ARROW-15440
// (C2GOASM doesn't work correctly for Arm64)
// Partly GENERATED BY asm2plan9s.

// func _bytes_to_bools_neon(in unsafe.Pointer, len int, out unsafe.Pointer, outlen int)
TEXT ·_bytes_to_bools_neon(SB), $0-32

    MOVD in+0(FP), R0
    MOVD len+8(FP), R1
    MOVD out+16(FP), R2
    MOVD outlen+24(FP), R3

    // The Go ABI saves the frame pointer register one word below the 
    // caller's frame. Make room so we don't overwrite it. Needs to stay 
    // 16-byte aligned 
    SUB $16, RSP
    WORD $0xa9bf7bfd // stp    x29, x30, [sp, #-16]!
    WORD $0x7100043f // cmp    w1, #1
    WORD $0x910003fd // mov    x29, sp
    BLT LBB0_12
    WORD $0x2a0103e9 // mov    w9, w1
    WORD $0xaa1f03e8 // mov    x8, xzr
    WORD $0xd37df129 // lsl    x9, x9, #3
    WORD $0x528000aa // mov    w10, #5
    JMP LBB0_3
LBB0_2:
    WORD $0x91002108 // add    x8, x8, #8
    WORD $0xeb08013f // cmp    x9, x8
    WORD $0x91000400 // add    x0, x0, #1
    BEQ LBB0_12
LBB0_3:
    WORD $0x6b03011f // cmp    w8, w3
    BGE LBB0_2
    WORD $0x3940000c // ldrb    w12, [x0]
    WORD $0x92407d0b // and    x11, x8, #0xffffffff
    WORD $0xb240016d // orr    x13, x11, #0x1
    WORD $0x6b0301bf // cmp    w13, w3
    WORD $0x1200018c // and    w12, w12, #0x1
    WORD $0x382b684c // strb    w12, [x2, x11]
    BGE LBB0_2
    WORD $0x3940000e // ldrb    w14, [x0]
    WORD $0xb27f016c // orr    x12, x11, #0x2
    WORD $0x6b03019f // cmp    w12, w3
    WORD $0x530105ce // ubfx    w14, w14, #1, #1
    WORD $0x382d684e // strb    w14, [x2, x13]
    BGE LBB0_2
    WORD $0x3940000e // ldrb    w14, [x0]
    WORD $0xb240056d // orr    x13, x11, #0x3
    WORD $0x6b0301bf // cmp    w13, w3
    WORD $0x530209ce // ubfx    w14, w14, #2, #1
    WORD $0x382c684e // strb    w14, [x2, x12]
    BGE LBB0_2
    WORD $0x3940000e // ldrb    w14, [x0]
    WORD $0xb27e016c // orr    x12, x11, #0x4
    WORD $0x6b03019f // cmp    w12, w3
    WORD $0x53030dce // ubfx    w14, w14, #3, #1
    WORD $0x382d684e // strb    w14, [x2, x13]
    BGE LBB0_2
    WORD $0x3940000e // ldrb    w14, [x0]
    WORD $0xaa0a016d // orr    x13, x11, x10
    WORD $0x6b0301bf // cmp    w13, w3
    WORD $0x530411ce // ubfx    w14, w14, #4, #1
    WORD $0x382c684e // strb    w14, [x2, x12]
    BGE LBB0_2
    WORD $0x3940000e // ldrb    w14, [x0]
    WORD $0xb27f056c // orr    x12, x11, #0x6
    WORD $0x6b03019f // cmp    w12, w3
    WORD $0x530515ce // ubfx    w14, w14, #5, #1
    WORD $0x382d684e // strb    w14, [x2, x13]
    BGE LBB0_2
    WORD $0x3940000d // ldrb    w13, [x0]
    WORD $0xb240096b // orr    x11, x11, #0x7
    WORD $0x6b03017f // cmp    w11, w3
    WORD $0x530619ad // ubfx    w13, w13, #6, #1
    WORD $0x382c684d // strb    w13, [x2, x12]
    BGE LBB0_2
    WORD $0x3940000c // ldrb    w12, [x0]
    WORD $0x53077d8c // lsr    w12, w12, #7
    WORD $0x382b684c // strb    w12, [x2, x11]
    JMP LBB0_2
LBB0_12:
    WORD $0xa8c17bfd // ldp    x29, x30, [sp], #16
    // Put the stack pointer back where it was 
    ADD $16, RSP
    RET
