Skip to content

Commit 3de76e4

Browse files
committed
[RISCV] Replace hasStdExtV with hasVInstructions in isTruncateFree.
This prevents excluding the embedded vector extensions Zve*.
1 parent 03e1eb2 commit 3de76e4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1892,7 +1892,7 @@ bool RISCVTargetLowering::isTruncateFree(EVT SrcVT, EVT DstVT) const {
18921892
bool RISCVTargetLowering::isTruncateFree(SDValue Val, EVT VT2) const {
18931893
EVT SrcVT = Val.getValueType();
18941894
// free truncate from vnsrl and vnsra
1895-
if (Subtarget.hasStdExtV() &&
1895+
if (Subtarget.hasVInstructions() &&
18961896
(Val.getOpcode() == ISD::SRL || Val.getOpcode() == ISD::SRA) &&
18971897
SrcVT.isVector() && VT2.isVector()) {
18981898
unsigned SrcBits = SrcVT.getVectorElementType().getSizeInBits();

llvm/test/CodeGen/RISCV/pr94265.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
22
; RUN: llc < %s -mtriple=riscv32-- -mattr=+v | FileCheck -check-prefix=RV32I %s
33
; RUN: llc < %s -mtriple=riscv64-- -mattr=+v | FileCheck -check-prefix=RV64I %s
4+
; RUN: llc < %s -mtriple=riscv32-- -mattr=+zve32x,+zvl128b | FileCheck -check-prefix=RV32I %s
5+
; RUN: llc < %s -mtriple=riscv64-- -mattr=+zve32x,+zvl128b | FileCheck -check-prefix=RV64I %s
46

57
define <8 x i16> @PR94265(<8 x i32> %a0) #0 {
68
; RV32I-LABEL: PR94265:

0 commit comments

Comments
 (0)