1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -csky-no-aliases < %s -mtriple=csky | FileCheck %s
4 @p_fun = global void (i32, i32)* @bar, align 8
6 declare void @bar(i32, i32)
8 define void @foo(i32 %a, i32* %ptr){
10 ; CHECK: # %bb.0: # %entry
11 ; CHECK-NEXT: subi16 sp, sp, 4
12 ; CHECK-NEXT: .cfi_def_cfa_offset 4
13 ; CHECK-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
14 ; CHECK-NEXT: .cfi_offset lr, -4
15 ; CHECK-NEXT: subi16 sp, sp, 4
16 ; CHECK-NEXT: .cfi_def_cfa_offset 8
17 ; CHECK-NEXT: ld16.w a1, (a1, 0)
18 ; CHECK-NEXT: lrw32 a2, [.LCPI0_0]
19 ; CHECK-NEXT: jsr16 a2
20 ; CHECK-NEXT: addi16 sp, sp, 4
21 ; CHECK-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
22 ; CHECK-NEXT: addi16 sp, sp, 4
24 ; CHECK-NEXT: .p2align 1
25 ; CHECK-NEXT: # %bb.1:
26 ; CHECK-NEXT: .p2align 2
27 ; CHECK-NEXT: .LCPI0_0:
28 ; CHECK-NEXT: .long bar
31 %0 = load i32, i32* %ptr
32 tail call void (i32, i32) @bar(i32 %a, i32 %0)
36 define void @foo_indirect(i32 %a, i32* %ptr) {
37 ; CHECK-LABEL: foo_indirect:
38 ; CHECK: # %bb.0: # %entry
39 ; CHECK-NEXT: subi16 sp, sp, 4
40 ; CHECK-NEXT: .cfi_def_cfa_offset 4
41 ; CHECK-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
42 ; CHECK-NEXT: .cfi_offset lr, -4
43 ; CHECK-NEXT: subi16 sp, sp, 4
44 ; CHECK-NEXT: .cfi_def_cfa_offset 8
45 ; CHECK-NEXT: lrw32 a2, [.LCPI1_0]
46 ; CHECK-NEXT: ld16.w a2, (a2, 0)
47 ; CHECK-NEXT: ld16.w a1, (a1, 0)
48 ; CHECK-NEXT: jsr16 a2
49 ; CHECK-NEXT: addi16 sp, sp, 4
50 ; CHECK-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
51 ; CHECK-NEXT: addi16 sp, sp, 4
53 ; CHECK-NEXT: .p2align 1
54 ; CHECK-NEXT: # %bb.1:
55 ; CHECK-NEXT: .p2align 2
56 ; CHECK-NEXT: .LCPI1_0:
57 ; CHECK-NEXT: .long p_fun
60 %0 = load void (i32, i32)*, void (i32, i32)** @p_fun, align 8
61 %1 = load i32, i32* %ptr
62 tail call void (i32, i32) %0(i32 %a, i32 %1)