1 ; RUN: llc < %s | FileCheck %s
3 target triple = "aarch64--linux-android"
5 define ptr @f1(ptr %x0, ptr %x1) {
7 ; CHECK: str x30, [sp, #-16]!
8 ; CHECK-NEXT: .cfi_def_cfa_offset 16
9 ; CHECK-NEXT: .cfi_offset w30, -16
10 ; CHECK-NEXT: mov x9, x0
11 ; CHECK-NEXT: mov x0, x1
12 ; CHECK-NEXT: bl __hwasan_check_x1_1
13 ; CHECK-NEXT: ldr x30, [sp], #16
15 call void @llvm.hwasan.check.memaccess(ptr %x0, ptr %x1, i32 1)
19 define ptr @f2(ptr %x0, ptr %x1) {
21 ; CHECK: stp x30, x20, [sp, #-16]!
22 ; CHECK-NEXT: .cfi_def_cfa_offset 16
23 ; CHECK-NEXT: .cfi_offset w20, -8
24 ; CHECK-NEXT: .cfi_offset w30, -16
25 ; CHECK-NEXT: mov x20, x1
26 ; CHECK-NEXT: bl __hwasan_check_x0_2_short_v2
27 ; CHECK-NEXT: ldp x30, x20, [sp], #16
29 call void @llvm.hwasan.check.memaccess.shortgranules(ptr %x1, ptr %x0, i32 2)
33 define void @f3(ptr %x0, ptr %x1) {
34 ; 0x3ff0000 (kernel, match-all = 0xff)
35 call void @llvm.hwasan.check.memaccess(ptr %x0, ptr %x1, i32 67043328)
39 define void @f4(ptr %x0, ptr %x1) {
40 ; 0x1000010 (access-size-index = 0, is-write = 1, match-all = 0x0)
41 call void @llvm.hwasan.check.memaccess.shortgranules(ptr %x0, ptr %x1, i32 16777232)
45 declare void @llvm.hwasan.check.memaccess(ptr, ptr, i32)
46 declare void @llvm.hwasan.check.memaccess.shortgranules(ptr, ptr, i32)
48 ; CHECK: .section .text.hot,"axG",@progbits,__hwasan_check_x0_2_short_v2,comdat
49 ; CHECK-NEXT: .type __hwasan_check_x0_2_short_v2,@function
50 ; CHECK-NEXT: .weak __hwasan_check_x0_2_short_v2
51 ; CHECK-NEXT: .hidden __hwasan_check_x0_2_short_v2
52 ; CHECK-NEXT: __hwasan_check_x0_2_short_v2:
53 ; CHECK-NEXT: sbfx x16, x0, #4, #52
54 ; CHECK-NEXT: ldrb w16, [x20, x16]
55 ; CHECK-NEXT: cmp x16, x0, lsr #56
56 ; CHECK-NEXT: b.ne .Ltmp0
60 ; CHECK-NEXT: cmp w16, #15
61 ; CHECK-NEXT: b.hi .Ltmp2
62 ; CHECK-NEXT: and x17, x0, #0xf
63 ; CHECK-NEXT: add x17, x17, #3
64 ; CHECK-NEXT: cmp w16, w17
65 ; CHECK-NEXT: b.ls .Ltmp2
66 ; CHECK-NEXT: orr x16, x0, #0xf
67 ; CHECK-NEXT: ldrb w16, [x16]
68 ; CHECK-NEXT: cmp x16, x0, lsr #56
69 ; CHECK-NEXT: b.eq .Ltmp1
71 ; CHECK-NEXT: stp x0, x1, [sp, #-256]!
72 ; CHECK-NEXT: stp x29, x30, [sp, #232]
73 ; CHECK-NEXT: mov x1, #2
74 ; CHECK-NEXT: adrp x16, :got:__hwasan_tag_mismatch_v2
75 ; CHECK-NEXT: ldr x16, [x16, :got_lo12:__hwasan_tag_mismatch_v2]
79 ; CHECK: .section .text.hot,"axG",@progbits,__hwasan_check_x1_1,comdat
80 ; CHECK-NEXT: .type __hwasan_check_x1_1,@function
81 ; CHECK-NEXT: .weak __hwasan_check_x1_1
82 ; CHECK-NEXT: .hidden __hwasan_check_x1_1
83 ; CHECK-NEXT: __hwasan_check_x1_1:
84 ; CHECK-NEXT: sbfx x16, x1, #4, #52
85 ; CHECK-NEXT: ldrb w16, [x9, x16]
86 ; CHECK-NEXT: cmp x16, x1, lsr #56
87 ; CHECK-NEXT: b.ne .Ltmp3
91 ; CHECK-NEXT: stp x0, x1, [sp, #-256]!
92 ; CHECK-NEXT: stp x29, x30, [sp, #232]
93 ; CHECK-NEXT: mov x0, x1
94 ; CHECK-NEXT: mov x1, #1
95 ; CHECK-NEXT: adrp x16, :got:__hwasan_tag_mismatch
96 ; CHECK-NEXT: ldr x16, [x16, :got_lo12:__hwasan_tag_mismatch]
99 ; CHECK: __hwasan_check_x1_67043328:
100 ; CHECK-NEXT: sbfx x16, x1, #4, #52
101 ; CHECK-NEXT: ldrb w16, [x9, x16]
102 ; CHECK-NEXT: cmp x16, x1, lsr #56
103 ; CHECK-NEXT: b.ne .Ltmp5
104 ; CHECK-NEXT: .Ltmp6:
106 ; CHECK-NEXT: .Ltmp5:
107 ; CHECK-NEXT: lsr x17, x1, #56
108 ; CHECK-NEXT: cmp x17, #255
109 ; CHECK-NEXT: b.eq .Ltmp6
110 ; CHECK-NEXT: stp x0, x1, [sp, #-256]!
111 ; CHECK-NEXT: stp x29, x30, [sp, #232]
112 ; CHECK-NEXT: mov x0, x1
113 ; CHECK-NEXT: mov x1, #0
114 ; CHECK-NEXT: b __hwasan_tag_mismatch
116 ; CHECK: __hwasan_check_x1_16777232_short_v2:
117 ; CHECK-NEXT: sbfx x16, x1, #4, #52
118 ; CHECK-NEXT: ldrb w16, [x20, x16]
119 ; CHECK-NEXT: cmp x16, x1, lsr #56
120 ; CHECK-NEXT: b.ne .Ltmp7
121 ; CHECK-NEXT: .Ltmp8:
123 ; CHECK-NEXT: .Ltmp7:
124 ; CHECK-NEXT: lsr x17, x1, #56
125 ; CHECK-NEXT: cmp x17, #0
126 ; CHECK-NEXT: b.eq .Ltmp8
127 ; CHECK-NEXT: cmp w16, #15
128 ; CHECK-NEXT: b.hi .Ltmp9
129 ; CHECK-NEXT: and x17, x1, #0xf
130 ; CHECK-NEXT: cmp w16, w17
131 ; CHECK-NEXT: b.ls .Ltmp9
132 ; CHECK-NEXT: orr x16, x1, #0xf
133 ; CHECK-NEXT: ldrb w16, [x16]
134 ; CHECK-NEXT: cmp x16, x1, lsr #56
135 ; CHECK-NEXT: b.eq .Ltmp8
136 ; CHECK-NEXT: .Ltmp9:
137 ; CHECK-NEXT: stp x0, x1, [sp, #-256]!
138 ; CHECK-NEXT: stp x29, x30, [sp, #232]
139 ; CHECK-NEXT: mov x0, x1
140 ; CHECK-NEXT: mov x1, #16
141 ; CHECK-NEXT: adrp x16, :got:__hwasan_tag_mismatch_v2
142 ; CHECK-NEXT: ldr x16, [x16, :got_lo12:__hwasan_tag_mismatch_v2]