1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+experimental-zfbfmin -verify-machineinstrs \
3 ; RUN: -target-abi ilp32d < %s | FileCheck -check-prefix=CHECKIZFBFMIN %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+experimental-zfbfmin -verify-machineinstrs \
5 ; RUN: -target-abi lp64d < %s | FileCheck -check-prefix=CHECKIZFBFMIN %s
7 define bfloat @bitcast_bf16_i16(i16 %a) nounwind {
8 ; CHECKIZFBFMIN-LABEL: bitcast_bf16_i16:
9 ; CHECKIZFBFMIN: # %bb.0:
10 ; CHECKIZFBFMIN-NEXT: fmv.h.x fa0, a0
11 ; CHECKIZFBFMIN-NEXT: ret
12 %1 = bitcast i16 %a to bfloat
16 define i16 @bitcast_i16_bf16(bfloat %a) nounwind {
17 ; CHECKIZFBFMIN-LABEL: bitcast_i16_bf16:
18 ; CHECKIZFBFMIN: # %bb.0:
19 ; CHECKIZFBFMIN-NEXT: fmv.x.h a0, fa0
20 ; CHECKIZFBFMIN-NEXT: ret
21 %1 = bitcast bfloat %a to i16
25 define bfloat @fcvt_bf16_s(float %a) nounwind {
26 ; CHECKIZFBFMIN-LABEL: fcvt_bf16_s:
27 ; CHECKIZFBFMIN: # %bb.0:
28 ; CHECKIZFBFMIN-NEXT: fcvt.bf16.s fa0, fa0
29 ; CHECKIZFBFMIN-NEXT: ret
30 %1 = fptrunc float %a to bfloat
34 define float @fcvt_s_bf16(bfloat %a) nounwind {
35 ; CHECKIZFBFMIN-LABEL: fcvt_s_bf16:
36 ; CHECKIZFBFMIN: # %bb.0:
37 ; CHECKIZFBFMIN-NEXT: fcvt.s.bf16 fa0, fa0
38 ; CHECKIZFBFMIN-NEXT: ret
39 %1 = fpext bfloat %a to float
43 define bfloat @fcvt_bf16_d(double %a) nounwind {
44 ; CHECKIZFBFMIN-LABEL: fcvt_bf16_d:
45 ; CHECKIZFBFMIN: # %bb.0:
46 ; CHECKIZFBFMIN-NEXT: fcvt.s.d fa5, fa0
47 ; CHECKIZFBFMIN-NEXT: fcvt.bf16.s fa0, fa5
48 ; CHECKIZFBFMIN-NEXT: ret
49 %1 = fptrunc double %a to bfloat
53 define double @fcvt_d_bf16(bfloat %a) nounwind {
54 ; CHECKIZFBFMIN-LABEL: fcvt_d_bf16:
55 ; CHECKIZFBFMIN: # %bb.0:
56 ; CHECKIZFBFMIN-NEXT: fcvt.s.bf16 fa5, fa0
57 ; CHECKIZFBFMIN-NEXT: fcvt.d.s fa0, fa5
58 ; CHECKIZFBFMIN-NEXT: ret
59 %1 = fpext bfloat %a to double
63 define bfloat @bfloat_load(ptr %a) nounwind {
64 ; CHECKIZFBFMIN-LABEL: bfloat_load:
65 ; CHECKIZFBFMIN: # %bb.0:
66 ; CHECKIZFBFMIN-NEXT: flh fa0, 6(a0)
67 ; CHECKIZFBFMIN-NEXT: ret
68 %1 = getelementptr bfloat, ptr %a, i32 3
69 %2 = load bfloat, ptr %1
73 define bfloat @bfloat_imm() nounwind {
74 ; CHECKIZFBFMIN-LABEL: bfloat_imm:
75 ; CHECKIZFBFMIN: # %bb.0:
76 ; CHECKIZFBFMIN-NEXT: lui a0, %hi(.LCPI7_0)
77 ; CHECKIZFBFMIN-NEXT: flh fa0, %lo(.LCPI7_0)(a0)
78 ; CHECKIZFBFMIN-NEXT: ret
82 define dso_local void @bfloat_store(ptr %a, bfloat %b) nounwind {
83 ; CHECKIZFBFMIN-LABEL: bfloat_store:
84 ; CHECKIZFBFMIN: # %bb.0:
85 ; CHECKIZFBFMIN-NEXT: fsh fa0, 0(a0)
86 ; CHECKIZFBFMIN-NEXT: fsh fa0, 16(a0)
87 ; CHECKIZFBFMIN-NEXT: ret
88 store bfloat %b, ptr %a
89 %1 = getelementptr bfloat, ptr %a, i32 8
90 store bfloat %b, ptr %1