Debian Codegraph @

clang/test/CodeGen/attr-arm-sve-vector-bits-cast.c

raw
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 6
2 // RUN: %clang_cc1 -triple aarch64 -target-feature +sve -mvscale-min=4 -mvscale-max=4 -O1 -emit-llvm -o - %s | FileCheck %s
3
4 // REQUIRES: aarch64-registered-target
5
6 #include <arm_sve.h>
7
8 #define N __ARM_FEATURE_SVE_BITS
9
10 typedef svint32_t fixed_int32_t __attribute__((arm_sve_vector_bits(N)));
11 typedef svfloat64_t fixed_float64_t __attribute__((arm_sve_vector_bits(N)));
12 typedef svbool_t fixed_bool_t __attribute__((arm_sve_vector_bits(N)));
13 typedef int32_t gnu_int32_t __attribute__((vector_size(N / 8)));
14
15 // CHECK-LABEL: define dso_local noundef <vscale x 4 x i32> @to_svint32_t(
16 // CHECK-SAME: <vscale x 4 x i32> noundef returned [[TYPE_COERCE:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
17 // CHECK-NEXT: [[ENTRY:.*:]]
18 // CHECK-NEXT: ret <vscale x 4 x i32> [[TYPE_COERCE]]
19 //
20 svint32_t to_svint32_t(fixed_int32_t type) {
21 return type;
22 }
23
24 // CHECK-LABEL: define dso_local <vscale x 4 x i32> @from_svint32_t(
25 // CHECK-SAME: <vscale x 4 x i32> returned [[TYPE:%.*]]) local_unnamed_addr #[[ATTR0]] {
26 // CHECK-NEXT: [[ENTRY:.*:]]
27 // CHECK-NEXT: ret <vscale x 4 x i32> [[TYPE]]
28 //
29 fixed_int32_t from_svint32_t(svint32_t type) {
30 return type;
31 }
32
33 // CHECK-LABEL: define dso_local noundef <vscale x 2 x double> @to_svfloat64_t(
34 // CHECK-SAME: <vscale x 2 x double> noundef returned [[TYPE_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {
35 // CHECK-NEXT: [[ENTRY:.*:]]
36 // CHECK-NEXT: ret <vscale x 2 x double> [[TYPE_COERCE]]
37 //
38 svfloat64_t to_svfloat64_t(fixed_float64_t type) {
39 return type;
40 }
41
42 // CHECK-LABEL: define dso_local <vscale x 2 x double> @from_svfloat64_t(
43 // CHECK-SAME: <vscale x 2 x double> returned [[TYPE:%.*]]) local_unnamed_addr #[[ATTR0]] {
44 // CHECK-NEXT: [[ENTRY:.*:]]
45 // CHECK-NEXT: ret <vscale x 2 x double> [[TYPE]]
46 //
47 fixed_float64_t from_svfloat64_t(svfloat64_t type) {
48 return type;
49 }
50
51 // CHECK-LABEL: define dso_local noundef <vscale x 16 x i1> @to_svbool_t(
52 // CHECK-SAME: <vscale x 16 x i1> noundef returned [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
53 // CHECK-NEXT: [[ENTRY:.*:]]
54 // CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]]
55 //
56 svbool_t to_svbool_t(fixed_bool_t type) {
57 return type;
58 }
59
60 // CHECK-LABEL: define dso_local <vscale x 16 x i1> @from_svbool_t(
61 // CHECK-SAME: <vscale x 16 x i1> returned [[TYPE:%.*]]) local_unnamed_addr #[[ATTR0]] {
62 // CHECK-NEXT: [[ENTRY:.*:]]
63 // CHECK-NEXT: ret <vscale x 16 x i1> [[TYPE]]
64 //
65 fixed_bool_t from_svbool_t(svbool_t type) {
66 return type;
67 }
68
69 // CHECK-LABEL: define dso_local noundef <vscale x 2 x i64> @lax_cast(
70 // CHECK-SAME: <vscale x 4 x i32> noundef [[TYPE_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {
71 // CHECK-NEXT: [[ENTRY:.*:]]
72 // CHECK-NEXT: [[TMP0:%.*]] = bitcast <vscale x 4 x i32> [[TYPE_COERCE]] to <vscale x 2 x i64>
73 // CHECK-NEXT: ret <vscale x 2 x i64> [[TMP0]]
74 //
75 svint64_t lax_cast(fixed_int32_t type) {
76 return type;
77 }
78
79 // CHECK-LABEL: define dso_local <vscale x 4 x i32> @to_svint32_t__from_gnu_int32_t(
80 // CHECK-SAME: ptr dead_on_return noundef readonly captures(none) [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] {
81 // CHECK-NEXT: [[ENTRY:.*:]]
82 // CHECK-NEXT: [[TYPE:%.*]] = load <16 x i32>, ptr [[TMP0]], align 16, !tbaa [[CHAR_TBAA6:![0-9]+]]
83 // CHECK-NEXT: [[CAST_SCALABLE:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[TYPE]], i64 0)
84 // CHECK-NEXT: ret <vscale x 4 x i32> [[CAST_SCALABLE]]
85 //
86 svint32_t to_svint32_t__from_gnu_int32_t(gnu_int32_t type) {
87 return type;
88 }
89
90 // CHECK-LABEL: define dso_local void @from_svint32_t__to_gnu_int32_t(
91 // CHECK-SAME: ptr dead_on_unwind noalias writable writeonly sret(<16 x i32>) align 16 captures(none) initializes((0, 64)) [[AGG_RESULT:%.*]], <vscale x 4 x i32> [[TYPE:%.*]]) local_unnamed_addr #[[ATTR3:[0-9]+]] {
92 // CHECK-NEXT: [[ENTRY:.*:]]
93 // CHECK-NEXT: [[CAST_FIXED:%.*]] = tail call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[TYPE]], i64 0)
94 // CHECK-NEXT: store <16 x i32> [[CAST_FIXED]], ptr [[AGG_RESULT]], align 16, !tbaa [[CHAR_TBAA6]]
95 // CHECK-NEXT: ret void
96 //
97 gnu_int32_t from_svint32_t__to_gnu_int32_t(svint32_t type) {
98 return type;
99 }
100
101 // CHECK-LABEL: define dso_local <vscale x 4 x i32> @to_fixed_int32_t__from_gnu_int32_t(
102 // CHECK-SAME: ptr dead_on_return noundef readonly captures(none) [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2]] {
103 // CHECK-NEXT: [[ENTRY:.*:]]
104 // CHECK-NEXT: [[TYPE:%.*]] = load <16 x i32>, ptr [[TMP0]], align 16, !tbaa [[CHAR_TBAA6]]
105 // CHECK-NEXT: [[CAST_SCALABLE:%.*]] = tail call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[TYPE]], i64 0)
106 // CHECK-NEXT: ret <vscale x 4 x i32> [[CAST_SCALABLE]]
107 //
108 fixed_int32_t to_fixed_int32_t__from_gnu_int32_t(gnu_int32_t type) {
109 return type;
110 }
111
112 // CHECK-LABEL: define dso_local void @from_fixed_int32_t__to_gnu_int32_t(
113 // CHECK-SAME: ptr dead_on_unwind noalias writable writeonly sret(<16 x i32>) align 16 captures(none) initializes((0, 64)) [[AGG_RESULT:%.*]], <vscale x 4 x i32> noundef [[TYPE_COERCE:%.*]]) local_unnamed_addr #[[ATTR3]] {
114 // CHECK-NEXT: [[ENTRY:.*:]]
115 // CHECK-NEXT: [[TYPE:%.*]] = tail call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[TYPE_COERCE]], i64 0)
116 // CHECK-NEXT: store <16 x i32> [[TYPE]], ptr [[AGG_RESULT]], align 16, !tbaa [[CHAR_TBAA6]]
117 // CHECK-NEXT: ret void
118 //
119 gnu_int32_t from_fixed_int32_t__to_gnu_int32_t(fixed_int32_t type) {
120 return type;
121 }
122 //.
123 // CHECK: [[META4:![0-9]+]] = !{!"omnipotent char", [[META5:![0-9]+]], i64 0}
124 // CHECK: [[META5]] = !{!"Simple C/C++ TBAA"}
125 // CHECK: [[CHAR_TBAA6]] = !{[[META4]], [[META4]], i64 0}
126 //.