1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=zfh -verify-machineinstrs -no-integrated-as < %s \
3 ; RUN: -target-abi=ilp32f | FileCheck -check-prefix=RV32ZFH %s
4 ; RUN: llc -mtriple=riscv64 -mattr=zfh -verify-machineinstrs -no-integrated-as < %s \
5 ; RUN: -target-abi=lp64f | FileCheck -check-prefix=RV64ZFH %s
6 ; RUN: llc -mtriple=riscv32 -mattr=zfh,+d -verify-machineinstrs -no-integrated-as < %s \
7 ; RUN: -target-abi=ilp32d | FileCheck -check-prefix=RV32DZFH %s
8 ; RUN: llc -mtriple=riscv64 -mattr=zfh,+d -verify-machineinstrs -no-integrated-as < %s \
9 ; RUN: -target-abi=lp64d | FileCheck -check-prefix=RV64DZFH %s
11 ;; `.insn 0x4, 0x04000053 | (${0:N} << 7) | (${1:N} << 15) | (${2:N} << 20)` is
12 ;; the raw encoding for `fadd.h`
14 @gh = external global half
16 define half @constraint_f_half(half %a) nounwind {
17 ; RV32ZFH-LABEL: constraint_f_half:
19 ; RV32ZFH-NEXT: lui a0, %hi(gh)
20 ; RV32ZFH-NEXT: flh fa5, %lo(gh)(a0)
22 ; RV32ZFH-NEXT: .insn 0x4, 0x04000053 | (10 << 7) | (10 << 15) | (15 << 20)
23 ; RV32ZFH-NEXT: #NO_APP
26 ; RV64ZFH-LABEL: constraint_f_half:
28 ; RV64ZFH-NEXT: lui a0, %hi(gh)
29 ; RV64ZFH-NEXT: flh fa5, %lo(gh)(a0)
31 ; RV64ZFH-NEXT: .insn 0x4, 0x04000053 | (10 << 7) | (10 << 15) | (15 << 20)
32 ; RV64ZFH-NEXT: #NO_APP
35 ; RV32DZFH-LABEL: constraint_f_half:
37 ; RV32DZFH-NEXT: lui a0, %hi(gh)
38 ; RV32DZFH-NEXT: flh fa5, %lo(gh)(a0)
40 ; RV32DZFH-NEXT: .insn 0x4, 0x04000053 | (10 << 7) | (10 << 15) | (15 << 20)
41 ; RV32DZFH-NEXT: #NO_APP
44 ; RV64DZFH-LABEL: constraint_f_half:
46 ; RV64DZFH-NEXT: lui a0, %hi(gh)
47 ; RV64DZFH-NEXT: flh fa5, %lo(gh)(a0)
49 ; RV64DZFH-NEXT: .insn 0x4, 0x04000053 | (10 << 7) | (10 << 15) | (15 << 20)
50 ; RV64DZFH-NEXT: #NO_APP
52 %1 = load half, ptr @gh
53 %2 = tail call half asm ".insn 0x4, 0x04000053 | (${0:N} << 7) | (${1:N} << 15) | (${2:N} << 20)", "=f,f,f"(half %a, half %1)
57 define half @constraint_cf_half(half %a) nounwind {
58 ; RV32ZFH-LABEL: constraint_cf_half:
60 ; RV32ZFH-NEXT: lui a0, %hi(gh)
61 ; RV32ZFH-NEXT: flh fa5, %lo(gh)(a0)
63 ; RV32ZFH-NEXT: .insn 0x4, 0x04000053 | (10 << 7) | (10 << 15) | (15 << 20)
64 ; RV32ZFH-NEXT: #NO_APP
67 ; RV64ZFH-LABEL: constraint_cf_half:
69 ; RV64ZFH-NEXT: lui a0, %hi(gh)
70 ; RV64ZFH-NEXT: flh fa5, %lo(gh)(a0)
72 ; RV64ZFH-NEXT: .insn 0x4, 0x04000053 | (10 << 7) | (10 << 15) | (15 << 20)
73 ; RV64ZFH-NEXT: #NO_APP
76 ; RV32DZFH-LABEL: constraint_cf_half:
78 ; RV32DZFH-NEXT: lui a0, %hi(gh)
79 ; RV32DZFH-NEXT: flh fa5, %lo(gh)(a0)
81 ; RV32DZFH-NEXT: .insn 0x4, 0x04000053 | (10 << 7) | (10 << 15) | (15 << 20)
82 ; RV32DZFH-NEXT: #NO_APP
85 ; RV64DZFH-LABEL: constraint_cf_half:
87 ; RV64DZFH-NEXT: lui a0, %hi(gh)
88 ; RV64DZFH-NEXT: flh fa5, %lo(gh)(a0)
90 ; RV64DZFH-NEXT: .insn 0x4, 0x04000053 | (10 << 7) | (10 << 15) | (15 << 20)
91 ; RV64DZFH-NEXT: #NO_APP
93 %1 = load half, ptr @gh
94 %2 = tail call half asm ".insn 0x4, 0x04000053 | (${0:N} << 7) | (${1:N} << 15) | (${2:N} << 20)", "=^cf,^cf,^cf"(half %a, half %1)
98 define half @constraint_f_half_abi_name(half %a) nounwind {
99 ; RV32ZFH-LABEL: constraint_f_half_abi_name:
101 ; RV32ZFH-NEXT: addi sp, sp, -16
102 ; RV32ZFH-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
103 ; RV32ZFH-NEXT: lui a0, %hi(gh)
104 ; RV32ZFH-NEXT: flh fs0, %lo(gh)(a0)
106 ; RV32ZFH-NEXT: .insn 0x4, 0x04000053 | (0 << 7) | (10 << 15) | (8 << 20)
107 ; RV32ZFH-NEXT: #NO_APP
108 ; RV32ZFH-NEXT: fmv.h fa0, ft0
109 ; RV32ZFH-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload
110 ; RV32ZFH-NEXT: addi sp, sp, 16
113 ; RV64ZFH-LABEL: constraint_f_half_abi_name:
115 ; RV64ZFH-NEXT: addi sp, sp, -16
116 ; RV64ZFH-NEXT: fsw fs0, 12(sp) # 4-byte Folded Spill
117 ; RV64ZFH-NEXT: lui a0, %hi(gh)
118 ; RV64ZFH-NEXT: flh fs0, %lo(gh)(a0)
120 ; RV64ZFH-NEXT: .insn 0x4, 0x04000053 | (0 << 7) | (10 << 15) | (8 << 20)
121 ; RV64ZFH-NEXT: #NO_APP
122 ; RV64ZFH-NEXT: fmv.h fa0, ft0
123 ; RV64ZFH-NEXT: flw fs0, 12(sp) # 4-byte Folded Reload
124 ; RV64ZFH-NEXT: addi sp, sp, 16
127 ; RV32DZFH-LABEL: constraint_f_half_abi_name:
129 ; RV32DZFH-NEXT: addi sp, sp, -16
130 ; RV32DZFH-NEXT: fsd fs0, 8(sp) # 8-byte Folded Spill
131 ; RV32DZFH-NEXT: lui a0, %hi(gh)
132 ; RV32DZFH-NEXT: flh fs0, %lo(gh)(a0)
133 ; RV32DZFH-NEXT: #APP
134 ; RV32DZFH-NEXT: .insn 0x4, 0x04000053 | (0 << 7) | (10 << 15) | (8 << 20)
135 ; RV32DZFH-NEXT: #NO_APP
136 ; RV32DZFH-NEXT: fmv.h fa0, ft0
137 ; RV32DZFH-NEXT: fld fs0, 8(sp) # 8-byte Folded Reload
138 ; RV32DZFH-NEXT: addi sp, sp, 16
141 ; RV64DZFH-LABEL: constraint_f_half_abi_name:
143 ; RV64DZFH-NEXT: addi sp, sp, -16
144 ; RV64DZFH-NEXT: fsd fs0, 8(sp) # 8-byte Folded Spill
145 ; RV64DZFH-NEXT: lui a0, %hi(gh)
146 ; RV64DZFH-NEXT: flh fs0, %lo(gh)(a0)
147 ; RV64DZFH-NEXT: #APP
148 ; RV64DZFH-NEXT: .insn 0x4, 0x04000053 | (0 << 7) | (10 << 15) | (8 << 20)
149 ; RV64DZFH-NEXT: #NO_APP
150 ; RV64DZFH-NEXT: fmv.h fa0, ft0
151 ; RV64DZFH-NEXT: fld fs0, 8(sp) # 8-byte Folded Reload
152 ; RV64DZFH-NEXT: addi sp, sp, 16
154 %1 = load half, ptr @gh
155 %2 = tail call half asm ".insn 0x4, 0x04000053 | (${0:N} << 7) | (${1:N} << 15) | (${2:N} << 20)", "={ft0},{fa0},{fs0}"(half %a, half %1)