1 // REQUIRES: powerpc-registered-target
2 // RUN: not %clang_cc1 -triple=powerpc-unknown-aix -emit-llvm %s -o - 2>&1 |\
3 // RUN: FileCheck %s --check-prefix=CHECK32-ERROR
4 // RUN: %clang_cc1 -O2 -triple=powerpc64-unknown-aix -emit-llvm %s -o - | \
5 // RUN: FileCheck %s --check-prefix=CHECK64
6 // RUN: %clang_cc1 -O2 -triple=powerpc64le-unknown-linux-gnu -emit-llvm %s \
7 // RUN:  -o - | FileCheck %s --check-prefix=CHECK64
8 // RUN: %clang_cc1 -O2 -triple=powerpc64-unknown-linux-gnu -emit-llvm %s \
9 // RUN:  -o - | FileCheck %s --check-prefix=CHECK64
10 
test_ldarx(volatile long * a)11 long test_ldarx(volatile long* a) {
12   // CHECK64-LABEL: @test_ldarx
13   // CHECK64: %0 = tail call i64 asm sideeffect "ldarx $0, ${1:y}", "=r,*Z,~{memory}"(ptr elementtype(i64) %a)
14   // CHECK32-ERROR: error: this builtin is only available on 64-bit targets
15   return __ldarx(a);
16 }
17 
test_stdcx(volatile long * addr,long val)18 int test_stdcx(volatile long* addr, long val) {
19   // CHECK64-LABEL: @test_stdcx
20   // CHECK64: %0 = tail call i32 @llvm.ppc.stdcx(ptr %addr, i64 %val)
21   // CHECK32-ERROR: error: this builtin is only available on 64-bit targets
22   return __stdcx(addr, val);
23 }
24