Skip to content

Commit

Permalink
[RISCV] Rename 'SplatOperand' to 'ScalarOperand'. NFC
Browse files Browse the repository at this point in the history
vslide1up/down have this flag set, but the value isn't a splat.
Rename for clarity.

Reviewed By: khchen

Differential Revision: https://reviews.llvm.org/D121037
  • Loading branch information
topperc committed Mar 7, 2022
1 parent 8e132c5 commit 845bfce
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
34 changes: 17 additions & 17 deletions llvm/include/llvm/IR/IntrinsicsRISCV.td
Expand Up @@ -140,7 +140,7 @@ let TargetPrefix = "riscv" in {
// Vectors

// The intrinsic does not have any operand that must be extended.
defvar NoSplatOperand = 0xF;
defvar NoScalarOperand = 0xF;

// The intrinsic does not have a VL operand.
// (e.g., riscv_vmv_x_s and riscv_vfmv_f_s)
Expand All @@ -150,7 +150,7 @@ class RISCVVIntrinsic {
// These intrinsics may accept illegal integer values in their llvm_any_ty
// operand, so they have to be extended.
Intrinsic IntrinsicID = !cast<Intrinsic>(NAME);
bits<4> SplatOperand = NoSplatOperand;
bits<4> ScalarOperand = NoScalarOperand;
bits<5> VLOperand = NoVLOperand;
}

Expand Down Expand Up @@ -449,7 +449,7 @@ let TargetPrefix = "riscv" in {
[LLVMMatchType<0>, LLVMMatchType<0>, llvm_any_ty,
llvm_anyint_ty],
[IntrNoMem]>, RISCVVIntrinsic {
let SplatOperand = 2;
let ScalarOperand = 2;
let VLOperand = 3;
}
// For destination vector type is the same as first source vector (with mask).
Expand All @@ -460,7 +460,7 @@ let TargetPrefix = "riscv" in {
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty,
LLVMMatchType<2>],
[ImmArg<ArgIndex<5>>, IntrNoMem]>, RISCVVIntrinsic {
let SplatOperand = 2;
let ScalarOperand = 2;
let VLOperand = 4;
}
// For destination vector type is the same as first source vector. The
Expand Down Expand Up @@ -491,7 +491,7 @@ let TargetPrefix = "riscv" in {
[LLVMMatchType<0>, llvm_anyvector_ty, llvm_any_ty,
llvm_anyint_ty],
[IntrNoMem]>, RISCVVIntrinsic {
let SplatOperand = 2;
let ScalarOperand = 2;
let VLOperand = 3;
}
// For destination vector type is NOT the same as first source vector (with mask).
Expand All @@ -502,7 +502,7 @@ let TargetPrefix = "riscv" in {
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty,
LLVMMatchType<3>],
[ImmArg<ArgIndex<5>>, IntrNoMem]>, RISCVVIntrinsic {
let SplatOperand = 2;
let ScalarOperand = 2;
let VLOperand = 4;
}
// For destination vector type is NOT the same as first source vector. The
Expand Down Expand Up @@ -534,7 +534,7 @@ let TargetPrefix = "riscv" in {
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
llvm_anyint_ty],
[IntrNoMem]>, RISCVVIntrinsic {
let SplatOperand = 2;
let ScalarOperand = 2;
let VLOperand = 4;
}
// For binary operations with mask type output and V0 as input.
Expand All @@ -546,7 +546,7 @@ let TargetPrefix = "riscv" in {
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
llvm_anyint_ty],
[IntrNoMem]>, RISCVVIntrinsic {
let SplatOperand = 1;
let ScalarOperand = 1;
let VLOperand = 3;
}
// For binary operations with mask type output.
Expand All @@ -556,7 +556,7 @@ let TargetPrefix = "riscv" in {
: Intrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
[llvm_anyvector_ty, llvm_any_ty, llvm_anyint_ty],
[IntrNoMem]>, RISCVVIntrinsic {
let SplatOperand = 1;
let ScalarOperand = 1;
let VLOperand = 2;
}
// For binary operations with mask type output without mask.
Expand All @@ -566,7 +566,7 @@ let TargetPrefix = "riscv" in {
: Intrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
[llvm_anyvector_ty, llvm_any_ty, llvm_anyint_ty],
[IntrNoMem]>, RISCVVIntrinsic {
let SplatOperand = 1;
let ScalarOperand = 1;
let VLOperand = 2;
}
// For binary operations with mask type output with mask.
Expand All @@ -578,7 +578,7 @@ let TargetPrefix = "riscv" in {
llvm_anyvector_ty, llvm_any_ty,
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty],
[IntrNoMem]>, RISCVVIntrinsic {
let SplatOperand = 2;
let ScalarOperand = 2;
let VLOperand = 4;
}
// For FP classify operations.
Expand Down Expand Up @@ -610,7 +610,7 @@ let TargetPrefix = "riscv" in {
[LLVMMatchType<0>, LLVMMatchType<0>, llvm_any_ty,
llvm_anyint_ty],
[IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic {
let SplatOperand = 2;
let ScalarOperand = 2;
let VLOperand = 3;
}
// For Saturating binary operations with mask.
Expand All @@ -622,7 +622,7 @@ let TargetPrefix = "riscv" in {
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty,
LLVMMatchType<2>],
[ImmArg<ArgIndex<5>>, IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic {
let SplatOperand = 2;
let ScalarOperand = 2;
let VLOperand = 4;
}
// For Saturating binary operations.
Expand Down Expand Up @@ -692,7 +692,7 @@ let TargetPrefix = "riscv" in {
[LLVMMatchType<0>, llvm_any_ty, LLVMMatchType<0>,
llvm_anyint_ty, LLVMMatchType<2>],
[ImmArg<ArgIndex<4>>, IntrNoMem]>, RISCVVIntrinsic {
let SplatOperand = 1;
let ScalarOperand = 1;
let VLOperand = 3;
}
// Input: (vector_in, vector_in/scalar, vector_in, mask, vl, policy
Expand All @@ -702,7 +702,7 @@ let TargetPrefix = "riscv" in {
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
llvm_anyint_ty, LLVMMatchType<2>],
[ImmArg<ArgIndex<5>>, IntrNoMem]>, RISCVVIntrinsic {
let SplatOperand = 1;
let ScalarOperand = 1;
let VLOperand = 4;
}
// Input: (vector_in, vector_in/scalar, vector_in, vl, policy)
Expand All @@ -711,7 +711,7 @@ let TargetPrefix = "riscv" in {
[LLVMMatchType<0>, llvm_any_ty, llvm_anyvector_ty,
llvm_anyint_ty, LLVMMatchType<3>],
[ImmArg<ArgIndex<4>>, IntrNoMem] >, RISCVVIntrinsic {
let SplatOperand = 1;
let ScalarOperand = 1;
let VLOperand = 3;
}
// Input: (vector_in, vector_in/scalar, vector_in, mask, vl, policy
Expand All @@ -721,7 +721,7 @@ let TargetPrefix = "riscv" in {
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
llvm_anyint_ty, LLVMMatchType<3>],
[ImmArg<ArgIndex<5>>, IntrNoMem]>, RISCVVIntrinsic {
let SplatOperand = 1;
let ScalarOperand = 1;
let VLOperand = 4;
}
// For Reduction ternary operations.
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Expand Up @@ -4572,10 +4572,10 @@ static SDValue lowerVectorIntrinsicScalars(SDValue Op, SelectionDAG &DAG,

const RISCVVIntrinsicsTable::RISCVVIntrinsicInfo *II =
RISCVVIntrinsicsTable::getRISCVVIntrinsicInfo(IntNo);
if (!II || !II->hasSplatOperand())
if (!II || !II->hasScalarOperand())
return SDValue();

unsigned SplatOp = II->SplatOperand + 1 + HasChain;
unsigned SplatOp = II->ScalarOperand + 1 + HasChain;
assert(SplatOp < Op.getNumOperands());

SmallVector<SDValue, 8> Operands(Op->op_begin(), Op->op_end());
Expand Down Expand Up @@ -4605,7 +4605,7 @@ static SDValue lowerVectorIntrinsicScalars(SDValue Op, SelectionDAG &DAG,
// that a widening operation never uses SEW=64.
// NOTE: If this fails the below assert, we can probably just find the
// element count from any operand or result and use it to construct the VT.
assert(II->SplatOperand > 0 && "Unexpected splat operand!");
assert(II->ScalarOperand > 0 && "Unexpected splat operand!");
MVT VT = Op.getOperand(SplatOp - 1).getSimpleValueType();

// The more complex case is when the scalar is larger than XLenVT.
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Target/RISCV/RISCVISelLowering.h
Expand Up @@ -685,11 +685,11 @@ namespace RISCVVIntrinsicsTable {

struct RISCVVIntrinsicInfo {
unsigned IntrinsicID;
uint8_t SplatOperand;
uint8_t ScalarOperand;
uint8_t VLOperand;
bool hasSplatOperand() const {
// 0xF is not valid. See NoSplatOperand in IntrinsicsRISCV.td.
return SplatOperand != 0xF;
bool hasScalarOperand() const {
// 0xF is not valid. See NoScalarOperand in IntrinsicsRISCV.td.
return ScalarOperand != 0xF;
}
bool hasVLOperand() const {
// 0x1F is not valid. See NoVLOperand in IntrinsicsRISCV.td.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
Expand Up @@ -418,7 +418,7 @@ def RISCVVPseudosTable : GenericTable {
def RISCVVIntrinsicsTable : GenericTable {
let FilterClass = "RISCVVIntrinsic";
let CppTypeName = "RISCVVIntrinsicInfo";
let Fields = ["IntrinsicID", "SplatOperand", "VLOperand"];
let Fields = ["IntrinsicID", "ScalarOperand", "VLOperand"];
let PrimaryKey = ["IntrinsicID"];
let PrimaryKeyName = "getRISCVVIntrinsicInfo";
}
Expand Down

0 comments on commit 845bfce

Please sign in to comment.