| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
| ; Test the instruction sequences produced by atomicrmw instructions. In |
| ; particular, ensure there are no stores/spills inserted between the exclusive |
| ; load and stores, which would invalidate the exclusive monitor. |
| |
| ; RUN: llc -mtriple=armv8-unknown-none-eabi -O0 -o - %s | FileCheck %s --check-prefix=CHECK-ARM8 |
| ; RUN: llc -mtriple=armv6-unknown-none-eabi -O0 -o - %s | FileCheck %s --check-prefix=CHECK-ARM6 |
| ; RUN: llc -mtriple=thumbv7-unknown-none-eabi -O0 -o - %s | FileCheck %s --check-prefix=CHECK-THUMB7 |
| ; RUN: llc -mtriple=thumbv6-unknown-none-eabi -O0 -o - %s | FileCheck %s --check-prefix=CHECK-THUMB6 |
| ; RUN: llc -mtriple=thumbv8m.base-unknown-none-eabi -O0 -o - %s | FileCheck %s --check-prefix=CHECK-THUMB8BASE |
| |
| @atomic_i8 = external global i8 |
| @atomic_i16 = external global i16 |
| @atomic_i32 = external global i32 |
| @atomic_i64 = external global i64 |
| |
| define i8 @test_xchg_i8() { |
| ; CHECK-ARM8-LABEL: test_xchg_i8: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB0_1 |
| ; CHECK-ARM8-NEXT: .LBB0_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB0_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: mov r12, #1 |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB0_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB0_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB0_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB0_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB0_2 |
| ; CHECK-ARM8-NEXT: .LBB0_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB0_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB0_1 |
| ; CHECK-ARM8-NEXT: b .LBB0_5 |
| ; CHECK-ARM8-NEXT: .LBB0_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_xchg_i8: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI0_0 |
| ; CHECK-ARM6-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB0_1 |
| ; CHECK-ARM6-NEXT: .LBB0_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB0_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI0_0 |
| ; CHECK-ARM6-NEXT: mov r12, #1 |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB0_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB0_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB0_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB0_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB0_2 |
| ; CHECK-ARM6-NEXT: .LBB0_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB0_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB0_1 |
| ; CHECK-ARM6-NEXT: b .LBB0_5 |
| ; CHECK-ARM6-NEXT: .LBB0_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI0_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB7-LABEL: test_xchg_i8: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB0_1 |
| ; CHECK-THUMB7-NEXT: .LBB0_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB0_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: mov.w r12, #1 |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB0_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB0_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB0_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB0_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexb r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB0_2 |
| ; CHECK-THUMB7-NEXT: .LBB0_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB0_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB0_1 |
| ; CHECK-THUMB7-NEXT: b .LBB0_5 |
| ; CHECK-THUMB7-NEXT: .LBB0_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_xchg_i8: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI0_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_lock_test_and_set_1 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI0_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_xchg_i8: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB0_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB0_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB0_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movs r4, #1 |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB0_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB0_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB0_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB0_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexb r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB0_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB0_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB0_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB0_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB0_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB0_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw xchg ptr @atomic_i8, i8 1 monotonic |
| ret i8 %0 |
| } |
| define i8 @test_add_i8() { |
| ; CHECK-ARM8-LABEL: test_add_i8: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB1_1 |
| ; CHECK-ARM8-NEXT: .LBB1_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB1_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add r12, r1, #1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB1_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB1_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB1_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB1_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB1_2 |
| ; CHECK-ARM8-NEXT: .LBB1_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB1_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB1_1 |
| ; CHECK-ARM8-NEXT: b .LBB1_5 |
| ; CHECK-ARM8-NEXT: .LBB1_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_add_i8: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI1_0 |
| ; CHECK-ARM6-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB1_1 |
| ; CHECK-ARM6-NEXT: .LBB1_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB1_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add r12, r1, #1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI1_0 |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB1_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB1_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB1_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB1_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB1_2 |
| ; CHECK-ARM6-NEXT: .LBB1_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB1_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB1_1 |
| ; CHECK-ARM6-NEXT: b .LBB1_5 |
| ; CHECK-ARM6-NEXT: .LBB1_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI1_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB7-LABEL: test_add_i8: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB1_1 |
| ; CHECK-THUMB7-NEXT: .LBB1_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB1_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add.w r12, r1, #1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB1_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB1_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB1_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB1_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexb r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB1_2 |
| ; CHECK-THUMB7-NEXT: .LBB1_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB1_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB1_1 |
| ; CHECK-THUMB7-NEXT: b .LBB1_5 |
| ; CHECK-THUMB7-NEXT: .LBB1_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_add_i8: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI1_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_add_1 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI1_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_add_i8: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB1_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB1_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB1_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: adds r4, r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB1_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB1_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB1_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB1_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexb r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB1_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB1_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB1_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB1_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB1_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB1_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw add ptr @atomic_i8, i8 1 monotonic |
| ret i8 %0 |
| } |
| define i8 @test_sub_i8() { |
| ; CHECK-ARM8-LABEL: test_sub_i8: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB2_1 |
| ; CHECK-ARM8-NEXT: .LBB2_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB2_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: sub r12, r1, #1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB2_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB2_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB2_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB2_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB2_2 |
| ; CHECK-ARM8-NEXT: .LBB2_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB2_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB2_1 |
| ; CHECK-ARM8-NEXT: b .LBB2_5 |
| ; CHECK-ARM8-NEXT: .LBB2_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_sub_i8: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI2_0 |
| ; CHECK-ARM6-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB2_1 |
| ; CHECK-ARM6-NEXT: .LBB2_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB2_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: sub r12, r1, #1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI2_0 |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB2_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB2_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB2_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB2_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB2_2 |
| ; CHECK-ARM6-NEXT: .LBB2_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB2_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB2_1 |
| ; CHECK-ARM6-NEXT: b .LBB2_5 |
| ; CHECK-ARM6-NEXT: .LBB2_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI2_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB7-LABEL: test_sub_i8: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB2_1 |
| ; CHECK-THUMB7-NEXT: .LBB2_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB2_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: sub.w r12, r1, #1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB2_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB2_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB2_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB2_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexb r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB2_2 |
| ; CHECK-THUMB7-NEXT: .LBB2_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB2_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB2_1 |
| ; CHECK-THUMB7-NEXT: b .LBB2_5 |
| ; CHECK-THUMB7-NEXT: .LBB2_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_sub_i8: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI2_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_sub_1 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI2_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_sub_i8: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB2_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB2_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB2_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: subs r4, r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB2_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB2_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB2_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB2_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexb r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB2_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB2_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB2_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB2_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB2_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB2_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw sub ptr @atomic_i8, i8 1 monotonic |
| ret i8 %0 |
| } |
| define i8 @test_and_i8() { |
| ; CHECK-ARM8-LABEL: test_and_i8: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB3_1 |
| ; CHECK-ARM8-NEXT: .LBB3_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB3_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: and r12, r1, #1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB3_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB3_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB3_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB3_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB3_2 |
| ; CHECK-ARM8-NEXT: .LBB3_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB3_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB3_1 |
| ; CHECK-ARM8-NEXT: b .LBB3_5 |
| ; CHECK-ARM8-NEXT: .LBB3_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_and_i8: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI3_0 |
| ; CHECK-ARM6-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB3_1 |
| ; CHECK-ARM6-NEXT: .LBB3_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB3_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: and r12, r1, #1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI3_0 |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB3_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB3_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB3_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB3_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB3_2 |
| ; CHECK-ARM6-NEXT: .LBB3_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB3_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB3_1 |
| ; CHECK-ARM6-NEXT: b .LBB3_5 |
| ; CHECK-ARM6-NEXT: .LBB3_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI3_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB7-LABEL: test_and_i8: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB3_1 |
| ; CHECK-THUMB7-NEXT: .LBB3_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB3_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: and r12, r1, #1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB3_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB3_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB3_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB3_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexb r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB3_2 |
| ; CHECK-THUMB7-NEXT: .LBB3_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB3_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB3_1 |
| ; CHECK-THUMB7-NEXT: b .LBB3_5 |
| ; CHECK-THUMB7-NEXT: .LBB3_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_and_i8: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI3_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_and_1 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI3_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_and_i8: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB3_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB3_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB3_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movs r0, #1 |
| ; CHECK-THUMB8BASE-NEXT: mov r4, r1 |
| ; CHECK-THUMB8BASE-NEXT: ands r4, r0 |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB3_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB3_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB3_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB3_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexb r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB3_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB3_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB3_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB3_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB3_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB3_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw and ptr @atomic_i8, i8 1 monotonic |
| ret i8 %0 |
| } |
| define i8 @test_nand_i8() { |
| ; CHECK-ARM8-LABEL: test_nand_i8: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB4_1 |
| ; CHECK-ARM8-NEXT: .LBB4_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB4_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: mvn r0, r1 |
| ; CHECK-ARM8-NEXT: mvn r2, #1 |
| ; CHECK-ARM8-NEXT: orr r12, r0, r2 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB4_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB4_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB4_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB4_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB4_2 |
| ; CHECK-ARM8-NEXT: .LBB4_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB4_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB4_1 |
| ; CHECK-ARM8-NEXT: b .LBB4_5 |
| ; CHECK-ARM8-NEXT: .LBB4_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_nand_i8: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI4_0 |
| ; CHECK-ARM6-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB4_1 |
| ; CHECK-ARM6-NEXT: .LBB4_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB4_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: mvn r0, r1 |
| ; CHECK-ARM6-NEXT: mvn r2, #1 |
| ; CHECK-ARM6-NEXT: orr r12, r0, r2 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI4_0 |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB4_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB4_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB4_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB4_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB4_2 |
| ; CHECK-ARM6-NEXT: .LBB4_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB4_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB4_1 |
| ; CHECK-ARM6-NEXT: b .LBB4_5 |
| ; CHECK-ARM6-NEXT: .LBB4_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI4_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB7-LABEL: test_nand_i8: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB4_1 |
| ; CHECK-THUMB7-NEXT: .LBB4_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB4_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: mvn r0, #1 |
| ; CHECK-THUMB7-NEXT: orn r12, r0, r1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB4_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB4_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB4_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB4_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexb r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB4_2 |
| ; CHECK-THUMB7-NEXT: .LBB4_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB4_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB4_1 |
| ; CHECK-THUMB7-NEXT: b .LBB4_5 |
| ; CHECK-THUMB7-NEXT: .LBB4_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_nand_i8: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI4_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_nand_1 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI4_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_nand_i8: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB4_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB4_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB4_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: mvns r4, r1 |
| ; CHECK-THUMB8BASE-NEXT: movs r0, #1 |
| ; CHECK-THUMB8BASE-NEXT: mvns r0, r0 |
| ; CHECK-THUMB8BASE-NEXT: orrs r4, r0 |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB4_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB4_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB4_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB4_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexb r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB4_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB4_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB4_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB4_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB4_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB4_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw nand ptr @atomic_i8, i8 1 monotonic |
| ret i8 %0 |
| } |
| define i8 @test_or_i8() { |
| ; CHECK-ARM8-LABEL: test_or_i8: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB5_1 |
| ; CHECK-ARM8-NEXT: .LBB5_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB5_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: orr r12, r1, #1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB5_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB5_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB5_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB5_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB5_2 |
| ; CHECK-ARM8-NEXT: .LBB5_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB5_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB5_1 |
| ; CHECK-ARM8-NEXT: b .LBB5_5 |
| ; CHECK-ARM8-NEXT: .LBB5_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_or_i8: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI5_0 |
| ; CHECK-ARM6-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB5_1 |
| ; CHECK-ARM6-NEXT: .LBB5_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB5_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: orr r12, r1, #1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI5_0 |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB5_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB5_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB5_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB5_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB5_2 |
| ; CHECK-ARM6-NEXT: .LBB5_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB5_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB5_1 |
| ; CHECK-ARM6-NEXT: b .LBB5_5 |
| ; CHECK-ARM6-NEXT: .LBB5_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI5_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB7-LABEL: test_or_i8: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB5_1 |
| ; CHECK-THUMB7-NEXT: .LBB5_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB5_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: orr r12, r1, #1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB5_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB5_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB5_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB5_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexb r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB5_2 |
| ; CHECK-THUMB7-NEXT: .LBB5_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB5_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB5_1 |
| ; CHECK-THUMB7-NEXT: b .LBB5_5 |
| ; CHECK-THUMB7-NEXT: .LBB5_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_or_i8: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI5_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_or_1 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI5_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_or_i8: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB5_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB5_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB5_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movs r0, #1 |
| ; CHECK-THUMB8BASE-NEXT: mov r4, r1 |
| ; CHECK-THUMB8BASE-NEXT: orrs r4, r0 |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB5_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB5_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB5_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB5_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexb r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB5_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB5_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB5_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB5_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB5_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB5_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw or ptr @atomic_i8, i8 1 monotonic |
| ret i8 %0 |
| } |
| define i8 @test_xor_i8() { |
| ; CHECK-ARM8-LABEL: test_xor_i8: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB6_1 |
| ; CHECK-ARM8-NEXT: .LBB6_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB6_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: eor r12, r1, #1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB6_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB6_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB6_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB6_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB6_2 |
| ; CHECK-ARM8-NEXT: .LBB6_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB6_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB6_1 |
| ; CHECK-ARM8-NEXT: b .LBB6_5 |
| ; CHECK-ARM8-NEXT: .LBB6_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_xor_i8: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI6_0 |
| ; CHECK-ARM6-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB6_1 |
| ; CHECK-ARM6-NEXT: .LBB6_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB6_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: eor r12, r1, #1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI6_0 |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB6_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB6_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB6_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB6_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB6_2 |
| ; CHECK-ARM6-NEXT: .LBB6_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB6_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB6_1 |
| ; CHECK-ARM6-NEXT: b .LBB6_5 |
| ; CHECK-ARM6-NEXT: .LBB6_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI6_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB7-LABEL: test_xor_i8: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB6_1 |
| ; CHECK-THUMB7-NEXT: .LBB6_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB6_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: eor r12, r1, #1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB6_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB6_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB6_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB6_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexb r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB6_2 |
| ; CHECK-THUMB7-NEXT: .LBB6_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB6_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB6_1 |
| ; CHECK-THUMB7-NEXT: b .LBB6_5 |
| ; CHECK-THUMB7-NEXT: .LBB6_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_xor_i8: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI6_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_xor_1 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI6_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_xor_i8: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB6_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB6_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB6_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movs r0, #1 |
| ; CHECK-THUMB8BASE-NEXT: mov r4, r1 |
| ; CHECK-THUMB8BASE-NEXT: eors r4, r0 |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB6_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB6_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB6_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB6_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexb r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB6_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB6_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB6_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB6_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB6_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB6_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw xor ptr @atomic_i8, i8 1 monotonic |
| ret i8 %0 |
| } |
| define i8 @test_max_i8() { |
| ; CHECK-ARM8-LABEL: test_max_i8: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB7_1 |
| ; CHECK-ARM8-NEXT: .LBB7_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB7_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: sxtb r0, r1 |
| ; CHECK-ARM8-NEXT: mov r12, #1 |
| ; CHECK-ARM8-NEXT: cmp r0, #1 |
| ; CHECK-ARM8-NEXT: movgt r12, r1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB7_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB7_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB7_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB7_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB7_2 |
| ; CHECK-ARM8-NEXT: .LBB7_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB7_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB7_1 |
| ; CHECK-ARM8-NEXT: b .LBB7_5 |
| ; CHECK-ARM8-NEXT: .LBB7_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_max_i8: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI7_0 |
| ; CHECK-ARM6-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB7_1 |
| ; CHECK-ARM6-NEXT: .LBB7_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB7_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: sxtb r0, r1 |
| ; CHECK-ARM6-NEXT: mov r12, #1 |
| ; CHECK-ARM6-NEXT: cmp r0, #1 |
| ; CHECK-ARM6-NEXT: movgt r12, r1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI7_0 |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB7_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB7_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB7_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB7_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB7_2 |
| ; CHECK-ARM6-NEXT: .LBB7_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB7_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB7_1 |
| ; CHECK-ARM6-NEXT: b .LBB7_5 |
| ; CHECK-ARM6-NEXT: .LBB7_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI7_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB7-LABEL: test_max_i8: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB7_1 |
| ; CHECK-THUMB7-NEXT: .LBB7_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB7_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: sxtb r0, r1 |
| ; CHECK-THUMB7-NEXT: mov.w r12, #1 |
| ; CHECK-THUMB7-NEXT: cmp r0, #1 |
| ; CHECK-THUMB7-NEXT: it gt |
| ; CHECK-THUMB7-NEXT: movgt r12, r1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB7_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB7_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB7_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB7_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexb r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB7_2 |
| ; CHECK-THUMB7-NEXT: .LBB7_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB7_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB7_1 |
| ; CHECK-THUMB7-NEXT: b .LBB7_5 |
| ; CHECK-THUMB7-NEXT: .LBB7_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_max_i8: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI7_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_max_1 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI7_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_max_i8: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #20 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #20 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #16] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB7_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB7_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB7_4 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp, #16] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: sxtb r1, r0 |
| ; CHECK-THUMB8BASE-NEXT: movs r2, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r2, [sp, #8] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #12] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bgt .LBB7_3 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB7_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp, #8] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #12] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: .LBB7_3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB7_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: ldr r4, [sp, #12] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB7_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB7_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB7_6 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.5: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB7_4 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexb r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB7_4 |
| ; CHECK-THUMB8BASE-NEXT: .LBB7_6: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB7_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #16] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB7_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB7_7 |
| ; CHECK-THUMB8BASE-NEXT: .LBB7_7: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #20 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw max ptr @atomic_i8, i8 1 monotonic |
| ret i8 %0 |
| } |
| define i8 @test_min_i8() { |
| ; CHECK-ARM8-LABEL: test_min_i8: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB8_1 |
| ; CHECK-ARM8-NEXT: .LBB8_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB8_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: sxtb r0, r1 |
| ; CHECK-ARM8-NEXT: mov r12, #1 |
| ; CHECK-ARM8-NEXT: cmp r0, #2 |
| ; CHECK-ARM8-NEXT: movlt r12, r1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB8_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB8_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB8_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB8_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB8_2 |
| ; CHECK-ARM8-NEXT: .LBB8_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB8_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxtb r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB8_1 |
| ; CHECK-ARM8-NEXT: b .LBB8_5 |
| ; CHECK-ARM8-NEXT: .LBB8_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_min_i8: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI8_0 |
| ; CHECK-ARM6-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB8_1 |
| ; CHECK-ARM6-NEXT: .LBB8_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB8_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: sxtb r0, r1 |
| ; CHECK-ARM6-NEXT: mov r12, #1 |
| ; CHECK-ARM6-NEXT: cmp r0, #2 |
| ; CHECK-ARM6-NEXT: movlt r12, r1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI8_0 |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB8_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB8_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB8_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB8_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexb r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB8_2 |
| ; CHECK-ARM6-NEXT: .LBB8_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB8_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxtb r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB8_1 |
| ; CHECK-ARM6-NEXT: b .LBB8_5 |
| ; CHECK-ARM6-NEXT: .LBB8_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI8_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB7-LABEL: test_min_i8: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB8_1 |
| ; CHECK-THUMB7-NEXT: .LBB8_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB8_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: sxtb r0, r1 |
| ; CHECK-THUMB7-NEXT: mov.w r12, #1 |
| ; CHECK-THUMB7-NEXT: cmp r0, #2 |
| ; CHECK-THUMB7-NEXT: it lt |
| ; CHECK-THUMB7-NEXT: movlt r12, r1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB8_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB8_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB8_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB8_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexb r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB8_2 |
| ; CHECK-THUMB7-NEXT: .LBB8_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB8_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB8_1 |
| ; CHECK-THUMB7-NEXT: b .LBB8_5 |
| ; CHECK-THUMB7-NEXT: .LBB8_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_min_i8: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI8_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_min_1 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI8_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_min_i8: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #20 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #20 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #16] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB8_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB8_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB8_4 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp, #16] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: sxtb r1, r0 |
| ; CHECK-THUMB8BASE-NEXT: movs r2, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r2, [sp, #8] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #2 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #12] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: blt .LBB8_3 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB8_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp, #8] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #12] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: .LBB8_3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB8_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: ldr r4, [sp, #12] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB8_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB8_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB8_6 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.5: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB8_4 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexb r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB8_4 |
| ; CHECK-THUMB8BASE-NEXT: .LBB8_6: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB8_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #16] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB8_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB8_7 |
| ; CHECK-THUMB8BASE-NEXT: .LBB8_7: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #20 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw min ptr @atomic_i8, i8 1 monotonic |
| ret i8 %0 |
| } |
| define i8 @test_umax_i8() { |
| ; CHECK-ARM8-LABEL: test_umax_i8: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .save {r11, lr} |
| ; CHECK-ARM8-NEXT: push {r11, lr} |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB9_1 |
| ; CHECK-ARM8-NEXT: .LBB9_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB9_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r12, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: uxtb r1, r12 |
| ; CHECK-ARM8-NEXT: mov lr, #1 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: movhi lr, r12 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: uxtb r12, r12 |
| ; CHECK-ARM8-NEXT: .LBB9_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB9_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r12 |
| ; CHECK-ARM8-NEXT: bne .LBB9_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB9_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexb r2, lr, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB9_2 |
| ; CHECK-ARM8-NEXT: .LBB9_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB9_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB9_1 |
| ; CHECK-ARM8-NEXT: b .LBB9_5 |
| ; CHECK-ARM8-NEXT: .LBB9_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: pop {r11, pc} |
| ; |
| ; CHECK-ARM6-LABEL: test_umax_i8: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .save {r11, lr} |
| ; CHECK-ARM6-NEXT: push {r11, lr} |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI9_0 |
| ; CHECK-ARM6-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB9_1 |
| ; CHECK-ARM6-NEXT: .LBB9_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB9_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r12, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: uxtb r1, r12 |
| ; CHECK-ARM6-NEXT: mov lr, #1 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: movhi lr, r12 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI9_0 |
| ; CHECK-ARM6-NEXT: uxtb r12, r12 |
| ; CHECK-ARM6-NEXT: .LBB9_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB9_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r12 |
| ; CHECK-ARM6-NEXT: bne .LBB9_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB9_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexb r2, lr, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB9_2 |
| ; CHECK-ARM6-NEXT: .LBB9_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB9_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB9_1 |
| ; CHECK-ARM6-NEXT: b .LBB9_5 |
| ; CHECK-ARM6-NEXT: .LBB9_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: pop {r11, pc} |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI9_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB7-LABEL: test_umax_i8: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .save {r4, lr} |
| ; CHECK-THUMB7-NEXT: push {r4, lr} |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB9_1 |
| ; CHECK-THUMB7-NEXT: .LBB9_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB9_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r4, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: uxtb r1, r4 |
| ; CHECK-THUMB7-NEXT: mov.w r12, #1 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: it hi |
| ; CHECK-THUMB7-NEXT: movhi r12, r4 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: uxtb r4, r4 |
| ; CHECK-THUMB7-NEXT: .LBB9_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB9_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r4 |
| ; CHECK-THUMB7-NEXT: bne .LBB9_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB9_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexb r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB9_2 |
| ; CHECK-THUMB7-NEXT: .LBB9_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB9_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB9_1 |
| ; CHECK-THUMB7-NEXT: b .LBB9_5 |
| ; CHECK-THUMB7-NEXT: .LBB9_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: pop {r4, pc} |
| ; |
| ; CHECK-THUMB6-LABEL: test_umax_i8: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI9_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_umax_1 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI9_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_umax_i8: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, r5, r7, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, r5, r7, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #24 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #24 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #20] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB9_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB9_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB9_4 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp, #20] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r0 |
| ; CHECK-THUMB8BASE-NEXT: str r1, [sp, #8] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: movs r2, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r2, [sp, #12] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #16] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bhi .LBB9_3 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB9_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp, #12] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #16] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: .LBB9_3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB9_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #8] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: ldr r4, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: ldr r5, [sp, #16] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: uxtb r4, r4 |
| ; CHECK-THUMB8BASE-NEXT: .LBB9_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB9_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r4 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB9_6 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.5: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB9_4 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexb r2, r5, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB9_4 |
| ; CHECK-THUMB8BASE-NEXT: .LBB9_6: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB9_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #20] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB9_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB9_7 |
| ; CHECK-THUMB8BASE-NEXT: .LBB9_7: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #24 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, r5, r7, pc} |
| entry: |
| %0 = atomicrmw umax ptr @atomic_i8, i8 1 monotonic |
| ret i8 %0 |
| } |
| define i8 @test_umin_i8() { |
| ; CHECK-ARM8-LABEL: test_umin_i8: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .save {r11, lr} |
| ; CHECK-ARM8-NEXT: push {r11, lr} |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB10_1 |
| ; CHECK-ARM8-NEXT: .LBB10_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB10_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r12, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: uxtb r1, r12 |
| ; CHECK-ARM8-NEXT: mov lr, #1 |
| ; CHECK-ARM8-NEXT: cmp r1, #2 |
| ; CHECK-ARM8-NEXT: movlo lr, r12 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-ARM8-NEXT: uxtb r12, r12 |
| ; CHECK-ARM8-NEXT: .LBB10_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB10_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r12 |
| ; CHECK-ARM8-NEXT: bne .LBB10_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB10_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexb r2, lr, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB10_2 |
| ; CHECK-ARM8-NEXT: .LBB10_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB10_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB10_1 |
| ; CHECK-ARM8-NEXT: b .LBB10_5 |
| ; CHECK-ARM8-NEXT: .LBB10_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: pop {r11, pc} |
| ; |
| ; CHECK-ARM6-LABEL: test_umin_i8: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .save {r11, lr} |
| ; CHECK-ARM6-NEXT: push {r11, lr} |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI10_0 |
| ; CHECK-ARM6-NEXT: ldrb r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB10_1 |
| ; CHECK-ARM6-NEXT: .LBB10_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB10_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r12, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: uxtb r1, r12 |
| ; CHECK-ARM6-NEXT: mov lr, #1 |
| ; CHECK-ARM6-NEXT: cmp r1, #2 |
| ; CHECK-ARM6-NEXT: movlo lr, r12 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI10_0 |
| ; CHECK-ARM6-NEXT: uxtb r12, r12 |
| ; CHECK-ARM6-NEXT: .LBB10_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB10_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexb r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r12 |
| ; CHECK-ARM6-NEXT: bne .LBB10_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB10_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexb r2, lr, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB10_2 |
| ; CHECK-ARM6-NEXT: .LBB10_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB10_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB10_1 |
| ; CHECK-ARM6-NEXT: b .LBB10_5 |
| ; CHECK-ARM6-NEXT: .LBB10_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: pop {r11, pc} |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI10_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB7-LABEL: test_umin_i8: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .save {r4, lr} |
| ; CHECK-THUMB7-NEXT: push {r4, lr} |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB10_1 |
| ; CHECK-THUMB7-NEXT: .LBB10_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB10_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r4, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: uxtb r1, r4 |
| ; CHECK-THUMB7-NEXT: mov.w r12, #1 |
| ; CHECK-THUMB7-NEXT: cmp r1, #2 |
| ; CHECK-THUMB7-NEXT: it lo |
| ; CHECK-THUMB7-NEXT: movlo r12, r4 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB7-NEXT: uxtb r4, r4 |
| ; CHECK-THUMB7-NEXT: .LBB10_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB10_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r4 |
| ; CHECK-THUMB7-NEXT: bne .LBB10_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB10_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexb r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB10_2 |
| ; CHECK-THUMB7-NEXT: .LBB10_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB10_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB10_1 |
| ; CHECK-THUMB7-NEXT: b .LBB10_5 |
| ; CHECK-THUMB7-NEXT: .LBB10_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: pop {r4, pc} |
| ; |
| ; CHECK-THUMB6-LABEL: test_umin_i8: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI10_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_umin_1 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI10_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i8 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_umin_i8: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, r5, r7, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, r5, r7, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #24 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #24 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: ldrb r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #20] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB10_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB10_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB10_4 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp, #20] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxtb r1, r0 |
| ; CHECK-THUMB8BASE-NEXT: str r1, [sp, #8] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: movs r2, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r2, [sp, #12] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #2 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #16] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: blo .LBB10_3 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB10_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp, #12] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #16] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: .LBB10_3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB10_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #8] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: ldr r4, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: ldr r5, [sp, #16] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i8 |
| ; CHECK-THUMB8BASE-NEXT: uxtb r4, r4 |
| ; CHECK-THUMB8BASE-NEXT: .LBB10_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB10_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexb r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r4 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB10_6 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.5: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB10_4 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexb r2, r5, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB10_4 |
| ; CHECK-THUMB8BASE-NEXT: .LBB10_6: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB10_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #20] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB10_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB10_7 |
| ; CHECK-THUMB8BASE-NEXT: .LBB10_7: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #24 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, r5, r7, pc} |
| entry: |
| %0 = atomicrmw umin ptr @atomic_i8, i8 1 monotonic |
| ret i8 %0 |
| } |
| |
| |
| define i16 @test_xchg_i16() { |
| ; CHECK-ARM8-LABEL: test_xchg_i16: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB11_1 |
| ; CHECK-ARM8-NEXT: .LBB11_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB11_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: mov r12, #1 |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB11_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB11_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB11_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB11_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB11_2 |
| ; CHECK-ARM8-NEXT: .LBB11_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB11_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB11_1 |
| ; CHECK-ARM8-NEXT: b .LBB11_5 |
| ; CHECK-ARM8-NEXT: .LBB11_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_xchg_i16: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI11_0 |
| ; CHECK-ARM6-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB11_1 |
| ; CHECK-ARM6-NEXT: .LBB11_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB11_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI11_0 |
| ; CHECK-ARM6-NEXT: mov r12, #1 |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB11_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB11_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB11_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB11_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB11_2 |
| ; CHECK-ARM6-NEXT: .LBB11_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB11_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB11_1 |
| ; CHECK-ARM6-NEXT: b .LBB11_5 |
| ; CHECK-ARM6-NEXT: .LBB11_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI11_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB7-LABEL: test_xchg_i16: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB11_1 |
| ; CHECK-THUMB7-NEXT: .LBB11_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB11_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: mov.w r12, #1 |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB11_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB11_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB11_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB11_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexh r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB11_2 |
| ; CHECK-THUMB7-NEXT: .LBB11_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB11_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB11_1 |
| ; CHECK-THUMB7-NEXT: b .LBB11_5 |
| ; CHECK-THUMB7-NEXT: .LBB11_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_xchg_i16: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI11_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_lock_test_and_set_2 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI11_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_xchg_i16: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB11_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB11_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB11_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movs r4, #1 |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB11_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB11_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB11_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB11_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexh r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB11_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB11_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB11_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB11_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB11_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB11_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw xchg ptr @atomic_i16, i16 1 monotonic |
| ret i16 %0 |
| } |
| define i16 @test_add_i16() { |
| ; CHECK-ARM8-LABEL: test_add_i16: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB12_1 |
| ; CHECK-ARM8-NEXT: .LBB12_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB12_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add r12, r1, #1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB12_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB12_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB12_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB12_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB12_2 |
| ; CHECK-ARM8-NEXT: .LBB12_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB12_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB12_1 |
| ; CHECK-ARM8-NEXT: b .LBB12_5 |
| ; CHECK-ARM8-NEXT: .LBB12_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_add_i16: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI12_0 |
| ; CHECK-ARM6-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB12_1 |
| ; CHECK-ARM6-NEXT: .LBB12_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB12_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add r12, r1, #1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI12_0 |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB12_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB12_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB12_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB12_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB12_2 |
| ; CHECK-ARM6-NEXT: .LBB12_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB12_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB12_1 |
| ; CHECK-ARM6-NEXT: b .LBB12_5 |
| ; CHECK-ARM6-NEXT: .LBB12_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI12_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB7-LABEL: test_add_i16: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB12_1 |
| ; CHECK-THUMB7-NEXT: .LBB12_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB12_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add.w r12, r1, #1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB12_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB12_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB12_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB12_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexh r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB12_2 |
| ; CHECK-THUMB7-NEXT: .LBB12_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB12_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB12_1 |
| ; CHECK-THUMB7-NEXT: b .LBB12_5 |
| ; CHECK-THUMB7-NEXT: .LBB12_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_add_i16: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI12_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_add_2 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI12_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_add_i16: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB12_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB12_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB12_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: adds r4, r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB12_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB12_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB12_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB12_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexh r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB12_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB12_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB12_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB12_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB12_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB12_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw add ptr @atomic_i16, i16 1 monotonic |
| ret i16 %0 |
| } |
| define i16 @test_sub_i16() { |
| ; CHECK-ARM8-LABEL: test_sub_i16: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB13_1 |
| ; CHECK-ARM8-NEXT: .LBB13_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB13_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: sub r12, r1, #1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB13_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB13_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB13_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB13_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB13_2 |
| ; CHECK-ARM8-NEXT: .LBB13_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB13_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB13_1 |
| ; CHECK-ARM8-NEXT: b .LBB13_5 |
| ; CHECK-ARM8-NEXT: .LBB13_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_sub_i16: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI13_0 |
| ; CHECK-ARM6-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB13_1 |
| ; CHECK-ARM6-NEXT: .LBB13_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB13_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: sub r12, r1, #1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI13_0 |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB13_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB13_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB13_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB13_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB13_2 |
| ; CHECK-ARM6-NEXT: .LBB13_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB13_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB13_1 |
| ; CHECK-ARM6-NEXT: b .LBB13_5 |
| ; CHECK-ARM6-NEXT: .LBB13_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI13_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB7-LABEL: test_sub_i16: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB13_1 |
| ; CHECK-THUMB7-NEXT: .LBB13_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB13_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: sub.w r12, r1, #1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB13_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB13_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB13_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB13_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexh r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB13_2 |
| ; CHECK-THUMB7-NEXT: .LBB13_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB13_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB13_1 |
| ; CHECK-THUMB7-NEXT: b .LBB13_5 |
| ; CHECK-THUMB7-NEXT: .LBB13_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_sub_i16: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI13_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_sub_2 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI13_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_sub_i16: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB13_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB13_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB13_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: subs r4, r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB13_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB13_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB13_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB13_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexh r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB13_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB13_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB13_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB13_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB13_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB13_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw sub ptr @atomic_i16, i16 1 monotonic |
| ret i16 %0 |
| } |
| define i16 @test_and_i16() { |
| ; CHECK-ARM8-LABEL: test_and_i16: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB14_1 |
| ; CHECK-ARM8-NEXT: .LBB14_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB14_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: and r12, r1, #1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB14_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB14_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB14_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB14_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB14_2 |
| ; CHECK-ARM8-NEXT: .LBB14_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB14_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB14_1 |
| ; CHECK-ARM8-NEXT: b .LBB14_5 |
| ; CHECK-ARM8-NEXT: .LBB14_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_and_i16: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI14_0 |
| ; CHECK-ARM6-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB14_1 |
| ; CHECK-ARM6-NEXT: .LBB14_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB14_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: and r12, r1, #1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI14_0 |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB14_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB14_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB14_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB14_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB14_2 |
| ; CHECK-ARM6-NEXT: .LBB14_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB14_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB14_1 |
| ; CHECK-ARM6-NEXT: b .LBB14_5 |
| ; CHECK-ARM6-NEXT: .LBB14_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI14_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB7-LABEL: test_and_i16: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB14_1 |
| ; CHECK-THUMB7-NEXT: .LBB14_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB14_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: and r12, r1, #1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB14_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB14_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB14_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB14_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexh r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB14_2 |
| ; CHECK-THUMB7-NEXT: .LBB14_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB14_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB14_1 |
| ; CHECK-THUMB7-NEXT: b .LBB14_5 |
| ; CHECK-THUMB7-NEXT: .LBB14_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_and_i16: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI14_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_and_2 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI14_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_and_i16: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB14_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB14_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB14_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movs r0, #1 |
| ; CHECK-THUMB8BASE-NEXT: mov r4, r1 |
| ; CHECK-THUMB8BASE-NEXT: ands r4, r0 |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB14_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB14_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB14_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB14_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexh r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB14_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB14_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB14_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB14_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB14_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB14_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw and ptr @atomic_i16, i16 1 monotonic |
| ret i16 %0 |
| } |
| define i16 @test_nand_i16() { |
| ; CHECK-ARM8-LABEL: test_nand_i16: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB15_1 |
| ; CHECK-ARM8-NEXT: .LBB15_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB15_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: mvn r0, r1 |
| ; CHECK-ARM8-NEXT: mvn r2, #1 |
| ; CHECK-ARM8-NEXT: orr r12, r0, r2 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB15_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB15_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB15_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB15_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB15_2 |
| ; CHECK-ARM8-NEXT: .LBB15_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB15_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB15_1 |
| ; CHECK-ARM8-NEXT: b .LBB15_5 |
| ; CHECK-ARM8-NEXT: .LBB15_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_nand_i16: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI15_0 |
| ; CHECK-ARM6-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB15_1 |
| ; CHECK-ARM6-NEXT: .LBB15_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB15_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: mvn r0, r1 |
| ; CHECK-ARM6-NEXT: mvn r2, #1 |
| ; CHECK-ARM6-NEXT: orr r12, r0, r2 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI15_0 |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB15_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB15_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB15_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB15_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB15_2 |
| ; CHECK-ARM6-NEXT: .LBB15_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB15_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB15_1 |
| ; CHECK-ARM6-NEXT: b .LBB15_5 |
| ; CHECK-ARM6-NEXT: .LBB15_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI15_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB7-LABEL: test_nand_i16: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB15_1 |
| ; CHECK-THUMB7-NEXT: .LBB15_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB15_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: mvn r0, #1 |
| ; CHECK-THUMB7-NEXT: orn r12, r0, r1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB15_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB15_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB15_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB15_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexh r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB15_2 |
| ; CHECK-THUMB7-NEXT: .LBB15_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB15_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB15_1 |
| ; CHECK-THUMB7-NEXT: b .LBB15_5 |
| ; CHECK-THUMB7-NEXT: .LBB15_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_nand_i16: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI15_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_nand_2 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI15_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_nand_i16: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB15_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB15_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB15_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: mvns r4, r1 |
| ; CHECK-THUMB8BASE-NEXT: movs r0, #1 |
| ; CHECK-THUMB8BASE-NEXT: mvns r0, r0 |
| ; CHECK-THUMB8BASE-NEXT: orrs r4, r0 |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB15_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB15_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB15_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB15_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexh r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB15_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB15_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB15_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB15_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB15_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB15_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw nand ptr @atomic_i16, i16 1 monotonic |
| ret i16 %0 |
| } |
| define i16 @test_or_i16() { |
| ; CHECK-ARM8-LABEL: test_or_i16: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB16_1 |
| ; CHECK-ARM8-NEXT: .LBB16_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB16_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: orr r12, r1, #1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB16_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB16_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB16_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB16_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB16_2 |
| ; CHECK-ARM8-NEXT: .LBB16_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB16_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB16_1 |
| ; CHECK-ARM8-NEXT: b .LBB16_5 |
| ; CHECK-ARM8-NEXT: .LBB16_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_or_i16: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI16_0 |
| ; CHECK-ARM6-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB16_1 |
| ; CHECK-ARM6-NEXT: .LBB16_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB16_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: orr r12, r1, #1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI16_0 |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB16_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB16_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB16_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB16_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB16_2 |
| ; CHECK-ARM6-NEXT: .LBB16_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB16_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB16_1 |
| ; CHECK-ARM6-NEXT: b .LBB16_5 |
| ; CHECK-ARM6-NEXT: .LBB16_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI16_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB7-LABEL: test_or_i16: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB16_1 |
| ; CHECK-THUMB7-NEXT: .LBB16_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB16_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: orr r12, r1, #1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB16_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB16_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB16_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB16_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexh r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB16_2 |
| ; CHECK-THUMB7-NEXT: .LBB16_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB16_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB16_1 |
| ; CHECK-THUMB7-NEXT: b .LBB16_5 |
| ; CHECK-THUMB7-NEXT: .LBB16_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_or_i16: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI16_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_or_2 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI16_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_or_i16: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB16_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB16_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB16_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movs r0, #1 |
| ; CHECK-THUMB8BASE-NEXT: mov r4, r1 |
| ; CHECK-THUMB8BASE-NEXT: orrs r4, r0 |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB16_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB16_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB16_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB16_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexh r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB16_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB16_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB16_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB16_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB16_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB16_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw or ptr @atomic_i16, i16 1 monotonic |
| ret i16 %0 |
| } |
| define i16 @test_xor_i16() { |
| ; CHECK-ARM8-LABEL: test_xor_i16: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB17_1 |
| ; CHECK-ARM8-NEXT: .LBB17_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB17_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: eor r12, r1, #1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB17_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB17_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB17_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB17_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB17_2 |
| ; CHECK-ARM8-NEXT: .LBB17_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB17_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB17_1 |
| ; CHECK-ARM8-NEXT: b .LBB17_5 |
| ; CHECK-ARM8-NEXT: .LBB17_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_xor_i16: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI17_0 |
| ; CHECK-ARM6-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB17_1 |
| ; CHECK-ARM6-NEXT: .LBB17_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB17_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: eor r12, r1, #1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI17_0 |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB17_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB17_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB17_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB17_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB17_2 |
| ; CHECK-ARM6-NEXT: .LBB17_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB17_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB17_1 |
| ; CHECK-ARM6-NEXT: b .LBB17_5 |
| ; CHECK-ARM6-NEXT: .LBB17_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI17_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB7-LABEL: test_xor_i16: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB17_1 |
| ; CHECK-THUMB7-NEXT: .LBB17_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB17_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: eor r12, r1, #1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB17_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB17_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB17_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB17_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexh r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB17_2 |
| ; CHECK-THUMB7-NEXT: .LBB17_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB17_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB17_1 |
| ; CHECK-THUMB7-NEXT: b .LBB17_5 |
| ; CHECK-THUMB7-NEXT: .LBB17_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_xor_i16: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI17_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_xor_2 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI17_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_xor_i16: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #8 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB17_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB17_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB17_2 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movs r0, #1 |
| ; CHECK-THUMB8BASE-NEXT: mov r4, r1 |
| ; CHECK-THUMB8BASE-NEXT: eors r4, r0 |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB17_2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB17_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB17_4 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB17_2 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexh r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB17_2 |
| ; CHECK-THUMB8BASE-NEXT: .LBB17_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB17_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB17_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB17_5 |
| ; CHECK-THUMB8BASE-NEXT: .LBB17_5: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #8 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw xor ptr @atomic_i16, i16 1 monotonic |
| ret i16 %0 |
| } |
| define i16 @test_max_i16() { |
| ; CHECK-ARM8-LABEL: test_max_i16: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB18_1 |
| ; CHECK-ARM8-NEXT: .LBB18_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB18_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: sxth r0, r1 |
| ; CHECK-ARM8-NEXT: mov r12, #1 |
| ; CHECK-ARM8-NEXT: cmp r0, #1 |
| ; CHECK-ARM8-NEXT: movgt r12, r1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB18_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB18_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB18_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB18_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB18_2 |
| ; CHECK-ARM8-NEXT: .LBB18_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB18_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB18_1 |
| ; CHECK-ARM8-NEXT: b .LBB18_5 |
| ; CHECK-ARM8-NEXT: .LBB18_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_max_i16: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI18_0 |
| ; CHECK-ARM6-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB18_1 |
| ; CHECK-ARM6-NEXT: .LBB18_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB18_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: sxth r0, r1 |
| ; CHECK-ARM6-NEXT: mov r12, #1 |
| ; CHECK-ARM6-NEXT: cmp r0, #1 |
| ; CHECK-ARM6-NEXT: movgt r12, r1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI18_0 |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB18_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB18_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB18_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB18_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB18_2 |
| ; CHECK-ARM6-NEXT: .LBB18_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB18_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB18_1 |
| ; CHECK-ARM6-NEXT: b .LBB18_5 |
| ; CHECK-ARM6-NEXT: .LBB18_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI18_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB7-LABEL: test_max_i16: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB18_1 |
| ; CHECK-THUMB7-NEXT: .LBB18_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB18_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: sxth r0, r1 |
| ; CHECK-THUMB7-NEXT: mov.w r12, #1 |
| ; CHECK-THUMB7-NEXT: cmp r0, #1 |
| ; CHECK-THUMB7-NEXT: it gt |
| ; CHECK-THUMB7-NEXT: movgt r12, r1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB18_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB18_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB18_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB18_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexh r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB18_2 |
| ; CHECK-THUMB7-NEXT: .LBB18_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB18_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5 |
| ; CHECK-THUMB7-NEXT: cmp r1, #1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: bne .LBB18_1 |
| ; CHECK-THUMB7-NEXT: b .LBB18_5 |
| ; CHECK-THUMB7-NEXT: .LBB18_5: @ %atomicrmw.end |
| ; CHECK-THUMB7-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: add sp, #8 |
| ; CHECK-THUMB7-NEXT: bx lr |
| ; |
| ; CHECK-THUMB6-LABEL: test_max_i16: |
| ; CHECK-THUMB6: @ %bb.0: @ %entry |
| ; CHECK-THUMB6-NEXT: .save {r7, lr} |
| ; CHECK-THUMB6-NEXT: push {r7, lr} |
| ; CHECK-THUMB6-NEXT: ldr r0, .LCPI18_0 |
| ; CHECK-THUMB6-NEXT: movs r1, #1 |
| ; CHECK-THUMB6-NEXT: bl __sync_fetch_and_max_2 |
| ; CHECK-THUMB6-NEXT: pop {r7, pc} |
| ; CHECK-THUMB6-NEXT: .p2align 2 |
| ; CHECK-THUMB6-NEXT: @ %bb.1: |
| ; CHECK-THUMB6-NEXT: .LCPI18_0: |
| ; CHECK-THUMB6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB8BASE-LABEL: test_max_i16: |
| ; CHECK-THUMB8BASE: @ %bb.0: @ %entry |
| ; CHECK-THUMB8BASE-NEXT: .save {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: push {r4, lr} |
| ; CHECK-THUMB8BASE-NEXT: .pad #20 |
| ; CHECK-THUMB8BASE-NEXT: sub sp, #20 |
| ; CHECK-THUMB8BASE-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #16] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: b .LBB18_1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB18_1: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ Child Loop BB18_4 Depth 2 |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp, #16] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: sxth r1, r0 |
| ; CHECK-THUMB8BASE-NEXT: movs r2, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r2, [sp, #8] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #12] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bgt .LBB18_3 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.2: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB18_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp, #8] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #12] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: .LBB18_3: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB18_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: ldr r4, [sp, #12] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: .LBB18_4: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ Parent Loop BB18_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB18_6 |
| ; CHECK-THUMB8BASE-NEXT: @ %bb.5: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB18_4 Depth=2 |
| ; CHECK-THUMB8BASE-NEXT: strexh r2, r4, [r3] |
| ; CHECK-THUMB8BASE-NEXT: cmp r2, #0 |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB18_4 |
| ; CHECK-THUMB8BASE-NEXT: .LBB18_6: @ %atomicrmw.start |
| ; CHECK-THUMB8BASE-NEXT: @ in Loop: Header=BB18_1 Depth=1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: uxth r1, r1 |
| ; CHECK-THUMB8BASE-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB8BASE-NEXT: rsbs r2, r1, #0 |
| ; CHECK-THUMB8BASE-NEXT: adcs r1, r2 |
| ; CHECK-THUMB8BASE-NEXT: cmp r1, #1 |
| ; CHECK-THUMB8BASE-NEXT: str r0, [sp, #16] @ 4-byte Spill |
| ; CHECK-THUMB8BASE-NEXT: bne .LBB18_1 |
| ; CHECK-THUMB8BASE-NEXT: b .LBB18_7 |
| ; CHECK-THUMB8BASE-NEXT: .LBB18_7: @ %atomicrmw.end |
| ; CHECK-THUMB8BASE-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-THUMB8BASE-NEXT: add sp, #20 |
| ; CHECK-THUMB8BASE-NEXT: pop {r4, pc} |
| entry: |
| %0 = atomicrmw max ptr @atomic_i16, i16 1 monotonic |
| ret i16 %0 |
| } |
| define i16 @test_min_i16() { |
| ; CHECK-ARM8-LABEL: test_min_i16: |
| ; CHECK-ARM8: @ %bb.0: @ %entry |
| ; CHECK-ARM8-NEXT: .pad #8 |
| ; CHECK-ARM8-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM8-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: b .LBB19_1 |
| ; CHECK-ARM8-NEXT: .LBB19_1: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM8-NEXT: @ Child Loop BB19_2 Depth 2 |
| ; CHECK-ARM8-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: sxth r0, r1 |
| ; CHECK-ARM8-NEXT: mov r12, #1 |
| ; CHECK-ARM8-NEXT: cmp r0, #2 |
| ; CHECK-ARM8-NEXT: movlt r12, r1 |
| ; CHECK-ARM8-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-ARM8-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: .LBB19_2: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ Parent Loop BB19_1 Depth=1 |
| ; CHECK-ARM8-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM8-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM8-NEXT: cmp r0, r1 |
| ; CHECK-ARM8-NEXT: bne .LBB19_4 |
| ; CHECK-ARM8-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB19_2 Depth=2 |
| ; CHECK-ARM8-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM8-NEXT: cmp r2, #0 |
| ; CHECK-ARM8-NEXT: bne .LBB19_2 |
| ; CHECK-ARM8-NEXT: .LBB19_4: @ %atomicrmw.start |
| ; CHECK-ARM8-NEXT: @ in Loop: Header=BB19_1 Depth=1 |
| ; CHECK-ARM8-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: uxth r1, r1 |
| ; CHECK-ARM8-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM8-NEXT: clz r1, r1 |
| ; CHECK-ARM8-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM8-NEXT: cmp r1, #1 |
| ; CHECK-ARM8-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM8-NEXT: bne .LBB19_1 |
| ; CHECK-ARM8-NEXT: b .LBB19_5 |
| ; CHECK-ARM8-NEXT: .LBB19_5: @ %atomicrmw.end |
| ; CHECK-ARM8-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM8-NEXT: add sp, sp, #8 |
| ; CHECK-ARM8-NEXT: bx lr |
| ; |
| ; CHECK-ARM6-LABEL: test_min_i16: |
| ; CHECK-ARM6: @ %bb.0: @ %entry |
| ; CHECK-ARM6-NEXT: .pad #8 |
| ; CHECK-ARM6-NEXT: sub sp, sp, #8 |
| ; CHECK-ARM6-NEXT: ldr r0, .LCPI19_0 |
| ; CHECK-ARM6-NEXT: ldrh r0, [r0] |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: b .LBB19_1 |
| ; CHECK-ARM6-NEXT: .LBB19_1: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-ARM6-NEXT: @ Child Loop BB19_2 Depth 2 |
| ; CHECK-ARM6-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: sxth r0, r1 |
| ; CHECK-ARM6-NEXT: mov r12, #1 |
| ; CHECK-ARM6-NEXT: cmp r0, #2 |
| ; CHECK-ARM6-NEXT: movlt r12, r1 |
| ; CHECK-ARM6-NEXT: ldr r3, .LCPI19_0 |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: .LBB19_2: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ Parent Loop BB19_1 Depth=1 |
| ; CHECK-ARM6-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-ARM6-NEXT: ldrexh r0, [r3] |
| ; CHECK-ARM6-NEXT: cmp r0, r1 |
| ; CHECK-ARM6-NEXT: bne .LBB19_4 |
| ; CHECK-ARM6-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB19_2 Depth=2 |
| ; CHECK-ARM6-NEXT: strexh r2, r12, [r3] |
| ; CHECK-ARM6-NEXT: cmp r2, #0 |
| ; CHECK-ARM6-NEXT: bne .LBB19_2 |
| ; CHECK-ARM6-NEXT: .LBB19_4: @ %atomicrmw.start |
| ; CHECK-ARM6-NEXT: @ in Loop: Header=BB19_1 Depth=1 |
| ; CHECK-ARM6-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: uxth r1, r1 |
| ; CHECK-ARM6-NEXT: sub r1, r0, r1 |
| ; CHECK-ARM6-NEXT: clz r1, r1 |
| ; CHECK-ARM6-NEXT: lsr r1, r1, #5 |
| ; CHECK-ARM6-NEXT: cmp r1, #1 |
| ; CHECK-ARM6-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-ARM6-NEXT: bne .LBB19_1 |
| ; CHECK-ARM6-NEXT: b .LBB19_5 |
| ; CHECK-ARM6-NEXT: .LBB19_5: @ %atomicrmw.end |
| ; CHECK-ARM6-NEXT: ldr r0, [sp] @ 4-byte Reload |
| ; CHECK-ARM6-NEXT: add sp, sp, #8 |
| ; CHECK-ARM6-NEXT: bx lr |
| ; CHECK-ARM6-NEXT: .p2align 2 |
| ; CHECK-ARM6-NEXT: @ %bb.6: |
| ; CHECK-ARM6-NEXT: .LCPI19_0: |
| ; CHECK-ARM6-NEXT: .long atomic_i16 |
| ; |
| ; CHECK-THUMB7-LABEL: test_min_i16: |
| ; CHECK-THUMB7: @ %bb.0: @ %entry |
| ; CHECK-THUMB7-NEXT: .pad #8 |
| ; CHECK-THUMB7-NEXT: sub sp, #8 |
| ; CHECK-THUMB7-NEXT: movw r0, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r0, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: ldrh r0, [r0] |
| ; CHECK-THUMB7-NEXT: str r0, [sp, #4] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: b .LBB19_1 |
| ; CHECK-THUMB7-NEXT: .LBB19_1: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ =>This Loop Header: Depth=1 |
| ; CHECK-THUMB7-NEXT: @ Child Loop BB19_2 Depth 2 |
| ; CHECK-THUMB7-NEXT: ldr r1, [sp, #4] @ 4-byte Reload |
| ; CHECK-THUMB7-NEXT: sxth r0, r1 |
| ; CHECK-THUMB7-NEXT: mov.w r12, #1 |
| ; CHECK-THUMB7-NEXT: cmp r0, #2 |
| ; CHECK-THUMB7-NEXT: it lt |
| ; CHECK-THUMB7-NEXT: movlt r12, r1 |
| ; CHECK-THUMB7-NEXT: movw r3, :lower16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: movt r3, :upper16:atomic_i16 |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: .LBB19_2: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ Parent Loop BB19_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: @ => This Inner Loop Header: Depth=2 |
| ; CHECK-THUMB7-NEXT: ldrexh r0, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r0, r1 |
| ; CHECK-THUMB7-NEXT: bne .LBB19_4 |
| ; CHECK-THUMB7-NEXT: @ %bb.3: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB19_2 Depth=2 |
| ; CHECK-THUMB7-NEXT: strexh r2, r12, [r3] |
| ; CHECK-THUMB7-NEXT: cmp r2, #0 |
| ; CHECK-THUMB7-NEXT: bne .LBB19_2 |
| ; CHECK-THUMB7-NEXT: .LBB19_4: @ %atomicrmw.start |
| ; CHECK-THUMB7-NEXT: @ in Loop: Header=BB19_1 Depth=1 |
| ; CHECK-THUMB7-NEXT: str r0, [sp] @ 4-byte Spill |
| ; CHECK-THUMB7-NEXT: uxth r1, r1 |
| ; CHECK-THUMB7-NEXT: subs r1, r0, r1 |
| ; CHECK-THUMB7-NEXT: clz r1, r1 |
| ; CHECK-THUMB7-NEXT: lsrs r1, r1, #5
|