1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
; RUN: llc -mtriple=riscv32 -mattr=+f,+experimental-xqccmp -target-abi ilp32f -verify-machineinstrs < %s | FileCheck %s --check-prefix=XQCCMP32
; RUN: llc -mtriple=riscv64 -mattr=+f,+experimental-xqccmp -target-abi lp64f -verify-machineinstrs < %s | FileCheck %s --check-prefix=XQCCMP64
declare void @callee()
; Test the file could be compiled successfully.
define float @foo(float %arg) {
; XQCCMP32-LABEL: foo:
; XQCCMP32: # %bb.0: # %entry
; XQCCMP32-NEXT: qc.cm.push {ra}, -32
; XQCCMP32-NEXT: .cfi_def_cfa_offset 32
; XQCCMP32-NEXT: .cfi_offset ra, -4
; XQCCMP32-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
; XQCCMP32-NEXT: .cfi_offset fs0, -20
; XQCCMP32-NEXT: fmv.s fs0, fa0
; XQCCMP32-NEXT: call callee
; XQCCMP32-NEXT: fmv.s fa0, fs0
; XQCCMP32-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload
; XQCCMP32-NEXT: .cfi_restore fs0
; XQCCMP32-NEXT: qc.cm.popret {ra}, 32
;
; XQCCMP64-LABEL: foo:
; XQCCMP64: # %bb.0: # %entry
; XQCCMP64-NEXT: qc.cm.push {ra}, -32
; XQCCMP64-NEXT: .cfi_def_cfa_offset 32
; XQCCMP64-NEXT: .cfi_offset ra, -8
; XQCCMP64-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
; XQCCMP64-NEXT: .cfi_offset fs0, -20
; XQCCMP64-NEXT: fmv.s fs0, fa0
; XQCCMP64-NEXT: call callee
; XQCCMP64-NEXT: fmv.s fa0, fs0
; XQCCMP64-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload
; XQCCMP64-NEXT: .cfi_restore fs0
; XQCCMP64-NEXT: qc.cm.popret {ra}, 32
entry:
call void @callee()
ret float %arg
}
define void @foo2(i32 %x, float %y) {
; XQCCMP32-LABEL: foo2:
; XQCCMP32: # %bb.0: # %entry
; XQCCMP32-NEXT: qc.cm.push {ra, s0}, -32
; XQCCMP32-NEXT: .cfi_def_cfa_offset 32
; XQCCMP32-NEXT: .cfi_offset ra, -4
; XQCCMP32-NEXT: .cfi_offset s0, -8
; XQCCMP32-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
; XQCCMP32-NEXT: .cfi_offset fs0, -20
; XQCCMP32-NEXT: fmv.s fs0, fa0
; XQCCMP32-NEXT: mv s0, a0
; XQCCMP32-NEXT: call bar
; XQCCMP32-NEXT: mv a0, s0
; XQCCMP32-NEXT: fmv.s fa0, fs0
; XQCCMP32-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload
; XQCCMP32-NEXT: .cfi_restore fs0
; XQCCMP32-NEXT: qc.cm.pop {ra, s0}, 32
; XQCCMP32-NEXT: .cfi_restore ra
; XQCCMP32-NEXT: .cfi_restore s0
; XQCCMP32-NEXT: .cfi_def_cfa_offset 0
; XQCCMP32-NEXT: tail func
;
; XQCCMP64-LABEL: foo2:
; XQCCMP64: # %bb.0: # %entry
; XQCCMP64-NEXT: qc.cm.push {ra, s0}, -32
; XQCCMP64-NEXT: .cfi_def_cfa_offset 32
; XQCCMP64-NEXT: .cfi_offset ra, -8
; XQCCMP64-NEXT: .cfi_offset s0, -16
; XQCCMP64-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
; XQCCMP64-NEXT: .cfi_offset fs0, -20
; XQCCMP64-NEXT: fmv.s fs0, fa0
; XQCCMP64-NEXT: mv s0, a0
; XQCCMP64-NEXT: call bar
; XQCCMP64-NEXT: mv a0, s0
; XQCCMP64-NEXT: fmv.s fa0, fs0
; XQCCMP64-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload
; XQCCMP64-NEXT: .cfi_restore fs0
; XQCCMP64-NEXT: qc.cm.pop {ra, s0}, 32
; XQCCMP64-NEXT: .cfi_restore ra
; XQCCMP64-NEXT: .cfi_restore s0
; XQCCMP64-NEXT: .cfi_def_cfa_offset 0
; XQCCMP64-NEXT: tail func
entry:
tail call void @bar()
tail call void @func(i32 %x, float %y)
ret void
}
declare void @bar()
declare void @func(i32, float)
|