1 ; RUN: llc < %s | FileCheck %s
3 target triple = "aarch64--linux-android"
5 define i8* @f1(i8* %x0, i8* %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: bl __hwasan_check_x1_123
12 ; CHECK-NEXT: mov x0, x1
13 ; CHECK-NEXT: ldr x30, [sp], #16
15 call void @llvm.hwasan.check.memaccess(i8* %x0, i8* %x1, i32 123)
19 define i8* @f2(i8* %x0, i8* %x1) {
21 ; CHECK: str x30, [sp, #-16]!
22 ; CHECK-NEXT: .cfi_def_cfa_offset 16
23 ; CHECK-NEXT: .cfi_offset w30, -16
24 ; CHECK-NEXT: mov x9, x1
25 ; CHECK-NEXT: bl __hwasan_check_x0_456
26 ; CHECK-NEXT: ldr x30, [sp], #16
28 call void @llvm.hwasan.check.memaccess(i8* %x1, i8* %x0, i32 456)
32 declare void @llvm.hwasan.check.memaccess(i8*, i8*, i32)
34 ; CHECK: .section .text.hot,"axG",@progbits,__hwasan_check_x0_456,comdat
35 ; CHECK-NEXT: .type __hwasan_check_x0_456,@function
36 ; CHECK-NEXT: .weak __hwasan_check_x0_456
37 ; CHECK-NEXT: .hidden __hwasan_check_x0_456
38 ; CHECK-NEXT: __hwasan_check_x0_456:
39 ; CHECK-NEXT: ubfx x16, x0, #4, #52
40 ; CHECK-NEXT: ldrb w16, [x9, x16]
41 ; CHECK-NEXT: cmp x16, x0, lsr #56
42 ; CHECK-NEXT: b.ne .Ltmp0
46 ; CHECK-NEXT: cmp w16, #15
47 ; CHECK-NEXT: b.hi .Ltmp2
48 ; CHECK-NEXT: and x17, x0, #0xf
49 ; CHECK-NEXT: add x17, x17, #255
50 ; CHECK-NEXT: cmp w16, w17
51 ; CHECK-NEXT: b.ls .Ltmp2
52 ; CHECK-NEXT: orr x16, x0, #0xf
53 ; CHECK-NEXT: ldrb w16, [x16]
54 ; CHECK-NEXT: cmp x16, x0, lsr #56
55 ; CHECK-NEXT: b.eq .Ltmp1
57 ; CHECK-NEXT: stp x0, x1, [sp, #-256]!
58 ; CHECK-NEXT: stp x29, x30, [sp, #232]
59 ; CHECK-NEXT: mov x1, #456
60 ; CHECK-NEXT: adrp x16, :got:__hwasan_tag_mismatch
61 ; CHECK-NEXT: ldr x16, [x16, :got_lo12:__hwasan_tag_mismatch]
65 ; CHECK: .section .text.hot,"axG",@progbits,__hwasan_check_x1_123,comdat
66 ; CHECK-NEXT: .type __hwasan_check_x1_123,@function
67 ; CHECK-NEXT: .weak __hwasan_check_x1_123
68 ; CHECK-NEXT: .hidden __hwasan_check_x1_123
69 ; CHECK-NEXT: __hwasan_check_x1_123:
70 ; CHECK-NEXT: ubfx x16, x1, #4, #52
71 ; CHECK-NEXT: ldrb w16, [x9, x16]
72 ; CHECK-NEXT: cmp x16, x1, lsr #56
73 ; CHECK-NEXT: b.ne .Ltmp3
77 ; CHECK-NEXT: cmp w16, #15
78 ; CHECK-NEXT: b.hi .Ltmp5
79 ; CHECK-NEXT: and x17, x1, #0xf
80 ; CHECK-NEXT: add x17, x17, #2047
81 ; CHECK-NEXT: cmp w16, w17
82 ; CHECK-NEXT: b.ls .Ltmp5
83 ; CHECK-NEXT: orr x16, x1, #0xf
84 ; CHECK-NEXT: ldrb w16, [x16]
85 ; CHECK-NEXT: cmp x16, x1, lsr #56
86 ; CHECK-NEXT: b.eq .Ltmp4
88 ; CHECK-NEXT: stp x0, x1, [sp, #-256]!
89 ; CHECK-NEXT: stp x29, x30, [sp, #232]
90 ; CHECK-NEXT: mov x0, x1
91 ; CHECK-NEXT: mov x1, #123
92 ; CHECK-NEXT: adrp x16, :got:__hwasan_tag_mismatch
93 ; CHECK-NEXT: ldr x16, [x16, :got_lo12:__hwasan_tag_mismatch]