1 # RUN: llc -mtriple=aarch64 -mattr=+mte -run-pass=prologepilog %s -o - | FileCheck %s
4 declare void @llvm.aarch64.settag(i8* nocapture writeonly, i64) argmemonly nounwind writeonly "target-features"="+mte"
5 define i32 @stg16_16_16_16_ret() "target-features"="+mte" {
7 %a = alloca i8, i32 16, align 16
8 %b = alloca i8, i32 16, align 16
9 %c = alloca i8, i32 16, align 16
10 %d = alloca i8, i32 16, align 16
11 call void @llvm.aarch64.settag(i8* %a, i64 16)
12 call void @llvm.aarch64.settag(i8* %b, i64 16)
13 call void @llvm.aarch64.settag(i8* %c, i64 16)
14 call void @llvm.aarch64.settag(i8* %d, i64 16)
18 define void @stg16_store_128() "target-features"="+mte" {
20 %a = alloca i8, i32 16, align 16
21 %b = alloca i8, i32 128, align 16
22 call void @llvm.aarch64.settag(i8* %a, i64 16)
24 call void @llvm.aarch64.settag(i8* %b, i64 128)
30 # A sequence of STG with a register copy in the middle.
31 # Can be merged into ST2G + ST2G.
32 # CHECK-LABEL: name:{{.*}}stg16_16_16_16_ret
33 # CHECK-DAG: ST2Gi $sp, $sp, 2
34 # CHECK-DAG: ST2Gi $sp, $sp, 0
35 # CHECK-DAG: $w0 = COPY $wzr
36 # CHECK-DAG: RET_ReallyLR implicit killed $w0
38 name: stg16_16_16_16_ret
39 tracksRegLiveness: true
41 - { id: 0, name: a, size: 16, alignment: 16 }
42 - { id: 1, name: b, size: 16, alignment: 16 }
43 - { id: 2, name: c, size: 16, alignment: 16 }
44 - { id: 3, name: d, size: 16, alignment: 16 }
47 STGi $sp, %stack.0.a, 0 :: (store (s128) into %ir.a)
48 STGi $sp, %stack.1.b, 0 :: (store (s128) into %ir.b)
49 STGi $sp, %stack.2.c, 0 :: (store (s128) into %ir.c)
51 STGi $sp, %stack.3.d, 0 :: (store (s128) into %ir.d)
52 RET_ReallyLR implicit killed $w0
57 # A store in the middle prevents merging.
58 # CHECK-LABEL: name:{{.*}}stg16_store_128
59 # CHECK: ST2Gi $sp, $sp, 2
60 # CHECK: ST2Gi $sp, $sp, 4
61 # CHECK: ST2Gi $sp, $sp, 6
62 # CHECK: STGi $sp, $sp, 8
64 # CHECK: ST2Gi $sp, $sp, 0
68 tracksRegLiveness: true
70 - { id: 0, name: a, size: 16, alignment: 16 }
71 - { id: 1, name: b, size: 128, alignment: 16 }
74 STGi $sp, %stack.0.a, 0 :: (store (s128) into %ir.a)
75 renamable $w8 = MOVi32imm 42
76 ST2Gi $sp, %stack.1.b, 6 :: (store (s256) into %ir.b + 96, align 16)
77 ST2Gi $sp, %stack.1.b, 4 :: (store (s256) into %ir.b + 64, align 16)
78 ST2Gi $sp, %stack.1.b, 2 :: (store (s256) into %ir.b + 32, align 16)
79 STRBBui killed renamable $w8, %stack.0.a, 0 :: (store (s8) into %ir.a, align 16)
80 ST2Gi $sp, %stack.1.b, 0 :: (store (s256) into %ir.b, align 16)