Debian Codegraph @

clang/test/CodeGen/PowerPC/builtins-ppc-amo.c

raw
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 6
2 // RUN: %clang_cc1 -O3 -triple powerpc64le-unknown-unknown -target-cpu pwr9 \
3 // RUN: -emit-llvm %s -o - | FileCheck %s
4 // RUN: %clang_cc1 -O3 -triple powerpc64-ibm-aix -target-cpu pwr9 \
5 // RUN: -emit-llvm %s -o - | FileCheck %s --check-prefix=AIX
6
7 // CHECK-LABEL: define dso_local void @test_unsigned_lwat(
8 // CHECK-SAME: ptr noundef [[PTR:%.*]], i32 noundef zeroext [[VALUE:%.*]], ptr noundef writeonly captures(none) initializes((0, 4)) [[RESP:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
9 // CHECK-NEXT: [[ENTRY:.*:]]
10 // CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @llvm.ppc.amo.lwat(ptr [[PTR]], i32 [[VALUE]], i32 0)
11 // CHECK-NEXT: store i32 [[TMP0]], ptr [[RESP]], align 4, !tbaa [[INT_TBAA2:![0-9]+]]
12 // CHECK-NEXT: ret void
13 //
14 // AIX-LABEL: define void @test_unsigned_lwat(
15 // AIX-SAME: ptr noundef [[PTR:%.*]], i32 noundef zeroext [[VALUE:%.*]], ptr noundef writeonly captures(none) initializes((0, 4)) [[RESP:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
16 // AIX-NEXT: [[ENTRY:.*:]]
17 // AIX-NEXT: [[TMP0:%.*]] = tail call i32 @llvm.ppc.amo.lwat(ptr [[PTR]], i32 [[VALUE]], i32 0)
18 // AIX-NEXT: store i32 [[TMP0]], ptr [[RESP]], align 4, !tbaa [[INT_TBAA2:![0-9]+]]
19 // AIX-NEXT: ret void
20 //
21 void test_unsigned_lwat(unsigned int *ptr, unsigned int value, unsigned int * resp) {
22 unsigned int res = __builtin_amo_lwat(ptr, value, 0);
23 *resp = res;
24 }
25
26 // CHECK-LABEL: define dso_local void @test_unsigned_ldat(
27 // CHECK-SAME: ptr noundef [[PTR:%.*]], i64 noundef [[VALUE:%.*]], ptr noundef writeonly captures(none) initializes((0, 8)) [[RESP:%.*]]) local_unnamed_addr #[[ATTR0]] {
28 // CHECK-NEXT: [[ENTRY:.*:]]
29 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.ppc.amo.ldat(ptr [[PTR]], i64 [[VALUE]], i32 3)
30 // CHECK-NEXT: store i64 [[TMP0]], ptr [[RESP]], align 8, !tbaa [[LONG_TBAA6:![0-9]+]]
31 // CHECK-NEXT: ret void
32 //
33 // AIX-LABEL: define void @test_unsigned_ldat(
34 // AIX-SAME: ptr noundef [[PTR:%.*]], i64 noundef [[VALUE:%.*]], ptr noundef writeonly captures(none) initializes((0, 8)) [[RESP:%.*]]) local_unnamed_addr #[[ATTR0]] {
35 // AIX-NEXT: [[ENTRY:.*:]]
36 // AIX-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.ppc.amo.ldat(ptr [[PTR]], i64 [[VALUE]], i32 3)
37 // AIX-NEXT: store i64 [[TMP0]], ptr [[RESP]], align 8, !tbaa [[LONG_TBAA6:![0-9]+]]
38 // AIX-NEXT: ret void
39 //
40 void test_unsigned_ldat(unsigned long int *ptr, unsigned long int value, unsigned long int * resp) {
41 unsigned long int res = __builtin_amo_ldat(ptr, value, 3);
42 *resp = res;
43 }
44
45 // CHECK-LABEL: define dso_local void @test_signed_lwat(
46 // CHECK-SAME: ptr noundef [[PTR:%.*]], i32 noundef signext [[VALUE:%.*]], ptr noundef writeonly captures(none) initializes((0, 4)) [[RESP:%.*]]) local_unnamed_addr #[[ATTR0]] {
47 // CHECK-NEXT: [[ENTRY:.*:]]
48 // CHECK-NEXT: [[TMP0:%.*]] = tail call i32 @llvm.ppc.amo.lwat(ptr [[PTR]], i32 [[VALUE]], i32 5)
49 // CHECK-NEXT: store i32 [[TMP0]], ptr [[RESP]], align 4, !tbaa [[INT_TBAA2]]
50 // CHECK-NEXT: ret void
51 //
52 // AIX-LABEL: define void @test_signed_lwat(
53 // AIX-SAME: ptr noundef [[PTR:%.*]], i32 noundef signext [[VALUE:%.*]], ptr noundef writeonly captures(none) initializes((0, 4)) [[RESP:%.*]]) local_unnamed_addr #[[ATTR0]] {
54 // AIX-NEXT: [[ENTRY:.*:]]
55 // AIX-NEXT: [[TMP0:%.*]] = tail call i32 @llvm.ppc.amo.lwat(ptr [[PTR]], i32 [[VALUE]], i32 5)
56 // AIX-NEXT: store i32 [[TMP0]], ptr [[RESP]], align 4, !tbaa [[INT_TBAA2]]
57 // AIX-NEXT: ret void
58 //
59 void test_signed_lwat(int *ptr, int value, int * resp) {
60 int res = __builtin_amo_lwat_s(ptr, value, 5);
61 *resp = res;
62 }
63
64
65 // CHECK-LABEL: define dso_local void @test_signed_ldat(
66 // CHECK-SAME: ptr noundef [[PTR:%.*]], i64 noundef [[VALUE:%.*]], ptr noundef writeonly captures(none) initializes((0, 8)) [[RESP:%.*]]) local_unnamed_addr #[[ATTR0]] {
67 // CHECK-NEXT: [[ENTRY:.*:]]
68 // CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.ppc.amo.ldat(ptr [[PTR]], i64 [[VALUE]], i32 8)
69 // CHECK-NEXT: store i64 [[TMP0]], ptr [[RESP]], align 8, !tbaa [[LONG_TBAA6]]
70 // CHECK-NEXT: ret void
71 //
72 // AIX-LABEL: define void @test_signed_ldat(
73 // AIX-SAME: ptr noundef [[PTR:%.*]], i64 noundef [[VALUE:%.*]], ptr noundef writeonly captures(none) initializes((0, 8)) [[RESP:%.*]]) local_unnamed_addr #[[ATTR0]] {
74 // AIX-NEXT: [[ENTRY:.*:]]
75 // AIX-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.ppc.amo.ldat(ptr [[PTR]], i64 [[VALUE]], i32 8)
76 // AIX-NEXT: store i64 [[TMP0]], ptr [[RESP]], align 8, !tbaa [[LONG_TBAA6]]
77 // AIX-NEXT: ret void
78 //
79 void test_signed_ldat(long int *ptr, long int value, long int * resp) {
80 long int res = __builtin_amo_ldat_s(ptr, value, 8);
81 *resp = res;
82 }
83
84 //.
85 // CHECK: [[INT_TBAA2]] = !{[[META3:![0-9]+]], [[META3]], i64 0}
86 // CHECK: [[META3]] = !{!"int", [[META4:![0-9]+]], i64 0}
87 // CHECK: [[META4]] = !{!"omnipotent char", [[META5:![0-9]+]], i64 0}
88 // CHECK: [[META5]] = !{!"Simple C/C++ TBAA"}
89 // CHECK: [[LONG_TBAA6]] = !{[[META7:![0-9]+]], [[META7]], i64 0}
90 // CHECK: [[META7]] = !{!"long", [[META4]], i64 0}
91 //.
92 // AIX: [[INT_TBAA2]] = !{[[META3:![0-9]+]], [[META3]], i64 0}
93 // AIX: [[META3]] = !{!"int", [[META4:![0-9]+]], i64 0}
94 // AIX: [[META4]] = !{!"omnipotent char", [[META5:![0-9]+]], i64 0}
95 // AIX: [[META5]] = !{!"Simple C/C++ TBAA"}
96 // AIX: [[LONG_TBAA6]] = !{[[META7:![0-9]+]], [[META7]], i64 0}
97 // AIX: [[META7]] = !{!"long", [[META4]], i64 0}
98 //.