[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / fixed-point-tbaa.c
blob2f8822e510c7326f19cfb99acb798af21fa4e5dc
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -ffixed-point %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK
2 //
3 // Check that we generate correct TBAA metadata for fixed-point types.
5 void sfract(unsigned short _Fract *p, short _Fract *q,
6 unsigned _Sat short _Fract *r, _Sat short _Fract *s) {
7 // CHECK-LABEL: define{{.*}} void @sfract
8 // CHECK: store i8 -128, ptr %p, align 1, !tbaa [[TAG_sf:!.*]]
9 // CHECK: store i8 -64, ptr %q, align 1, !tbaa [[TAG_sf]]
10 // CHECK: store i8 -128, ptr %r, align 1, !tbaa [[TAG_sat_sf:!.*]]
11 // CHECK: store i8 -64, ptr %s, align 1, !tbaa [[TAG_sat_sf]]
12 *p = 0.5hur;
13 *q = -0.5hr;
14 *r = 0.5hur;
15 *s = -0.5hr;
18 void fract(unsigned _Fract *p, _Fract *q,
19 unsigned _Sat _Fract *r, _Sat _Fract *s) {
20 // CHECK-LABEL: define{{.*}} void @fract
21 // CHECK: store i16 -32768, ptr %p, align 2, !tbaa [[TAG_f:!.*]]
22 // CHECK: store i16 -16384, ptr %q, align 2, !tbaa [[TAG_f]]
23 // CHECK: store i16 -32768, ptr %r, align 2, !tbaa [[TAG_sat_f:!.*]]
24 // CHECK: store i16 -16384, ptr %s, align 2, !tbaa [[TAG_sat_f]]
25 *p = 0.5ur;
26 *q = -0.5r;
27 *r = 0.5ur;
28 *s = -0.5r;
31 void lfract(unsigned long _Fract *p, long _Fract *q,
32 unsigned _Sat long _Fract *r, _Sat long _Fract *s) {
33 // CHECK-LABEL: define{{.*}} void @lfract
34 // CHECK: store i32 -2147483648, ptr %p, align 4, !tbaa [[TAG_lf:!.*]]
35 // CHECK: store i32 -1073741824, ptr %q, align 4, !tbaa [[TAG_lf]]
36 // CHECK: store i32 -2147483648, ptr %r, align 4, !tbaa [[TAG_sat_lf:!.*]]
37 // CHECK: store i32 -1073741824, ptr %s, align 4, !tbaa [[TAG_sat_lf]]
38 *p = 0.5ulr;
39 *q = -0.5lr;
40 *r = 0.5ulr;
41 *s = -0.5lr;
44 void saccum(unsigned short _Accum *p, short _Accum *q,
45 unsigned _Sat short _Accum *r, _Sat short _Accum *s) {
46 // CHECK-LABEL: define{{.*}} void @saccum
47 // CHECK: store i16 128, ptr %p, align 2, !tbaa [[TAG_sk:!.*]]
48 // CHECK: store i16 -64, ptr %q, align 2, !tbaa [[TAG_sk]]
49 // CHECK: store i16 128, ptr %r, align 2, !tbaa [[TAG_sat_sk:!.*]]
50 // CHECK: store i16 -64, ptr %s, align 2, !tbaa [[TAG_sat_sk]]
51 *p = 0.5huk;
52 *q = -0.5hk;
53 *r = 0.5huk;
54 *s = -0.5hk;
57 void accum(unsigned _Accum *p, _Accum *q,
58 unsigned _Sat _Accum *r, _Sat _Accum *s) {
59 // CHECK-LABEL: define{{.*}} void @accum
60 // CHECK: store i32 32768, ptr %p, align 4, !tbaa [[TAG_k:!.*]]
61 // CHECK: store i32 -16384, ptr %q, align 4, !tbaa [[TAG_k]]
62 // CHECK: store i32 32768, ptr %r, align 4, !tbaa [[TAG_sat_k:!.*]]
63 // CHECK: store i32 -16384, ptr %s, align 4, !tbaa [[TAG_sat_k]]
64 *p = 0.5uk;
65 *q = -0.5k;
66 *r = 0.5uk;
67 *s = -0.5k;
70 void laccum(unsigned long _Accum *p, long _Accum *q,
71 unsigned _Sat long _Accum *r, _Sat long _Accum *s) {
72 // CHECK-LABEL: define{{.*}} void @laccum
73 // CHECK: store i64 2147483648, ptr %p, align 8, !tbaa [[TAG_lk:!.*]]
74 // CHECK: store i64 -1073741824, ptr %q, align 8, !tbaa [[TAG_lk]]
75 // CHECK: store i64 2147483648, ptr %r, align 8, !tbaa [[TAG_sat_lk:!.*]]
76 // CHECK: store i64 -1073741824, ptr %s, align 8, !tbaa [[TAG_sat_lk]]
77 *p = 0.5ulk;
78 *q = -0.5lk;
79 *r = 0.5ulk;
80 *s = -0.5lk;
83 // CHECK-DAG: [[TAG_sf]] = !{[[TYPE_sf:!.*]], [[TYPE_sf]], i64 0}
84 // CHECK-DAG: [[TYPE_sf]] = !{!"short _Fract"
85 // CHECK-DAG: [[TAG_f]] = !{[[TYPE_f:!.*]], [[TYPE_f]], i64 0}
86 // CHECK-DAG: [[TYPE_f]] = !{!"_Fract"
87 // CHECK-DAG: [[TAG_lf]] = !{[[TYPE_lf:!.*]], [[TYPE_lf]], i64 0}
88 // CHECK-DAG: [[TYPE_lf]] = !{!"long _Fract"
90 // CHECK-DAG: [[TAG_sat_sf]] = !{[[TYPE_sat_sf:!.*]], [[TYPE_sat_sf]], i64 0}
91 // CHECK-DAG: [[TYPE_sat_sf]] = !{!"_Sat short _Fract"
92 // CHECK-DAG: [[TAG_sat_f]] = !{[[TYPE_sat_f:!.*]], [[TYPE_sat_f]], i64 0}
93 // CHECK-DAG: [[TYPE_sat_f]] = !{!"_Sat _Fract"
94 // CHECK-DAG: [[TAG_sat_lf]] = !{[[TYPE_sat_lf:!.*]], [[TYPE_sat_lf]], i64 0}
95 // CHECK-DAG: [[TYPE_sat_lf]] = !{!"_Sat long _Fract"
97 // CHECK-DAG: [[TAG_sk]] = !{[[TYPE_sk:!.*]], [[TYPE_sk]], i64 0}
98 // CHECK-DAG: [[TYPE_sk]] = !{!"short _Accum"
99 // CHECK-DAG: [[TAG_k]] = !{[[TYPE_k:!.*]], [[TYPE_k]], i64 0}
100 // CHECK-DAG: [[TYPE_k]] = !{!"_Accum"
101 // CHECK-DAG: [[TAG_lk]] = !{[[TYPE_lk:!.*]], [[TYPE_lk]], i64 0}
102 // CHECK-DAG: [[TYPE_lk]] = !{!"long _Accum"
104 // CHECK-DAG: [[TAG_sat_sk]] = !{[[TYPE_sat_sk:!.*]], [[TYPE_sat_sk]], i64 0}
105 // CHECK-DAG: [[TYPE_sat_sk]] = !{!"_Sat short _Accum"
106 // CHECK-DAG: [[TAG_sat_k]] = !{[[TYPE_sat_k:!.*]], [[TYPE_sat_k]], i64 0}
107 // CHECK-DAG: [[TYPE_sat_k]] = !{!"_Sat _Accum"
108 // CHECK-DAG: [[TAG_sat_lk]] = !{[[TYPE_sat_lk:!.*]], [[TYPE_sat_lk]], i64 0}
109 // CHECK-DAG: [[TYPE_sat_lk]] = !{!"_Sat long _Accum"