1 ; RUN: llc -mtriple=riscv32 -verify-machineinstrs -riscv-no-aliases < %s \
2 ; RUN: | FileCheck %s --check-prefixes=CHECK,RV32
3 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs -riscv-no-aliases < %s \
4 ; RUN: | FileCheck %s --check-prefixes=CHECK,RV64
6 ; CHECK: .word 12345678
7 define void @f1(ptr noundef %x) !kcfi_type !1 {
10 ; CHECK: lw t1, -4(a0)
11 ; CHECK-NEXT: lui t2, 3014
12 ; RV32-NEXT: addi t2, t2, 334
13 ; RV64-NEXT: addiw t2, t2, 334
14 ; CHECK-NEXT: beq t1, t2, .Ltmp0
17 ; CHECK-NEXT: .section .kcfi_traps,"ao",@progbits,.text
19 ; CHECK-NEXT: .word .Ltmp1-.Ltmp2
22 ; CHECK-NEXT: jalr ra, 0(a0)
23 call void %x() [ "kcfi"(i32 12345678) ]
24 ; CHECK: lw t1, -4(s0)
25 ; CHECK-NEXT: addi t2, t2, 1234
26 ; CHECK-NEXT: beq t1, t2, .Ltmp3
29 ; CHECK-NEXT: .section .kcfi_traps,"ao",@progbits,.text
31 ; CHECK-NEXT: .word .Ltmp4-.Ltmp5
34 ; CHECK-NEXT: jalr ra, 0(s0)
35 call void %x() [ "kcfi"(i32 1234) ]
40 define void @f2(ptr noundef %x) #0 {
43 ; CHECK-NEXT: addi zero, zero, 0
44 ; CHECK-NEXT: addi zero, zero, 0
45 ; CHECK-NEXT: lw t1, -4(a0)
46 ; CHECK-NEXT: lui t2, 3014
47 ; RV32-NEXT: addi t2, t2, 334
48 ; RV64-NEXT: addiw t2, t2, 334
49 ; CHECK-NEXT: beq t1, t2, .Ltmp6
52 ; CHECK-NEXT: .section .kcfi_traps,"ao",@progbits,.text
54 ; CHECK-NEXT: .word .Ltmp7-.Ltmp8
57 ; CHECK-NEXT: jalr zero, 0(a0)
58 tail call void %x() [ "kcfi"(i32 12345678) ]
62 attributes #0 = { "patchable-function-entry"="2" }
64 !llvm.module.flags = !{!0}
65 !0 = !{i32 4, !"kcfi", i32 1}