1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mtriple=riscv32 -mattr=+experimental-zfbfmin -verify-machineinstrs \
3 ; RUN: -target-abi ilp32f < %s | FileCheck %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+experimental-zfbfmin -verify-machineinstrs \
5 ; RUN: -target-abi lp64f < %s | FileCheck %s
7 define bfloat @select_icmp_eq(i32 signext %a, i32 signext %b, bfloat %c, bfloat %d) {
8 ; CHECK-LABEL: select_icmp_eq:
10 ; CHECK-NEXT: beq a0, a1, .LBB0_2
11 ; CHECK-NEXT: # %bb.1:
12 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
13 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
15 ; CHECK-NEXT: .LBB0_2:
16 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
17 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
19 %1 = icmp eq i32 %a, %b
20 %2 = select i1 %1, bfloat %c, bfloat %d
24 define bfloat @select_icmp_ne(i32 signext %a, i32 signext %b, bfloat %c, bfloat %d) {
25 ; CHECK-LABEL: select_icmp_ne:
27 ; CHECK-NEXT: bne a0, a1, .LBB1_2
28 ; CHECK-NEXT: # %bb.1:
29 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
30 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
32 ; CHECK-NEXT: .LBB1_2:
33 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
34 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
36 %1 = icmp ne i32 %a, %b
37 %2 = select i1 %1, bfloat %c, bfloat %d
41 define bfloat @select_icmp_ugt(i32 signext %a, i32 signext %b, bfloat %c, bfloat %d) {
42 ; CHECK-LABEL: select_icmp_ugt:
44 ; CHECK-NEXT: bltu a1, a0, .LBB2_2
45 ; CHECK-NEXT: # %bb.1:
46 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
47 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
49 ; CHECK-NEXT: .LBB2_2:
50 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
51 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
53 %1 = icmp ugt i32 %a, %b
54 %2 = select i1 %1, bfloat %c, bfloat %d
58 define bfloat @select_icmp_uge(i32 signext %a, i32 signext %b, bfloat %c, bfloat %d) {
59 ; CHECK-LABEL: select_icmp_uge:
61 ; CHECK-NEXT: bgeu a0, a1, .LBB3_2
62 ; CHECK-NEXT: # %bb.1:
63 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
64 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
66 ; CHECK-NEXT: .LBB3_2:
67 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
68 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
70 %1 = icmp uge i32 %a, %b
71 %2 = select i1 %1, bfloat %c, bfloat %d
75 define bfloat @select_icmp_ult(i32 signext %a, i32 signext %b, bfloat %c, bfloat %d) {
76 ; CHECK-LABEL: select_icmp_ult:
78 ; CHECK-NEXT: bltu a0, a1, .LBB4_2
79 ; CHECK-NEXT: # %bb.1:
80 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
81 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
83 ; CHECK-NEXT: .LBB4_2:
84 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
85 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
87 %1 = icmp ult i32 %a, %b
88 %2 = select i1 %1, bfloat %c, bfloat %d
92 define bfloat @select_icmp_ule(i32 signext %a, i32 signext %b, bfloat %c, bfloat %d) {
93 ; CHECK-LABEL: select_icmp_ule:
95 ; CHECK-NEXT: bgeu a1, a0, .LBB5_2
96 ; CHECK-NEXT: # %bb.1:
97 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
98 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
100 ; CHECK-NEXT: .LBB5_2:
101 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
102 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
104 %1 = icmp ule i32 %a, %b
105 %2 = select i1 %1, bfloat %c, bfloat %d
109 define bfloat @select_icmp_sgt(i32 signext %a, i32 signext %b, bfloat %c, bfloat %d) {
110 ; CHECK-LABEL: select_icmp_sgt:
112 ; CHECK-NEXT: blt a1, a0, .LBB6_2
113 ; CHECK-NEXT: # %bb.1:
114 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
115 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
117 ; CHECK-NEXT: .LBB6_2:
118 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
119 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
121 %1 = icmp sgt i32 %a, %b
122 %2 = select i1 %1, bfloat %c, bfloat %d
126 define bfloat @select_icmp_sge(i32 signext %a, i32 signext %b, bfloat %c, bfloat %d) {
127 ; CHECK-LABEL: select_icmp_sge:
129 ; CHECK-NEXT: bge a0, a1, .LBB7_2
130 ; CHECK-NEXT: # %bb.1:
131 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
132 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
134 ; CHECK-NEXT: .LBB7_2:
135 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
136 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
138 %1 = icmp sge i32 %a, %b
139 %2 = select i1 %1, bfloat %c, bfloat %d
143 define bfloat @select_icmp_slt(i32 signext %a, i32 signext %b, bfloat %c, bfloat %d) {
144 ; CHECK-LABEL: select_icmp_slt:
146 ; CHECK-NEXT: blt a0, a1, .LBB8_2
147 ; CHECK-NEXT: # %bb.1:
148 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
149 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
151 ; CHECK-NEXT: .LBB8_2:
152 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
153 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
155 %1 = icmp slt i32 %a, %b
156 %2 = select i1 %1, bfloat %c, bfloat %d
160 define bfloat @select_icmp_sle(i32 signext %a, i32 signext %b, bfloat %c, bfloat %d) {
161 ; CHECK-LABEL: select_icmp_sle:
163 ; CHECK-NEXT: bge a1, a0, .LBB9_2
164 ; CHECK-NEXT: # %bb.1:
165 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa1
166 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
168 ; CHECK-NEXT: .LBB9_2:
169 ; CHECK-NEXT: fcvt.s.bf16 fa5, fa0
170 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
172 %1 = icmp sle i32 %a, %b
173 %2 = select i1 %1, bfloat %c, bfloat %d
177 define bfloat @select_icmp_slt_one(i32 signext %a) {
178 ; CHECK-LABEL: select_icmp_slt_one:
180 ; CHECK-NEXT: slti a0, a0, 1
181 ; CHECK-NEXT: fcvt.s.w fa5, a0
182 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
184 %1 = icmp slt i32 %a, 1
185 %2 = select i1 %1, bfloat 1.000000e+00, bfloat 0.000000e+00
189 define bfloat @select_icmp_sgt_zero(i32 signext %a) {
190 ; CHECK-LABEL: select_icmp_sgt_zero:
192 ; CHECK-NEXT: slti a0, a0, 1
193 ; CHECK-NEXT: fcvt.s.w fa5, a0
194 ; CHECK-NEXT: fcvt.bf16.s fa0, fa5
196 %1 = icmp sgt i32 %a, 0
197 %2 = select i1 %1, bfloat 0.000000e+00, bfloat 1.000000e+00