1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=hwasan -S | FileCheck %s
4 target triple = "aarch64--linux-android10000"
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7 define void @load.v1i32(ptr %p) sanitize_hwaddress {
8 ; CHECK-LABEL: @load.v1i32(
9 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
10 ; CHECK-NEXT: call void @llvm.hwasan.check.memaccess.shortgranules(ptr [[DOTHWASAN_SHADOW]], ptr [[P:%.*]], i32 2)
11 ; CHECK-NEXT: [[TMP1:%.*]] = load <1 x i32>, ptr [[P]], align 4
12 ; CHECK-NEXT: ret void
14 load <1 x i32>, ptr %p
18 define void @load.v2i32(ptr %p) sanitize_hwaddress {
19 ; CHECK-LABEL: @load.v2i32(
20 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
21 ; CHECK-NEXT: call void @llvm.hwasan.check.memaccess.shortgranules(ptr [[DOTHWASAN_SHADOW]], ptr [[P:%.*]], i32 3)
22 ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i32>, ptr [[P]], align 8
23 ; CHECK-NEXT: ret void
25 load <2 x i32>, ptr %p
29 define void @load.v4i32(ptr %p) sanitize_hwaddress {
30 ; CHECK-LABEL: @load.v4i32(
31 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
32 ; CHECK-NEXT: call void @llvm.hwasan.check.memaccess.shortgranules(ptr [[DOTHWASAN_SHADOW]], ptr [[P:%.*]], i32 4)
33 ; CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[P]], align 16
34 ; CHECK-NEXT: ret void
36 load <4 x i32>, ptr %p
40 define void @load.v8i32(ptr %p) sanitize_hwaddress {
41 ; CHECK-LABEL: @load.v8i32(
42 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
43 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
44 ; CHECK-NEXT: call void @__hwasan_loadN(i64 [[TMP1]], i64 32)
45 ; CHECK-NEXT: [[TMP2:%.*]] = load <8 x i32>, ptr [[P]], align 32
46 ; CHECK-NEXT: ret void
48 load <8 x i32>, ptr %p
52 define void @load.v16i32(ptr %p) sanitize_hwaddress {
53 ; CHECK-LABEL: @load.v16i32(
54 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
55 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
56 ; CHECK-NEXT: call void @__hwasan_loadN(i64 [[TMP1]], i64 64)
57 ; CHECK-NEXT: [[TMP2:%.*]] = load <16 x i32>, ptr [[P]], align 64
58 ; CHECK-NEXT: ret void
60 load <16 x i32>, ptr %p
65 define void @store.v1i32(ptr %p) sanitize_hwaddress {
66 ; CHECK-LABEL: @store.v1i32(
67 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
68 ; CHECK-NEXT: call void @llvm.hwasan.check.memaccess.shortgranules(ptr [[DOTHWASAN_SHADOW]], ptr [[P:%.*]], i32 18)
69 ; CHECK-NEXT: store <1 x i32> zeroinitializer, ptr [[P]], align 4
70 ; CHECK-NEXT: ret void
72 store <1 x i32> zeroinitializer, ptr %p
76 define void @store.v2i32(ptr %p) sanitize_hwaddress {
77 ; CHECK-LABEL: @store.v2i32(
78 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
79 ; CHECK-NEXT: call void @llvm.hwasan.check.memaccess.shortgranules(ptr [[DOTHWASAN_SHADOW]], ptr [[P:%.*]], i32 19)
80 ; CHECK-NEXT: store <2 x i32> zeroinitializer, ptr [[P]], align 8
81 ; CHECK-NEXT: ret void
83 store <2 x i32> zeroinitializer, ptr %p
87 define void @store.v4i32(ptr %p) sanitize_hwaddress {
88 ; CHECK-LABEL: @store.v4i32(
89 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
90 ; CHECK-NEXT: call void @llvm.hwasan.check.memaccess.shortgranules(ptr [[DOTHWASAN_SHADOW]], ptr [[P:%.*]], i32 20)
91 ; CHECK-NEXT: store <4 x i32> zeroinitializer, ptr [[P]], align 16
92 ; CHECK-NEXT: ret void
94 store <4 x i32> zeroinitializer, ptr %p
98 define void @store.v8i32(ptr %p) sanitize_hwaddress {
99 ; CHECK-LABEL: @store.v8i32(
100 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
101 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
102 ; CHECK-NEXT: call void @__hwasan_storeN(i64 [[TMP1]], i64 32)
103 ; CHECK-NEXT: store <8 x i32> zeroinitializer, ptr [[P]], align 32
104 ; CHECK-NEXT: ret void
106 store <8 x i32> zeroinitializer, ptr %p
110 define void @store.v16i32(ptr %p) sanitize_hwaddress {
111 ; CHECK-LABEL: @store.v16i32(
112 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
113 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
114 ; CHECK-NEXT: call void @__hwasan_storeN(i64 [[TMP1]], i64 64)
115 ; CHECK-NEXT: store <16 x i32> zeroinitializer, ptr [[P]], align 64
116 ; CHECK-NEXT: ret void
118 store <16 x i32> zeroinitializer, ptr %p
123 define void @load.nxv1i32(ptr %p) sanitize_hwaddress {
124 ; CHECK-LABEL: @load.nxv1i32(
125 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
126 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
127 ; CHECK-NEXT: [[TMP2:%.*]] = call i64 @llvm.vscale.i64()
128 ; CHECK-NEXT: [[TMP3:%.*]] = mul i64 [[TMP2]], 32
129 ; CHECK-NEXT: [[TMP4:%.*]] = udiv i64 [[TMP3]], 8
130 ; CHECK-NEXT: call void @__hwasan_loadN(i64 [[TMP1]], i64 [[TMP4]])
131 ; CHECK-NEXT: [[TMP5:%.*]] = load <vscale x 1 x i32>, ptr [[P]], align 4
132 ; CHECK-NEXT: ret void
134 load <vscale x 1 x i32>, ptr %p
138 define void @load.nxv2i32(ptr %p) sanitize_hwaddress {
139 ; CHECK-LABEL: @load.nxv2i32(
140 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
141 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
142 ; CHECK-NEXT: [[TMP2:%.*]] = call i64 @llvm.vscale.i64()
143 ; CHECK-NEXT: [[TMP3:%.*]] = mul i64 [[TMP2]], 64
144 ; CHECK-NEXT: [[TMP4:%.*]] = udiv i64 [[TMP3]], 8
145 ; CHECK-NEXT: call void @__hwasan_loadN(i64 [[TMP1]], i64 [[TMP4]])
146 ; CHECK-NEXT: [[TMP5:%.*]] = load <vscale x 2 x i32>, ptr [[P]], align 8
147 ; CHECK-NEXT: ret void
149 load <vscale x 2 x i32>, ptr %p
153 define void @load.nxv4i32(ptr %p) sanitize_hwaddress {
154 ; CHECK-LABEL: @load.nxv4i32(
155 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
156 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
157 ; CHECK-NEXT: [[TMP2:%.*]] = call i64 @llvm.vscale.i64()
158 ; CHECK-NEXT: [[TMP3:%.*]] = mul i64 [[TMP2]], 128
159 ; CHECK-NEXT: [[TMP4:%.*]] = udiv i64 [[TMP3]], 8
160 ; CHECK-NEXT: call void @__hwasan_loadN(i64 [[TMP1]], i64 [[TMP4]])
161 ; CHECK-NEXT: [[TMP5:%.*]] = load <vscale x 4 x i32>, ptr [[P]], align 16
162 ; CHECK-NEXT: ret void
164 load <vscale x 4 x i32>, ptr %p
168 define void @load.nxv8i32(ptr %p) sanitize_hwaddress {
169 ; CHECK-LABEL: @load.nxv8i32(
170 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
171 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
172 ; CHECK-NEXT: [[TMP2:%.*]] = call i64 @llvm.vscale.i64()
173 ; CHECK-NEXT: [[TMP3:%.*]] = mul i64 [[TMP2]], 256
174 ; CHECK-NEXT: [[TMP4:%.*]] = udiv i64 [[TMP3]], 8
175 ; CHECK-NEXT: call void @__hwasan_loadN(i64 [[TMP1]], i64 [[TMP4]])
176 ; CHECK-NEXT: [[TMP5:%.*]] = load <vscale x 8 x i32>, ptr [[P]], align 32
177 ; CHECK-NEXT: ret void
179 load <vscale x 8 x i32>, ptr %p
183 define void @load.nxv16i32(ptr %p) sanitize_hwaddress {
184 ; CHECK-LABEL: @load.nxv16i32(
185 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
186 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
187 ; CHECK-NEXT: [[TMP2:%.*]] = call i64 @llvm.vscale.i64()
188 ; CHECK-NEXT: [[TMP3:%.*]] = mul i64 [[TMP2]], 512
189 ; CHECK-NEXT: [[TMP4:%.*]] = udiv i64 [[TMP3]], 8
190 ; CHECK-NEXT: call void @__hwasan_loadN(i64 [[TMP1]], i64 [[TMP4]])
191 ; CHECK-NEXT: [[TMP5:%.*]] = load <vscale x 16 x i32>, ptr [[P]], align 64
192 ; CHECK-NEXT: ret void
194 load <vscale x 16 x i32>, ptr %p
199 define void @store.nxv1i32(ptr %p) sanitize_hwaddress {
200 ; CHECK-LABEL: @store.nxv1i32(
201 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
202 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
203 ; CHECK-NEXT: [[TMP2:%.*]] = call i64 @llvm.vscale.i64()
204 ; CHECK-NEXT: [[TMP3:%.*]] = mul i64 [[TMP2]], 32
205 ; CHECK-NEXT: [[TMP4:%.*]] = udiv i64 [[TMP3]], 8
206 ; CHECK-NEXT: call void @__hwasan_storeN(i64 [[TMP1]], i64 [[TMP4]])
207 ; CHECK-NEXT: store <vscale x 1 x i32> zeroinitializer, ptr [[P]], align 4
208 ; CHECK-NEXT: ret void
210 store <vscale x 1 x i32> zeroinitializer, ptr %p
214 define void @store.nxv2i32(ptr %p) sanitize_hwaddress {
215 ; CHECK-LABEL: @store.nxv2i32(
216 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
217 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
218 ; CHECK-NEXT: [[TMP2:%.*]] = call i64 @llvm.vscale.i64()
219 ; CHECK-NEXT: [[TMP3:%.*]] = mul i64 [[TMP2]], 64
220 ; CHECK-NEXT: [[TMP4:%.*]] = udiv i64 [[TMP3]], 8
221 ; CHECK-NEXT: call void @__hwasan_storeN(i64 [[TMP1]], i64 [[TMP4]])
222 ; CHECK-NEXT: store <vscale x 2 x i32> zeroinitializer, ptr [[P]], align 8
223 ; CHECK-NEXT: ret void
225 store <vscale x 2 x i32> zeroinitializer, ptr %p
229 define void @store.nxv4i32(ptr %p) sanitize_hwaddress {
230 ; CHECK-LABEL: @store.nxv4i32(
231 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
232 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
233 ; CHECK-NEXT: [[TMP2:%.*]] = call i64 @llvm.vscale.i64()
234 ; CHECK-NEXT: [[TMP3:%.*]] = mul i64 [[TMP2]], 128
235 ; CHECK-NEXT: [[TMP4:%.*]] = udiv i64 [[TMP3]], 8
236 ; CHECK-NEXT: call void @__hwasan_storeN(i64 [[TMP1]], i64 [[TMP4]])
237 ; CHECK-NEXT: store <vscale x 4 x i32> zeroinitializer, ptr [[P]], align 16
238 ; CHECK-NEXT: ret void
240 store <vscale x 4 x i32> zeroinitializer, ptr %p
244 define void @store.nxv8i32(ptr %p) sanitize_hwaddress {
245 ; CHECK-LABEL: @store.nxv8i32(
246 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
247 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
248 ; CHECK-NEXT: [[TMP2:%.*]] = call i64 @llvm.vscale.i64()
249 ; CHECK-NEXT: [[TMP3:%.*]] = mul i64 [[TMP2]], 256
250 ; CHECK-NEXT: [[TMP4:%.*]] = udiv i64 [[TMP3]], 8
251 ; CHECK-NEXT: call void @__hwasan_storeN(i64 [[TMP1]], i64 [[TMP4]])
252 ; CHECK-NEXT: store <vscale x 8 x i32> zeroinitializer, ptr [[P]], align 32
253 ; CHECK-NEXT: ret void
255 store <vscale x 8 x i32> zeroinitializer, ptr %p
259 define void @store.nxv16i32(ptr %p) sanitize_hwaddress {
260 ; CHECK-LABEL: @store.nxv16i32(
261 ; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr @__hwasan_shadow)
262 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P:%.*]] to i64
263 ; CHECK-NEXT: [[TMP2:%.*]] = call i64 @llvm.vscale.i64()
264 ; CHECK-NEXT: [[TMP3:%.*]] = mul i64 [[TMP2]], 512
265 ; CHECK-NEXT: [[TMP4:%.*]] = udiv i64 [[TMP3]], 8
266 ; CHECK-NEXT: call void @__hwasan_storeN(i64 [[TMP1]], i64 [[TMP4]])
267 ; CHECK-NEXT: store <vscale x 16 x i32> zeroinitializer, ptr [[P]], align 64
268 ; CHECK-NEXT: ret void
270 store <vscale x 16 x i32> zeroinitializer, ptr %p