1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mtriple=riscv32 -mattr=+f,+zcmp -target-abi ilp32f -verify-machineinstrs < %s | FileCheck %s --check-prefix=RV32
3 ; RUN: llc -mtriple=riscv64 -mattr=+f,+zcmp -target-abi lp64f -verify-machineinstrs < %s | FileCheck %s --check-prefix=RV64
7 ; Test the file could be compiled successfully.
8 define float @foo(float %arg) {
10 ; RV32: # %bb.0: # %entry
11 ; RV32-NEXT: cm.push {ra}, -32
12 ; RV32-NEXT: .cfi_def_cfa_offset 32
13 ; RV32-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
14 ; RV32-NEXT: .cfi_offset ra, -4
15 ; RV32-NEXT: .cfi_offset fs0, -20
16 ; RV32-NEXT: fmv.s fs0, fa0
17 ; RV32-NEXT: call callee
18 ; RV32-NEXT: fmv.s fa0, fs0
19 ; RV32-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload
20 ; RV32-NEXT: cm.popret {ra}, 32
23 ; RV64: # %bb.0: # %entry
24 ; RV64-NEXT: cm.push {ra}, -32
25 ; RV64-NEXT: .cfi_def_cfa_offset 32
26 ; RV64-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
27 ; RV64-NEXT: .cfi_offset ra, -8
28 ; RV64-NEXT: .cfi_offset fs0, -20
29 ; RV64-NEXT: fmv.s fs0, fa0
30 ; RV64-NEXT: call callee
31 ; RV64-NEXT: fmv.s fa0, fs0
32 ; RV64-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload
33 ; RV64-NEXT: cm.popret {ra}, 32
39 define void @foo2(i32 %x, float %y) {
41 ; RV32: # %bb.0: # %entry
42 ; RV32-NEXT: cm.push {ra, s0}, -32
43 ; RV32-NEXT: .cfi_def_cfa_offset 32
44 ; RV32-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
45 ; RV32-NEXT: .cfi_offset ra, -8
46 ; RV32-NEXT: .cfi_offset s0, -4
47 ; RV32-NEXT: .cfi_offset fs0, -20
48 ; RV32-NEXT: fmv.s fs0, fa0
49 ; RV32-NEXT: mv s0, a0
51 ; RV32-NEXT: mv a0, s0
52 ; RV32-NEXT: fmv.s fa0, fs0
53 ; RV32-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload
54 ; RV32-NEXT: cm.pop {ra, s0}, 32
55 ; RV32-NEXT: tail func
58 ; RV64: # %bb.0: # %entry
59 ; RV64-NEXT: cm.push {ra, s0}, -32
60 ; RV64-NEXT: .cfi_def_cfa_offset 32
61 ; RV64-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
62 ; RV64-NEXT: .cfi_offset ra, -16
63 ; RV64-NEXT: .cfi_offset s0, -8
64 ; RV64-NEXT: .cfi_offset fs0, -20
65 ; RV64-NEXT: fmv.s fs0, fa0
66 ; RV64-NEXT: mv s0, a0
68 ; RV64-NEXT: mv a0, s0
69 ; RV64-NEXT: fmv.s fa0, fs0
70 ; RV64-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload
71 ; RV64-NEXT: cm.pop {ra, s0}, 32
72 ; RV64-NEXT: tail func
75 tail call void @func(i32 %x, float %y)
80 declare void @func(i32, float)