1 ; RUN: llc < %s -mtriple=aarch64 -mattr=+mte -aarch64-order-frame-objects=0 | FileCheck %s
3 declare void @use(i8* %p)
4 declare void @llvm.aarch64.settag(i8* %p, i64 %a)
5 declare void @llvm.aarch64.settag.zero(i8* %p, i64 %a)
7 define void @stg16_16() {
9 ; CHECK-LABEL: stg16_16:
10 ; CHECK: st2g sp, [sp], #32
12 %a = alloca i8, i32 16, align 16
13 %b = alloca i8, i32 16, align 16
14 call void @llvm.aarch64.settag(i8* %a, i64 16)
15 call void @llvm.aarch64.settag(i8* %b, i64 16)
19 define i32 @stg16_16_16_16_ret() {
21 ; CHECK-LABEL: stg16_16_16_16_ret:
22 ; CHECK: st2g sp, [sp, #32]
23 ; CHECK: st2g sp, [sp], #64
26 %a = alloca i8, i32 16, align 16
27 %b = alloca i8, i32 16, align 16
28 %c = alloca i8, i32 16, align 16
29 %d = alloca i8, i32 16, align 16
30 call void @llvm.aarch64.settag(i8* %a, i64 16)
31 call void @llvm.aarch64.settag(i8* %b, i64 16)
32 call void @llvm.aarch64.settag(i8* %c, i64 16)
33 call void @llvm.aarch64.settag(i8* %d, i64 16)
37 define void @stg16_16_16_16() {
39 ; CHECK-LABEL: stg16_16_16_16:
40 ; CHECK: st2g sp, [sp, #32]
41 ; CHECK: st2g sp, [sp], #64
43 %a = alloca i8, i32 16, align 16
44 %b = alloca i8, i32 16, align 16
45 %c = alloca i8, i32 16, align 16
46 %d = alloca i8, i32 16, align 16
47 call void @llvm.aarch64.settag(i8* %a, i64 16)
48 call void @llvm.aarch64.settag(i8* %b, i64 16)
49 call void @llvm.aarch64.settag(i8* %c, i64 16)
50 call void @llvm.aarch64.settag(i8* %d, i64 16)
54 define void @stg128_128_128_128() {
56 ; CHECK-LABEL: stg128_128_128_128:
58 ; CHECK: st2g sp, [sp], #32
59 ; CHECK: sub x8, x8, #32
62 %a = alloca i8, i32 128, align 16
63 %b = alloca i8, i32 128, align 16
64 %c = alloca i8, i32 128, align 16
65 %d = alloca i8, i32 128, align 16
66 call void @llvm.aarch64.settag(i8* %a, i64 128)
67 call void @llvm.aarch64.settag(i8* %b, i64 128)
68 call void @llvm.aarch64.settag(i8* %c, i64 128)
69 call void @llvm.aarch64.settag(i8* %d, i64 128)
73 define void @stg16_512_16() {
75 ; CHECK-LABEL: stg16_512_16:
77 ; CHECK: st2g sp, [sp], #32
78 ; CHECK: sub x8, x8, #32
81 %a = alloca i8, i32 16, align 16
82 %b = alloca i8, i32 512, align 16
83 %c = alloca i8, i32 16, align 16
84 call void @llvm.aarch64.settag(i8* %a, i64 16)
85 call void @llvm.aarch64.settag(i8* %b, i64 512)
86 call void @llvm.aarch64.settag(i8* %c, i64 16)
90 define void @stg512_512_512() {
92 ; CHECK-LABEL: stg512_512_512:
93 ; CHECK: mov x8, #1536
94 ; CHECK: st2g sp, [sp], #32
95 ; CHECK: sub x8, x8, #32
98 %a = alloca i8, i32 512, align 16
99 %b = alloca i8, i32 512, align 16
100 %c = alloca i8, i32 512, align 16
101 call void @llvm.aarch64.settag(i8* %a, i64 512)
102 call void @llvm.aarch64.settag(i8* %b, i64 512)
103 call void @llvm.aarch64.settag(i8* %c, i64 512)
107 define void @early(i1 %flag) {
109 ; CHECK-LABEL: early:
110 ; CHECK: tbz w0, #0, [[LABEL:.LBB.*]]
111 ; CHECK: st2g sp, [sp, #
112 ; CHECK: st2g sp, [sp, #
113 ; CHECK: st2g sp, [sp, #
115 ; CHECK: stg sp, [sp, #
116 ; CHECK: st2g sp, [sp], #
118 %a = alloca i8, i32 48, align 16
119 %b = alloca i8, i32 48, align 16
120 %c = alloca i8, i32 48, align 16
121 br i1 %flag, label %if.then, label %if.end
124 call void @llvm.aarch64.settag(i8* %a, i64 48)
125 call void @llvm.aarch64.settag(i8* %b, i64 48)
129 call void @llvm.aarch64.settag(i8* %c, i64 48)
133 define void @early_128_128(i1 %flag) {
135 ; CHECK-LABEL: early_128_128:
136 ; CHECK: tbz w0, #0, [[LABEL:.LBB.*]]
137 ; CHECK: add x9, sp, #
138 ; CHECK: mov x8, #256
139 ; CHECK: st2g x9, [x9], #32
140 ; CHECK: sub x8, x8, #32
143 ; CHECK: stg sp, [sp, #
144 ; CHECK: st2g sp, [sp], #
146 %a = alloca i8, i32 128, align 16
147 %b = alloca i8, i32 128, align 16
148 %c = alloca i8, i32 48, align 16
149 br i1 %flag, label %if.then, label %if.end
152 call void @llvm.aarch64.settag(i8* %a, i64 128)
153 call void @llvm.aarch64.settag(i8* %b, i64 128)
157 call void @llvm.aarch64.settag(i8* %c, i64 48)
161 define void @early_512_512(i1 %flag) {
163 ; CHECK-LABEL: early_512_512:
164 ; CHECK: tbz w0, #0, [[LABEL:.LBB.*]]
165 ; CHECK: add x9, sp, #
166 ; CHECK: mov x8, #1024
167 ; CHECK: st2g x9, [x9], #32
168 ; CHECK: sub x8, x8, #32
171 ; CHECK: stg sp, [sp, #
172 ; CHECK: st2g sp, [sp], #
174 %a = alloca i8, i32 512, align 16
175 %b = alloca i8, i32 512, align 16
176 %c = alloca i8, i32 48, align 16
177 br i1 %flag, label %if.then, label %if.end
180 call void @llvm.aarch64.settag(i8* %a, i64 512)
181 call void @llvm.aarch64.settag(i8* %b, i64 512)
185 call void @llvm.aarch64.settag(i8* %c, i64 48)
189 ; Two loops of size 256; the second loop updates SP.
190 define void @stg128_128_gap_128_128() {
192 ; CHECK-LABEL: stg128_128_gap_128_128:
194 ; CHECK: mov x8, #256
195 ; CHECK: st2g x9, [x9], #32
196 ; CHECK: sub x8, x8, #32
198 ; CHECK: mov x8, #256
199 ; CHECK: st2g sp, [sp], #32
200 ; CHECK: sub x8, x8, #32
203 %a = alloca i8, i32 128, align 16
204 %a2 = alloca i8, i32 128, align 16
205 %b = alloca i8, i32 32, align 16
206 %c = alloca i8, i32 128, align 16
207 %c2 = alloca i8, i32 128, align 16
208 call void @use(i8* %b)
209 call void @llvm.aarch64.settag(i8* %a, i64 128)
210 call void @llvm.aarch64.settag(i8* %a2, i64 128)
211 call void @llvm.aarch64.settag(i8* %c, i64 128)
212 call void @llvm.aarch64.settag(i8* %c2, i64 128)