1 ; RUN: llc < %s -mtriple=armv7-apple-ios -verify-machineinstrs | FileCheck %s -check-prefix=ARM 2 ; RUN: llc < %s -mtriple=armv7-apple-ios -O0 | FileCheck %s -check-prefix=ARM 3 ; RUN: llc < %s -mtriple=thumbv7-apple-ios | FileCheck %s -check-prefix=THUMBTWO 4 ; RUN: llc < %s -mtriple=thumbv6-apple-ios | FileCheck %s -check-prefix=THUMBONE 5 6 define void @test1(i32* %ptr, i32 %val1) { 7 ; ARM: test1 8 ; ARM: dmb ish 9 ; ARM-NEXT: str 10 ; ARM-NEXT: dmb ish 11 ; THUMBONE: test1 12 ; THUMBONE: __sync_lock_test_and_set_4 13 ; THUMBTWO: test1 14 ; THUMBTWO: dmb ish 15 ; THUMBTWO-NEXT: str 16 ; THUMBTWO-NEXT: dmb ish 17 store atomic i32 %val1, i32* %ptr seq_cst, align 4 18 ret void 19 } 20 21 define i32 @test2(i32* %ptr) { 22 ; ARM: test2 23 ; ARM: ldr 24 ; ARM-NEXT: dmb ish 25 ; THUMBONE: test2 26 ; THUMBONE: __sync_val_compare_and_swap_4 27 ; THUMBTWO: test2 28 ; THUMBTWO: ldr 29 ; THUMBTWO-NEXT: dmb ish 30 %val = load atomic i32* %ptr seq_cst, align 4 31 ret i32 %val 32 } 33 34 define void @test3(i8* %ptr1, i8* %ptr2) { 35 ; ARM: test3 36 ; ARM: ldrb 37 ; ARM: strb 38 ; THUMBTWO: test3 39 ; THUMBTWO: ldrb 40 ; THUMBTWO: strb 41 ; THUMBONE: test3 42 ; THUMBONE: ldrb 43 ; THUMBONE: strb 44 %val = load atomic i8* %ptr1 unordered, align 1 45 store atomic i8 %val, i8* %ptr2 unordered, align 1 46 ret void 47 } 48 49 define void @test4(i8* %ptr1, i8* %ptr2) { 50 ; THUMBONE: test4 51 ; THUMBONE: ___sync_val_compare_and_swap_1 52 ; THUMBONE: ___sync_lock_test_and_set_1 53 %val = load atomic i8* %ptr1 seq_cst, align 1 54 store atomic i8 %val, i8* %ptr2 seq_cst, align 1 55 ret void 56 } 57