1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu \
3 // RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s
4 // RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu \
5 // RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s
6 // RUN: %clang_cc1 -triple powerpc64-unknown-aix \
7 // RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s
8 // RUN: not %clang_cc1 -triple powerpc-unknown-aix \
9 // RUN: -emit-llvm %s -o - -target-cpu pwr7 2>&1 | FileCheck %s --check-prefix=CHECK-32-ERROR
11 extern unsigned long long ull
;
12 extern unsigned long long *ull_addr
;
14 // CHECK-LABEL: @test_builtin_ppc_store8r(
15 // CHECK: [[TMP0:%.*]] = load i64, ptr @ull, align 8
16 // CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr @ull_addr, align 8
17 // CHECK-NEXT: call void @llvm.ppc.store8r(i64 [[TMP0]], ptr [[TMP1]])
18 // CHECK-NEXT: ret void
20 // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
21 void test_builtin_ppc_store8r() {
22 __builtin_ppc_store8r(ull
, ull_addr
);
25 // CHECK-LABEL: @test_builtin_ppc_load8r(
26 // CHECK: [[TMP0:%.*]] = load ptr, ptr @ull_addr, align 8
27 // CHECK-NEXT: [[TMP2:%.*]] = call i64 @llvm.ppc.load8r(ptr [[TMP0]])
28 // CHECK-NEXT: ret i64 [[TMP2]]
30 // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
31 unsigned long long test_builtin_ppc_load8r() {
32 return __builtin_ppc_load8r(ull_addr
);