diff options
Diffstat (limited to 'clang/test/CodeGen/PowerPC')
| -rw-r--r-- | clang/test/CodeGen/PowerPC/builtins-amo-err.c | 18 | ||||
| -rw-r--r-- | clang/test/CodeGen/PowerPC/builtins-ppc-amo.c | 58 | ||||
| -rw-r--r-- | clang/test/CodeGen/PowerPC/ppc-amo-header.c | 91 | ||||
| -rw-r--r-- | clang/test/CodeGen/PowerPC/ppc64-abi-override-datalayout.c | 8 |
4 files changed, 175 insertions, 0 deletions
diff --git a/clang/test/CodeGen/PowerPC/builtins-amo-err.c b/clang/test/CodeGen/PowerPC/builtins-amo-err.c new file mode 100644 index 0000000..cdc14ef --- /dev/null +++ b/clang/test/CodeGen/PowerPC/builtins-amo-err.c @@ -0,0 +1,18 @@ +// RUN: not %clang_cc1 -triple powerpc-ibm-aix -target-cpu pwr9 \ +// RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=AIX32-ERROR +// RUN: not %clang_cc1 -triple powerpc64-ibm-aix -target-cpu pwr9 \ +// RUN: -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=FC-ERROR + +void test_amo() { + unsigned int *ptr1, value1; + // AIX32-ERROR: error: this builtin is only available on 64-bit targets + __builtin_amo_lwat(ptr1, value1, 0); + // FC-ERROR: argument value 9 is outside the valid range [0-4, 6, 8] + __builtin_amo_lwat(ptr1, value1, 9); + + unsigned long int *ptr2, value2; + // AIX32-ERROR: error: this builtin is only available on 64-bit targets + __builtin_amo_ldat(ptr2, value2, 3); + // FC-ERROR: error: argument value 26 is outside the valid range [0-4, 6, 8] + __builtin_amo_ldat(ptr2, value2, 26); +} diff --git a/clang/test/CodeGen/PowerPC/builtins-ppc-amo.c b/clang/test/CodeGen/PowerPC/builtins-ppc-amo.c new file mode 100644 index 0000000..2975b99 --- /dev/null +++ b/clang/test/CodeGen/PowerPC/builtins-ppc-amo.c @@ -0,0 +1,58 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 6 +// RUN: %clang_cc1 -O3 -triple powerpc64le-unknown-unknown -target-cpu pwr9 \ +// RUN: -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -O3 -triple powerpc64-ibm-aix -target-cpu pwr9 \ +// RUN: -emit-llvm %s -o - | FileCheck %s --check-prefix=AIX + +// CHECK-LABEL: define dso_local void @test_unsigned_lwat( +// CHECK-SAME: ptr noundef [[PTR:%.*]], i32 noundef zeroext [[VALUE:%.*]], ptr noundef writeonly captures(none) initializes((0, 4)) [[RESP:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @llvm.ppc.amo.lwat(ptr [[PTR]], i32 [[VALUE]], i32 0) +// CHECK-NEXT: store i32 [[TMP0]], ptr [[RESP]], align 4, !tbaa [[INT_TBAA2:![0-9]+]] +// CHECK-NEXT: ret void +// +// AIX-LABEL: define void @test_unsigned_lwat( +// AIX-SAME: ptr noundef [[PTR:%.*]], i32 noundef zeroext [[VALUE:%.*]], ptr noundef writeonly captures(none) initializes((0, 4)) [[RESP:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { +// AIX-NEXT: [[ENTRY:.*:]] +// AIX-NEXT: [[TMP0:%.*]] = tail call i32 @llvm.ppc.amo.lwat(ptr [[PTR]], i32 [[VALUE]], i32 0) +// AIX-NEXT: store i32 [[TMP0]], ptr [[RESP]], align 4, !tbaa [[INT_TBAA2:![0-9]+]] +// AIX-NEXT: ret void +// +void test_unsigned_lwat(unsigned int *ptr, unsigned int value, unsigned int * resp) { + unsigned int res = __builtin_amo_lwat(ptr, value, 0); + *resp = res; +} + +// CHECK-LABEL: define dso_local void @test_unsigned_ldat( +// CHECK-SAME: ptr noundef [[PTR:%.*]], i64 noundef [[VALUE:%.*]], ptr noundef writeonly captures(none) initializes((0, 8)) [[RESP:%.*]]) local_unnamed_addr #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.ppc.amo.ldat(ptr [[PTR]], i64 [[VALUE]], i32 3) +// CHECK-NEXT: store i64 [[TMP0]], ptr [[RESP]], align 8, !tbaa [[LONG_TBAA6:![0-9]+]] +// CHECK-NEXT: ret void +// +// AIX-LABEL: define void @test_unsigned_ldat( +// AIX-SAME: ptr noundef [[PTR:%.*]], i64 noundef [[VALUE:%.*]], ptr noundef writeonly captures(none) initializes((0, 8)) [[RESP:%.*]]) local_unnamed_addr #[[ATTR0]] { +// AIX-NEXT: [[ENTRY:.*:]] +// AIX-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.ppc.amo.ldat(ptr [[PTR]], i64 [[VALUE]], i32 3) +// AIX-NEXT: store i64 [[TMP0]], ptr [[RESP]], align 8, !tbaa [[LONG_TBAA6:![0-9]+]] +// AIX-NEXT: ret void +// +void test_unsigned_ldat(unsigned long int *ptr, unsigned long int value, unsigned long int * resp) { + unsigned long int res = __builtin_amo_ldat(ptr, value, 3); + *resp = res; +} +//. +// CHECK: [[INT_TBAA2]] = !{[[META3:![0-9]+]], [[META3]], i64 0} +// CHECK: [[META3]] = !{!"int", [[META4:![0-9]+]], i64 0} +// CHECK: [[META4]] = !{!"omnipotent char", [[META5:![0-9]+]], i64 0} +// CHECK: [[META5]] = !{!"Simple C/C++ TBAA"} +// CHECK: [[LONG_TBAA6]] = !{[[META7:![0-9]+]], [[META7]], i64 0} +// CHECK: [[META7]] = !{!"long", [[META4]], i64 0} +//. +// AIX: [[INT_TBAA2]] = !{[[META3:![0-9]+]], [[META3]], i64 0} +// AIX: [[META3]] = !{!"int", [[META4:![0-9]+]], i64 0} +// AIX: [[META4]] = !{!"omnipotent char", [[META5:![0-9]+]], i64 0} +// AIX: [[META5]] = !{!"Simple C/C++ TBAA"} +// AIX: [[LONG_TBAA6]] = !{[[META7:![0-9]+]], [[META7]], i64 0} +// AIX: [[META7]] = !{!"long", [[META4]], i64 0} +//. diff --git a/clang/test/CodeGen/PowerPC/ppc-amo-header.c b/clang/test/CodeGen/PowerPC/ppc-amo-header.c new file mode 100644 index 0000000..f544cde --- /dev/null +++ b/clang/test/CodeGen/PowerPC/ppc-amo-header.c @@ -0,0 +1,91 @@ +// REQUIRES: powerpc-registered-target +// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -target-cpu pwr9 \ +// RUN: -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple powerpc64-ibm-aix -target-cpu pwr9 \ +// RUN: -emit-llvm %s -o - | FileCheck %s + +#include <amo.h> + +uint32_t test_lwat_add(uint32_t *ptr, uint32_t val) { + // CHECK-LABEL: @test_lwat_add + // CHECK: call i32 @llvm.ppc.amo.lwat(ptr %{{.*}}, i32 %{{.*}}, i32 0) + return amo_lwat_add(ptr, val); +} + +uint32_t test_lwat_xor(uint32_t *ptr, uint32_t val) { + // CHECK-LABEL: @test_lwat_xor + // CHECK: call i32 @llvm.ppc.amo.lwat(ptr %{{.*}}, i32 %{{.*}}, i32 1) + return amo_lwat_xor(ptr, val); +} + +uint32_t test_lwat_ior(uint32_t *ptr, uint32_t val) { + // CHECK-LABEL: @test_lwat_ior + // CHECK: call i32 @llvm.ppc.amo.lwat(ptr %{{.*}}, i32 %{{.*}}, i32 2) + return amo_lwat_ior(ptr, val); +} + +uint32_t test_lwat_and(uint32_t *ptr, uint32_t val) { + // CHECK-LABEL: @test_lwat_and + // CHECK: call i32 @llvm.ppc.amo.lwat(ptr %{{.*}}, i32 %{{.*}}, i32 3) + return amo_lwat_and(ptr, val); +} + +uint32_t test_lwat_umax(uint32_t *ptr, uint32_t val) { + // CHECK-LABEL: @test_lwat_umax + // CHECK: call i32 @llvm.ppc.amo.lwat(ptr %{{.*}}, i32 %{{.*}}, i32 4) + return amo_lwat_umax(ptr, val); +} + +uint32_t test_lwat_umin(uint32_t *ptr, uint32_t val) { + // CHECK-LABEL: @test_lwat_umin + // CHECK: call i32 @llvm.ppc.amo.lwat(ptr %{{.*}}, i32 %{{.*}}, i32 6) + return amo_lwat_umin(ptr, val); +} + +uint32_t test_lwat_swap(uint32_t *ptr, uint32_t val) { + // CHECK-LABEL: @test_lwat_swap + // CHECK: call i32 @llvm.ppc.amo.lwat(ptr %{{.*}}, i32 %{{.*}}, i32 8) + return amo_lwat_swap(ptr, val); +} + +uint64_t test_ldat_add(uint64_t *ptr, uint64_t val) { + // CHECK-LABEL: @test_ldat_add + // CHECK: call i64 @llvm.ppc.amo.ldat(ptr %{{.*}}, i64 %{{.*}}, i32 0) + return amo_ldat_add(ptr, val); +} + +uint64_t test_ldat_xor(uint64_t *ptr, uint64_t val) { + // CHECK-LABEL: @test_ldat_xor + // CHECK: call i64 @llvm.ppc.amo.ldat(ptr %{{.*}}, i64 %{{.*}}, i32 1) + return amo_ldat_xor(ptr, val); +} + +uint64_t test_ldat_ior(uint64_t *ptr, uint64_t val) { + // CHECK-LABEL: @test_ldat_ior + // CHECK: call i64 @llvm.ppc.amo.ldat(ptr %{{.*}}, i64 %{{.*}}, i32 2) + return amo_ldat_ior(ptr, val); +} + +uint64_t test_ldat_and(uint64_t *ptr, uint64_t val) { + // CHECK-LABEL: @test_ldat_and + // CHECK: call i64 @llvm.ppc.amo.ldat(ptr %{{.*}}, i64 %{{.*}}, i32 3) + return amo_ldat_and(ptr, val); +} + +uint64_t test_ldat_umax(uint64_t *ptr, uint64_t val) { + // CHECK-LABEL: @test_ldat_umax + // CHECK: call i64 @llvm.ppc.amo.ldat(ptr %{{.*}}, i64 %{{.*}}, i32 4) + return amo_ldat_umax(ptr, val); +} + +uint64_t test_ldat_umin(uint64_t *ptr, uint64_t val) { + // CHECK-LABEL: @test_ldat_umin + // CHECK: call i64 @llvm.ppc.amo.ldat(ptr %{{.*}}, i64 %{{.*}}, i32 6) + return amo_ldat_umin(ptr, val); +} + +uint64_t test_ldat_swap(uint64_t *ptr, uint64_t val) { + // CHECK-LABEL: @test_ldat_swap + // CHECK: call i64 @llvm.ppc.amo.ldat(ptr %{{.*}}, i64 %{{.*}}, i32 8) + return amo_ldat_swap(ptr, val); +} diff --git a/clang/test/CodeGen/PowerPC/ppc64-abi-override-datalayout.c b/clang/test/CodeGen/PowerPC/ppc64-abi-override-datalayout.c new file mode 100644 index 0000000..30b85d2 --- /dev/null +++ b/clang/test/CodeGen/PowerPC/ppc64-abi-override-datalayout.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -target-abi elfv2 %s -o - -emit-llvm | FileCheck %s + +// REQUIRES: powerpc-registered-target + +// Make sure that overriding the ABI to ELFv2 on a target that defaults to +// ELFv1 changes the data layout: + +// CHECK: target datalayout = "E-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512" |
