1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -target-abi=ilp32d -mattr=+v,+zfbfmin,+zvfbfmin -verify-machineinstrs < %s | FileCheck %s --check-prefixes=ZFBFMIN-ZVFBFMIN
3 ; RUN: llc -mtriple=riscv32 -target-abi=ilp32d -mattr=+v,+zvfbfmin -verify-machineinstrs < %s | FileCheck %s --check-prefixes=ZVFBFMIN
4 ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v,+zfbfmin,+zvfbfmin -verify-machineinstrs < %s | FileCheck %s --check-prefixes=ZFBFMIN-ZVFBFMIN
5 ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v,+zvfbfmin -verify-machineinstrs < %s | FileCheck %s --check-prefixes=ZVFBFMIN
7 define <8 x bfloat> @splat_v8bf16(ptr %x, bfloat %y) {
8 ; ZFBFMIN-ZVFBFMIN-LABEL: splat_v8bf16:
9 ; ZFBFMIN-ZVFBFMIN: # %bb.0:
10 ; ZFBFMIN-ZVFBFMIN-NEXT: fmv.x.h a0, fa0
11 ; ZFBFMIN-ZVFBFMIN-NEXT: vsetivli zero, 8, e16, m1, ta, ma
12 ; ZFBFMIN-ZVFBFMIN-NEXT: vmv.v.x v8, a0
13 ; ZFBFMIN-ZVFBFMIN-NEXT: ret
15 ; ZVFBFMIN-LABEL: splat_v8bf16:
17 ; ZVFBFMIN-NEXT: fmv.x.w a0, fa0
18 ; ZVFBFMIN-NEXT: vsetivli zero, 8, e16, m1, ta, ma
19 ; ZVFBFMIN-NEXT: vmv.v.x v8, a0
21 %a = insertelement <8 x bfloat> poison, bfloat %y, i32 0
22 %b = shufflevector <8 x bfloat> %a, <8 x bfloat> poison, <8 x i32> zeroinitializer
26 define <16 x bfloat> @splat_16bf16(ptr %x, bfloat %y) {
27 ; ZFBFMIN-ZVFBFMIN-LABEL: splat_16bf16:
28 ; ZFBFMIN-ZVFBFMIN: # %bb.0:
29 ; ZFBFMIN-ZVFBFMIN-NEXT: fmv.x.h a0, fa0
30 ; ZFBFMIN-ZVFBFMIN-NEXT: vsetivli zero, 16, e16, m2, ta, ma
31 ; ZFBFMIN-ZVFBFMIN-NEXT: vmv.v.x v8, a0
32 ; ZFBFMIN-ZVFBFMIN-NEXT: ret
34 ; ZVFBFMIN-LABEL: splat_16bf16:
36 ; ZVFBFMIN-NEXT: fmv.x.w a0, fa0
37 ; ZVFBFMIN-NEXT: vsetivli zero, 16, e16, m2, ta, ma
38 ; ZVFBFMIN-NEXT: vmv.v.x v8, a0
40 %a = insertelement <16 x bfloat> poison, bfloat %y, i32 0
41 %b = shufflevector <16 x bfloat> %a, <16 x bfloat> poison, <16 x i32> zeroinitializer
45 define <64 x bfloat> @splat_64bf16(ptr %x, bfloat %y) {
46 ; ZFBFMIN-ZVFBFMIN-LABEL: splat_64bf16:
47 ; ZFBFMIN-ZVFBFMIN: # %bb.0:
48 ; ZFBFMIN-ZVFBFMIN-NEXT: fmv.x.h a0, fa0
49 ; ZFBFMIN-ZVFBFMIN-NEXT: li a1, 64
50 ; ZFBFMIN-ZVFBFMIN-NEXT: vsetvli zero, a1, e16, m8, ta, ma
51 ; ZFBFMIN-ZVFBFMIN-NEXT: vmv.v.x v8, a0
52 ; ZFBFMIN-ZVFBFMIN-NEXT: ret
54 ; ZVFBFMIN-LABEL: splat_64bf16:
56 ; ZVFBFMIN-NEXT: fmv.x.w a0, fa0
57 ; ZVFBFMIN-NEXT: li a1, 64
58 ; ZVFBFMIN-NEXT: vsetvli zero, a1, e16, m8, ta, ma
59 ; ZVFBFMIN-NEXT: vmv.v.x v8, a0
61 %a = insertelement <64 x bfloat> poison, bfloat %y, i32 0
62 %b = shufflevector <64 x bfloat> %a, <64 x bfloat> poison, <64 x i32> zeroinitializer
66 define <8 x bfloat> @splat_zero_v8bf16(ptr %x) {
67 ; ZFBFMIN-ZVFBFMIN-LABEL: splat_zero_v8bf16:
68 ; ZFBFMIN-ZVFBFMIN: # %bb.0:
69 ; ZFBFMIN-ZVFBFMIN-NEXT: vsetivli zero, 8, e16, m1, ta, ma
70 ; ZFBFMIN-ZVFBFMIN-NEXT: vmv.v.i v8, 0
71 ; ZFBFMIN-ZVFBFMIN-NEXT: ret
73 ; ZVFBFMIN-LABEL: splat_zero_v8bf16:
75 ; ZVFBFMIN-NEXT: vsetivli zero, 8, e16, m1, ta, ma
76 ; ZVFBFMIN-NEXT: vmv.v.i v8, 0
78 ret <8 x bfloat> splat (bfloat 0.0)
81 define <16 x bfloat> @splat_zero_16bf16(ptr %x) {
82 ; ZFBFMIN-ZVFBFMIN-LABEL: splat_zero_16bf16:
83 ; ZFBFMIN-ZVFBFMIN: # %bb.0:
84 ; ZFBFMIN-ZVFBFMIN-NEXT: vsetivli zero, 16, e16, m2, ta, ma
85 ; ZFBFMIN-ZVFBFMIN-NEXT: vmv.v.i v8, 0
86 ; ZFBFMIN-ZVFBFMIN-NEXT: ret
88 ; ZVFBFMIN-LABEL: splat_zero_16bf16:
90 ; ZVFBFMIN-NEXT: vsetivli zero, 16, e16, m2, ta, ma
91 ; ZVFBFMIN-NEXT: vmv.v.i v8, 0
93 ret <16 x bfloat> splat (bfloat 0.0)
96 define <8 x bfloat> @splat_negzero_v8bf16(ptr %x) {
97 ; ZFBFMIN-ZVFBFMIN-LABEL: splat_negzero_v8bf16:
98 ; ZFBFMIN-ZVFBFMIN: # %bb.0:
99 ; ZFBFMIN-ZVFBFMIN-NEXT: lui a0, 1048568
100 ; ZFBFMIN-ZVFBFMIN-NEXT: vsetivli zero, 8, e16, m1, ta, ma
101 ; ZFBFMIN-ZVFBFMIN-NEXT: vmv.v.x v8, a0
102 ; ZFBFMIN-ZVFBFMIN-NEXT: ret
104 ; ZVFBFMIN-LABEL: splat_negzero_v8bf16:
106 ; ZVFBFMIN-NEXT: lui a0, 1048568
107 ; ZVFBFMIN-NEXT: vsetivli zero, 8, e16, m1, ta, ma
108 ; ZVFBFMIN-NEXT: vmv.v.x v8, a0
110 ret <8 x bfloat> splat (bfloat -0.0)
113 define <16 x bfloat> @splat_negzero_16bf16(ptr %x) {
114 ; ZFBFMIN-ZVFBFMIN-LABEL: splat_negzero_16bf16:
115 ; ZFBFMIN-ZVFBFMIN: # %bb.0:
116 ; ZFBFMIN-ZVFBFMIN-NEXT: lui a0, 1048568
117 ; ZFBFMIN-ZVFBFMIN-NEXT: vsetivli zero, 16, e16, m2, ta, ma
118 ; ZFBFMIN-ZVFBFMIN-NEXT: vmv.v.x v8, a0
119 ; ZFBFMIN-ZVFBFMIN-NEXT: ret
121 ; ZVFBFMIN-LABEL: splat_negzero_16bf16:
123 ; ZVFBFMIN-NEXT: lui a0, 1048568
124 ; ZVFBFMIN-NEXT: vsetivli zero, 16, e16, m2, ta, ma
125 ; ZVFBFMIN-NEXT: vmv.v.x v8, a0
127 ret <16 x bfloat> splat (bfloat -0.0)