Skip to content

Commit ac83561

Browse files
mshockwavelukel97
andcommitted
fixup! Address review comments
Co-Authored-By: Luke Lau <[email protected]>
1 parent 1d8b13e commit ac83561

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4524,9 +4524,8 @@ static SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG,
45244524

45254525
// General case: splat the first operand and slide other operands down one
45264526
// by one to form a vector. Alternatively, if the last operand is an
4527-
// extraction from element 0 of a vector, we can use the original vector
4528-
// reduction result as the start value and slide up instead of slide down.
4529-
// Such that we can avoid the splat.
4527+
// extraction from element 0 of a vector, we can use that vector as the start
4528+
// value and slide up instead of slide down. Such that we can avoid the splat.
45304529
SmallVector<SDValue> Operands(Op->op_begin(), Op->op_end());
45314530
SDValue EVec;
45324531
bool SlideUp = false;
@@ -4567,7 +4566,7 @@ static SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG,
45674566
continue;
45684567
}
45694568

4570-
// Start our sequence with either a TA splat or a reduction result in the
4569+
// Start our sequence with either a TA splat or extract source in the
45714570
// hopes that hardware is able to recognize there's no dependency on the
45724571
// prior value of our temporary register.
45734572
if (!Vec) {

llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-buildvec.ll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,6 +1853,28 @@ define <8 x double> @buildvec_slideup(<4 x double> %v, double %e0, double %e1, d
18531853
ret <8 x double> %v7
18541854
}
18551855

1856+
define <8 x double> @buildvec_slideup_trailing_undef(<4 x double> %v, double %e0, double %e1, double %e2, double %e3, double %e4) vscale_range(4, 128) {
1857+
; CHECK-LABEL: buildvec_slideup_trailing_undef:
1858+
; CHECK: # %bb.0:
1859+
; CHECK-NEXT: vsetivli zero, 8, e64, m2, ta, ma
1860+
; CHECK-NEXT: vfslide1up.vf v10, v8, fa4
1861+
; CHECK-NEXT: vfslide1up.vf v8, v10, fa3
1862+
; CHECK-NEXT: vfslide1up.vf v10, v8, fa2
1863+
; CHECK-NEXT: vfslide1up.vf v12, v10, fa1
1864+
; CHECK-NEXT: vfslide1up.vf v8, v12, fa0
1865+
; CHECK-NEXT: ret
1866+
%v0 = insertelement <8 x double> poison, double %e0, i64 0
1867+
%v1 = insertelement <8 x double> %v0, double %e1, i64 1
1868+
%v2 = insertelement <8 x double> %v1, double %e2, i64 2
1869+
%v3 = insertelement <8 x double> %v2, double %e3, i64 3
1870+
%v4 = insertelement <8 x double> %v3, double %e4, i64 4
1871+
%e5 = extractelement <4 x double> %v, i64 0
1872+
%v5 = insertelement <8 x double> %v4, double %e5, i64 5
1873+
%v6 = insertelement <8 x double> %v5, double poison, i64 6
1874+
%v7 = insertelement <8 x double> %v6, double poison, i64 7
1875+
ret <8 x double> %v7
1876+
}
1877+
18561878
; Negative test for slideup lowering where the extract_element was not build_vector's last operand.
18571879
define <8 x double> @buildvec_slideup_not_last_element(<4 x double> %v, double %e0, double %e1, double %e2, double %e3, double %e4, double %e5, double %e7) vscale_range(4, 128) {
18581880
; CHECK-LABEL: buildvec_slideup_not_last_element:

0 commit comments

Comments
 (0)