1 ; RUN: llc < %s -mtriple=powerpc-apple-darwin -march=ppc32 -verify-machineinstrs | FileCheck %s --check-prefix=CHECK --check-prefix=PPC32
2 ; FIXME: -verify-machineinstrs currently fail on ppc64 (mismatched register/instruction).
3 ; This is already checked for in Atomics-64.ll
4 ; RUN: llc < %s -mtriple=powerpc-apple-darwin -march=ppc64 | FileCheck %s --check-prefix=CHECK --check-prefix=PPC64
6 ; In this file, we check that atomic load/store can make use of the indexed
7 ; versions of the instructions.
9 ; Indexed version of loads
10 define i8 @load_x_i8_seq_cst([100000 x i8]* %mem) {
11 ; CHECK-LABEL: load_x_i8_seq_cst
15 %ptr = getelementptr inbounds [100000 x i8], [100000 x i8]* %mem, i64 0, i64 90000
16 %val = load atomic i8, i8* %ptr seq_cst, align 1
19 define i16 @load_x_i16_acquire([100000 x i16]* %mem) {
20 ; CHECK-LABEL: load_x_i16_acquire
23 %ptr = getelementptr inbounds [100000 x i16], [100000 x i16]* %mem, i64 0, i64 90000
24 %val = load atomic i16, i16* %ptr acquire, align 2
27 define i32 @load_x_i32_monotonic([100000 x i32]* %mem) {
28 ; CHECK-LABEL: load_x_i32_monotonic
31 %ptr = getelementptr inbounds [100000 x i32], [100000 x i32]* %mem, i64 0, i64 90000
32 %val = load atomic i32, i32* %ptr monotonic, align 4
35 define i64 @load_x_i64_unordered([100000 x i64]* %mem) {
36 ; CHECK-LABEL: load_x_i64_unordered
41 %ptr = getelementptr inbounds [100000 x i64], [100000 x i64]* %mem, i64 0, i64 90000
42 %val = load atomic i64, i64* %ptr unordered, align 8
46 ; Indexed version of stores
47 define void @store_x_i8_seq_cst([100000 x i8]* %mem) {
48 ; CHECK-LABEL: store_x_i8_seq_cst
51 %ptr = getelementptr inbounds [100000 x i8], [100000 x i8]* %mem, i64 0, i64 90000
52 store atomic i8 42, i8* %ptr seq_cst, align 1
55 define void @store_x_i16_release([100000 x i16]* %mem) {
56 ; CHECK-LABEL: store_x_i16_release
59 %ptr = getelementptr inbounds [100000 x i16], [100000 x i16]* %mem, i64 0, i64 90000
60 store atomic i16 42, i16* %ptr release, align 2
63 define void @store_x_i32_monotonic([100000 x i32]* %mem) {
64 ; CHECK-LABEL: store_x_i32_monotonic
67 %ptr = getelementptr inbounds [100000 x i32], [100000 x i32]* %mem, i64 0, i64 90000
68 store atomic i32 42, i32* %ptr monotonic, align 4
71 define void @store_x_i64_unordered([100000 x i64]* %mem) {
72 ; CHECK-LABEL: store_x_i64_unordered
78 %ptr = getelementptr inbounds [100000 x i64], [100000 x i64]* %mem, i64 0, i64 90000
79 store atomic i64 42, i64* %ptr unordered, align 8