1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mtriple=riscv32 -mattr=+zfbfmin -verify-machineinstrs \
3 ; RUN: -target-abi ilp32f < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+zfbfmin -verify-machineinstrs \
5 ; RUN: -target-abi lp64f < %s | FileCheck %s
7 define i32 @fcmp_false(bfloat %a, bfloat %b) nounwind {
8 ; CHECK-LABEL: fcmp_false:
10 ; CHECK-NEXT: li a0, 0
12 %1 = fcmp false bfloat %a, %b
13 %2 = zext i1 %1 to i32
17 define i32 @fcmp_oeq(bfloat %a, bfloat %b) nounwind {
18 ; CHECK-LABEL: fcmp_oeq:
20 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
21 ; CHECK-NEXT: fcvt.s.bf16 fa4, fa0
22 ; CHECK-NEXT: feq.s a0, fa4, fa5
24 %1 = fcmp oeq bfloat %a, %b
25 %2 = zext i1 %1 to i32
29 define i32 @fcmp_ogt(bfloat %a, bfloat %b) nounwind {
30 ; CHECK-LABEL: fcmp_ogt:
32 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
33 ; CHECK-NEXT: fcvt.s.bf16 fa4, fa1
34 ; CHECK-NEXT: flt.s a0, fa4, fa5
36 %1 = fcmp ogt bfloat %a, %b
37 %2 = zext i1 %1 to i32
41 define i32 @fcmp_oge(bfloat %a, bfloat %b) nounwind {
42 ; CHECK-LABEL: fcmp_oge:
44 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
45 ; CHECK-NEXT: fcvt.s.bf16 fa4, fa1
46 ; CHECK-NEXT: fle.s a0, fa4, fa5
48 %1 = fcmp oge bfloat %a, %b
49 %2 = zext i1 %1 to i32
53 define i32 @fcmp_olt(bfloat %a, bfloat %b) nounwind {
54 ; CHECK-LABEL: fcmp_olt:
56 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
57 ; CHECK-NEXT: fcvt.s.bf16 fa4, fa0
58 ; CHECK-NEXT: flt.s a0, fa4, fa5
60 %1 = fcmp olt bfloat %a, %b
61 %2 = zext i1 %1 to i32
65 define i32 @fcmp_ole(bfloat %a, bfloat %b) nounwind {
66 ; CHECK-LABEL: fcmp_ole:
68 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
69 ; CHECK-NEXT: fcvt.s.bf16 fa4, fa0
70 ; CHECK-NEXT: fle.s a0, fa4, fa5
72 %1 = fcmp ole bfloat %a, %b
73 %2 = zext i1 %1 to i32
77 define i32 @fcmp_one(bfloat %a, bfloat %b) nounwind {
78 ; CHECK-LABEL: fcmp_one:
80 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
81 ; CHECK-NEXT: fcvt.s.bf16 fa4, fa0
82 ; CHECK-NEXT: flt.s a0, fa4, fa5
83 ; CHECK-NEXT: flt.s a1, fa5, fa4
84 ; CHECK-NEXT: or a0, a1, a0
86 %1 = fcmp one bfloat %a, %b
87 %2 = zext i1 %1 to i32
91 define i32 @fcmp_ord(bfloat %a, bfloat %b) nounwind {
92 ; CHECK-LABEL: fcmp_ord:
94 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
95 ; CHECK-NEXT: feq.s a0, fa5, fa5
96 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
97 ; CHECK-NEXT: feq.s a1, fa5, fa5
98 ; CHECK-NEXT: and a0, a1, a0
100 %1 = fcmp ord bfloat %a, %b
101 %2 = zext i1 %1 to i32
105 define i32 @fcmp_ueq(bfloat %a, bfloat %b) nounwind {
106 ; CHECK-LABEL: fcmp_ueq:
108 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
109 ; CHECK-NEXT: fcvt.s.bf16 fa4, fa0
110 ; CHECK-NEXT: flt.s a0, fa4, fa5
111 ; CHECK-NEXT: flt.s a1, fa5, fa4
112 ; CHECK-NEXT: or a0, a1, a0
113 ; CHECK-NEXT: xori a0, a0, 1
115 %1 = fcmp ueq bfloat %a, %b
116 %2 = zext i1 %1 to i32
120 define i32 @fcmp_ugt(bfloat %a, bfloat %b) nounwind {
121 ; CHECK-LABEL: fcmp_ugt:
123 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
124 ; CHECK-NEXT: fcvt.s.bf16 fa4, fa0
125 ; CHECK-NEXT: fle.s a0, fa4, fa5
126 ; CHECK-NEXT: xori a0, a0, 1
128 %1 = fcmp ugt bfloat %a, %b
129 %2 = zext i1 %1 to i32
133 define i32 @fcmp_uge(bfloat %a, bfloat %b) nounwind {
134 ; CHECK-LABEL: fcmp_uge:
136 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
137 ; CHECK-NEXT: fcvt.s.bf16 fa4, fa0
138 ; CHECK-NEXT: flt.s a0, fa4, fa5
139 ; CHECK-NEXT: xori a0, a0, 1
141 %1 = fcmp uge bfloat %a, %b
142 %2 = zext i1 %1 to i32
146 define i32 @fcmp_ult(bfloat %a, bfloat %b) nounwind {
147 ; CHECK-LABEL: fcmp_ult:
149 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
150 ; CHECK-NEXT: fcvt.s.bf16 fa4, fa1
151 ; CHECK-NEXT: fle.s a0, fa4, fa5
152 ; CHECK-NEXT: xori a0, a0, 1
154 %1 = fcmp ult bfloat %a, %b
155 %2 = zext i1 %1 to i32
159 define i32 @fcmp_ule(bfloat %a, bfloat %b) nounwind {
160 ; CHECK-LABEL: fcmp_ule:
162 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
163 ; CHECK-NEXT: fcvt.s.bf16 fa4, fa1
164 ; CHECK-NEXT: flt.s a0, fa4, fa5
165 ; CHECK-NEXT: xori a0, a0, 1
167 %1 = fcmp ule bfloat %a, %b
168 %2 = zext i1 %1 to i32
172 define i32 @fcmp_une(bfloat %a, bfloat %b) nounwind {
173 ; CHECK-LABEL: fcmp_une:
175 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
176 ; CHECK-NEXT: fcvt.s.bf16 fa4, fa0
177 ; CHECK-NEXT: feq.s a0, fa4, fa5
178 ; CHECK-NEXT: xori a0, a0, 1
180 %1 = fcmp une bfloat %a, %b
181 %2 = zext i1 %1 to i32
185 define i32 @fcmp_uno(bfloat %a, bfloat %b) nounwind {
186 ; CHECK-LABEL: fcmp_uno:
188 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
189 ; CHECK-NEXT: feq.s a0, fa5, fa5
190 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
191 ; CHECK-NEXT: feq.s a1, fa5, fa5
192 ; CHECK-NEXT: and a0, a1, a0
193 ; CHECK-NEXT: xori a0, a0, 1
195 %1 = fcmp uno bfloat %a, %b
196 %2 = zext i1 %1 to i32
200 define i32 @fcmp_true(bfloat %a, bfloat %b) nounwind {
201 ; CHECK-LABEL: fcmp_true:
203 ; CHECK-NEXT: li a0, 1
205 %1 = fcmp true bfloat %a, %b
206 %2 = zext i1 %1 to i32