1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/CodeGen/RISCV/rvv/vsplats-fp.ll
Craig Topper 3d305910a9 [RISCV] Adjust RISCVInstrInfoVSDPatterns.td for different pseudo instructions for different FPR.
Move the Suffix string into the VTypeInfo class so we don't need a helper class to get to it.

Adjust pseudo naming scheme for FPRs to put F16/F32/F64 in
place of F in the pseudo instruction name rather than as a suffix.
This avoids special cases like VFMERGE from the original patch.

Differential Revision: https://reviews.llvm.org/D95404
2021-01-26 01:00:50 -08:00

108 lines
3.9 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -mattr=+f,+d,+experimental-zfh,+experimental-v -target-abi ilp32d -verify-machineinstrs < %s \
; RUN: | FileCheck %s --check-prefix=RV32V
; RUN: llc -mtriple=riscv64 -mattr=+f,+d,+experimental-zfh,+experimental-v -target-abi lp64d -verify-machineinstrs < %s \
; RUN: | FileCheck %s --check-prefix=RV64V
define <vscale x 8 x half> @vsplat_nxv8f16(half %f) {
; RV32V-LABEL: vsplat_nxv8f16:
; RV32V: # %bb.0:
; RV32V-NEXT: vsetvli a0, zero, e16,m2,ta,mu
; RV32V-NEXT: vfmv.v.f v8, fa0
; RV32V-NEXT: ret
;
; RV64V-LABEL: vsplat_nxv8f16:
; RV64V: # %bb.0:
; RV64V-NEXT: vsetvli a0, zero, e16,m2,ta,mu
; RV64V-NEXT: vfmv.v.f v8, fa0
; RV64V-NEXT: ret
%head = insertelement <vscale x 8 x half> undef, half %f, i32 0
%splat = shufflevector <vscale x 8 x half> %head, <vscale x 8 x half> undef, <vscale x 8 x i32> zeroinitializer
ret <vscale x 8 x half> %splat
}
define <vscale x 8 x half> @vsplat_zero_nxv8f16() {
; RV32V-LABEL: vsplat_zero_nxv8f16:
; RV32V: # %bb.0:
; RV32V-NEXT: vsetvli a0, zero, e16,m2,ta,mu
; RV32V-NEXT: vmv.v.i v8, 0
; RV32V-NEXT: ret
;
; RV64V-LABEL: vsplat_zero_nxv8f16:
; RV64V: # %bb.0:
; RV64V-NEXT: vsetvli a0, zero, e16,m2,ta,mu
; RV64V-NEXT: vmv.v.i v8, 0
; RV64V-NEXT: ret
%head = insertelement <vscale x 8 x half> undef, half zeroinitializer, i32 0
%splat = shufflevector <vscale x 8 x half> %head, <vscale x 8 x half> undef, <vscale x 8 x i32> zeroinitializer
ret <vscale x 8 x half> %splat
}
define <vscale x 8 x float> @vsplat_nxv8f32(float %f) {
; RV32V-LABEL: vsplat_nxv8f32:
; RV32V: # %bb.0:
; RV32V-NEXT: vsetvli a0, zero, e32,m4,ta,mu
; RV32V-NEXT: vfmv.v.f v8, fa0
; RV32V-NEXT: ret
;
; RV64V-LABEL: vsplat_nxv8f32:
; RV64V: # %bb.0:
; RV64V-NEXT: vsetvli a0, zero, e32,m4,ta,mu
; RV64V-NEXT: vfmv.v.f v8, fa0
; RV64V-NEXT: ret
%head = insertelement <vscale x 8 x float> undef, float %f, i32 0
%splat = shufflevector <vscale x 8 x float> %head, <vscale x 8 x float> undef, <vscale x 8 x i32> zeroinitializer
ret <vscale x 8 x float> %splat
}
define <vscale x 8 x float> @vsplat_zero_nxv8f32() {
; RV32V-LABEL: vsplat_zero_nxv8f32:
; RV32V: # %bb.0:
; RV32V-NEXT: vsetvli a0, zero, e32,m4,ta,mu
; RV32V-NEXT: vmv.v.i v8, 0
; RV32V-NEXT: ret
;
; RV64V-LABEL: vsplat_zero_nxv8f32:
; RV64V: # %bb.0:
; RV64V-NEXT: vsetvli a0, zero, e32,m4,ta,mu
; RV64V-NEXT: vmv.v.i v8, 0
; RV64V-NEXT: ret
%head = insertelement <vscale x 8 x float> undef, float zeroinitializer, i32 0
%splat = shufflevector <vscale x 8 x float> %head, <vscale x 8 x float> undef, <vscale x 8 x i32> zeroinitializer
ret <vscale x 8 x float> %splat
}
define <vscale x 8 x double> @vsplat_nxv8f64(double %f) {
; RV32V-LABEL: vsplat_nxv8f64:
; RV32V: # %bb.0:
; RV32V-NEXT: vsetvli a0, zero, e64,m8,ta,mu
; RV32V-NEXT: vfmv.v.f v8, fa0
; RV32V-NEXT: ret
;
; RV64V-LABEL: vsplat_nxv8f64:
; RV64V: # %bb.0:
; RV64V-NEXT: vsetvli a0, zero, e64,m8,ta,mu
; RV64V-NEXT: vfmv.v.f v8, fa0
; RV64V-NEXT: ret
%head = insertelement <vscale x 8 x double> undef, double %f, i32 0
%splat = shufflevector <vscale x 8 x double> %head, <vscale x 8 x double> undef, <vscale x 8 x i32> zeroinitializer
ret <vscale x 8 x double> %splat
}
define <vscale x 8 x double> @vsplat_zero_nxv8f64() {
; RV32V-LABEL: vsplat_zero_nxv8f64:
; RV32V: # %bb.0:
; RV32V-NEXT: vsetvli a0, zero, e64,m8,ta,mu
; RV32V-NEXT: vmv.v.i v8, 0
; RV32V-NEXT: ret
;
; RV64V-LABEL: vsplat_zero_nxv8f64:
; RV64V: # %bb.0:
; RV64V-NEXT: vsetvli a0, zero, e64,m8,ta,mu
; RV64V-NEXT: vmv.v.i v8, 0
; RV64V-NEXT: ret
%head = insertelement <vscale x 8 x double> undef, double zeroinitializer, i32 0
%splat = shufflevector <vscale x 8 x double> %head, <vscale x 8 x double> undef, <vscale x 8 x i32> zeroinitializer
ret <vscale x 8 x double> %splat
}