1 ; RUN: llc -mtriple=aarch64-- -verify-machineinstrs < %s | FileCheck %s --check-prefix=ASM
2 ; RUN: llc -mtriple=aarch64-- -verify-machineinstrs -stop-after=finalize-isel < %s | FileCheck %s --check-prefixes=MIR,ISEL
3 ; RUN: llc -mtriple=aarch64-- -verify-machineinstrs -stop-after=kcfi < %s | FileCheck %s --check-prefixes=MIR,KCFI
6 define void @f1(ptr noundef %x) #1 !kcfi_type !2 {
9 ; ASM: ldur w16, [x0, #-4]
10 ; ASM-NEXT: movk w17, #24910
11 ; ASM-NEXT: movk w17, #188, lsl #16
12 ; ASM-NEXT: cmp w16, w17
13 ; ASM-NEXT: b.eq .Ltmp0
14 ; ASM-NEXT: brk #0x8220
21 ; ISEL: BLR %0, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, cfi-type 12345678
23 ; KCFI: BUNDLE{{.*}} {
24 ; KCFI-NEXT: KCFI_CHECK $x0, 12345678, implicit-def $x9, implicit-def $x16, implicit-def $x17, implicit-def $nzcv
25 ; KCFI-NEXT: BLR killed $x0, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp
28 call void %x() [ "kcfi"(i32 12345678) ]
33 define void @f2(ptr noundef %x) #1 !kcfi_type !2 {
36 ; ASM: ldur w16, [x0, #-4]
37 ; ASM-NEXT: movk w17, #24910
38 ; ASM-NEXT: movk w17, #188, lsl #16
39 ; ASM-NEXT: cmp w16, w17
40 ; ASM-NEXT: b.eq .Ltmp1
41 ; ASM-NEXT: brk #0x8220
48 ; ISEL: BLR_BTI %0, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, cfi-type 12345678
50 ; KCFI: BUNDLE{{.*}} {
51 ; KCFI-NEXT: KCFI_CHECK $x0, 12345678, implicit-def $x9, implicit-def $x16, implicit-def $x17, implicit-def $nzcv
52 ; KCFI-NEXT: BLR killed $x0, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit-def dead $lr, implicit $sp, implicit-def $sp
56 call void %x() #0 [ "kcfi"(i32 12345678) ]
61 define void @f3(ptr noundef %x) #1 {
64 ; ASM: ldur w9, [x16, #-4]
65 ; ASM-NEXT: movk w17, #24910
66 ; ASM-NEXT: movk w17, #188, lsl #16
67 ; ASM-NEXT: cmp w9, w17
68 ; ASM-NEXT: b.eq .Ltmp2
69 ; ASM-NEXT: brk #0x8230
76 ; ISEL: TCRETURNrix16x17 %1, 0, csr_aarch64_aapcs, implicit $sp, cfi-type 12345678
78 ; KCFI: BUNDLE{{.*}} {
79 ; KCFI-NEXT: KCFI_CHECK $x16, 12345678, implicit-def $x9, implicit-def $x16, implicit-def $x17, implicit-def $nzcv
80 ; KCFI-NEXT: TCRETURNrix16x17 internal killed $x16, 0, csr_aarch64_aapcs, implicit $sp
83 tail call void %x() [ "kcfi"(i32 12345678) ]
87 attributes #0 = { returns_twice }
88 attributes #1 = { "branch-target-enforcement" }
90 !llvm.module.flags = !{!0, !1}
91 !0 = !{i32 8, !"branch-target-enforcement", i32 1}
92 !1 = !{i32 4, !"kcfi", i32 1}