1 ; RUN: llc < %s -mtriple=aarch64 -mattr=+mte | FileCheck %s
3 define void @stg1(i8* %p) {
8 call void @llvm.aarch64.settag(i8* %p, i64 16)
12 define void @stg2(i8* %p) {
15 ; CHECK: st2g x0, [x0]
17 call void @llvm.aarch64.settag(i8* %p, i64 32)
21 define void @stg3(i8* %p) {
24 ; CHECK: stg x0, [x0, #32]
25 ; CHECK: st2g x0, [x0]
27 call void @llvm.aarch64.settag(i8* %p, i64 48)
31 define void @stg4(i8* %p) {
34 ; CHECK: st2g x0, [x0, #32]
35 ; CHECK: st2g x0, [x0]
37 call void @llvm.aarch64.settag(i8* %p, i64 64)
41 define void @stg5(i8* %p) {
44 ; CHECK: stg x0, [x0, #64]
45 ; CHECK: st2g x0, [x0, #32]
46 ; CHECK: st2g x0, [x0]
48 call void @llvm.aarch64.settag(i8* %p, i64 80)
52 define void @stg16(i8* %p) {
55 ; CHECK: mov {{(w|x)}}[[R:[0-9]+]], #256
56 ; CHECK: st2g x0, [x0], #32
57 ; CHECK: sub x[[R]], x[[R]], #32
60 call void @llvm.aarch64.settag(i8* %p, i64 256)
64 define void @stg17(i8* %p) {
67 ; CHECK: mov {{(w|x)}}[[R:[0-9]+]], #256
68 ; CHECK: stg x0, [x0], #16
69 ; CHECK: st2g x0, [x0], #32
70 ; CHECK: sub x[[R]], x[[R]], #32
73 call void @llvm.aarch64.settag(i8* %p, i64 272)
77 define void @stzg3(i8* %p) {
80 ; CHECK: stzg x0, [x0, #32]
81 ; CHECK: stz2g x0, [x0]
83 call void @llvm.aarch64.settag.zero(i8* %p, i64 48)
87 define void @stzg17(i8* %p) {
89 ; CHECK-LABEL: stzg17:
90 ; CHECK: mov {{w|x}}[[R:[0-9]+]], #256
91 ; CHECK: stzg x0, [x0], #16
92 ; CHECK: stz2g x0, [x0], #32
93 ; CHECK: sub x[[R]], x[[R]], #32
96 call void @llvm.aarch64.settag.zero(i8* %p, i64 272)
100 define void @stg_alloca1() {
102 ; CHECK-LABEL: stg_alloca1:
103 ; CHECK: stg sp, [sp]
105 %a = alloca i8, i32 16, align 16
106 call void @llvm.aarch64.settag(i8* %a, i64 16)
110 define void @stg_alloca5() {
112 ; CHECK-LABEL: stg_alloca5:
113 ; CHECK: stg sp, [sp, #64]
114 ; CHECK: st2g sp, [sp, #32]
115 ; CHECK: st2g sp, [sp]
117 %a = alloca i8, i32 80, align 16
118 call void @llvm.aarch64.settag(i8* %a, i64 80)
122 define void @stg_alloca17() {
124 ; CHECK-LABEL: stg_alloca17:
125 ; CHECK: mov [[P:x[0-9]+]], sp
126 ; CHECK: stg [[P]], {{\[}}[[P]]{{\]}}, #16
127 ; CHECK: mov {{w|x}}[[R:[0-9]+]], #256
128 ; CHECK: st2g [[P]], {{\[}}[[P]]{{\]}}, #32
129 ; CHECK: sub x[[R]], x[[R]], #32
130 ; CHECK: cbnz x[[R]],
132 %a = alloca i8, i32 272, align 16
133 call void @llvm.aarch64.settag(i8* %a, i64 272)
137 declare void @llvm.aarch64.settag(i8* %p, i64 %a)
138 declare void @llvm.aarch64.settag.zero(i8* %p, i64 %a)