Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions llvm/include/llvm/CodeGen/ValueTypes.td
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def x86amx : ValueType<8192, 194>; // X86 AMX value
def i64x8 : ValueType<512, 195>; // 8 Consecutive GPRs (AArch64)
def aarch64svcount
: ValueType<16, 196>; // AArch64 predicate-as-counter
def spirvbuiltin : ValueType<0, 197>; // SPIR-V's builtin type

def token : ValueType<0, 248>; // TokenTy
def MetadataVT : ValueType<0, 249>; // Metadata
Expand Down
7 changes: 5 additions & 2 deletions llvm/include/llvm/Support/MachineValueType.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,10 @@ namespace llvm {
x86amx = 194, // This is an X86 AMX value
i64x8 = 195, // 8 Consecutive GPRs (AArch64)
aarch64svcount = 196, // AArch64 predicate-as-counter
spirvbuiltin = 197, // SPIR-V's builtin type

FIRST_VALUETYPE = 1, // This is always the beginning of the list.
LAST_VALUETYPE = aarch64svcount, // This always remains at the end of the list.
LAST_VALUETYPE = spirvbuiltin, // This always remains at the end of the list.
VALUETYPE_SIZE = LAST_VALUETYPE + 1,

// This is the current maximum for LAST_VALUETYPE.
Expand Down Expand Up @@ -1143,7 +1144,9 @@ namespace llvm {
case v2048i32:
case v2048f32: return TypeSize::Fixed(65536);
case funcref:
case externref: return TypeSize::Fixed(0); // opaque type
case externref:
case spirvbuiltin:
return TypeSize::Fixed(0); // opaque type
}
}

Expand Down
10 changes: 8 additions & 2 deletions llvm/lib/CodeGen/ValueTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ std::string EVT::getEVTString() const {
case MVT::externref: return "externref";
case MVT::aarch64svcount:
return "aarch64svcount";
case MVT::spirvbuiltin:
return "spirvbuiltin";
}
}

Expand Down Expand Up @@ -583,12 +585,16 @@ MVT MVT::getVT(Type *Ty, bool HandleUnknown){
case Type::DoubleTyID: return MVT(MVT::f64);
case Type::X86_FP80TyID: return MVT(MVT::f80);
case Type::X86_MMXTyID: return MVT(MVT::x86mmx);
case Type::TargetExtTyID:
if (cast<TargetExtType>(Ty)->getName() == "aarch64.svcount")
case Type::TargetExtTyID: {
TargetExtType *TargetExtTy = cast<TargetExtType>(Ty);
if (TargetExtTy->getName() == "aarch64.svcount")
return MVT(MVT::aarch64svcount);
else if (TargetExtTy->getName().starts_with("spirv."))
return MVT(MVT::spirvbuiltin);
if (HandleUnknown)
return MVT(MVT::Other);
llvm_unreachable("Unknown target ext type!");
}
case Type::X86_AMXTyID: return MVT(MVT::x86amx);
case Type::FP128TyID: return MVT(MVT::f128);
case Type::PPC_FP128TyID: return MVT(MVT::ppcf128);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ static bool buildSelectInst(MachineIRBuilder &MIRBuilder,

if (ReturnType->getOpcode() == SPIRV::OpTypeVector) {
unsigned Bits = GR->getScalarOrVectorBitWidth(ReturnType);
uint64_t AllOnes = APInt::getAllOnesValue(Bits).getZExtValue();
uint64_t AllOnes = APInt::getAllOnes(Bits).getZExtValue();
TrueConst = GR->getOrCreateConsIntVector(AllOnes, MIRBuilder, ReturnType);
FalseConst = GR->getOrCreateConsIntVector(0, MIRBuilder, ReturnType);
} else {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/SPIRV/SPIRVInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def PseudoConstI: IntImmLeaf<i32, [{ return Imm.getBitWidth() <= 32; }], imm_to_
def PseudoConstF: FPImmLeaf<f32, [{ return true; }], fimm_to_i32>;
def ConstPseudoTrue: IntImmLeaf<i32, [{ return Imm.getBitWidth() == 1 && Imm.getZExtValue() == 1; }]>;
def ConstPseudoFalse: IntImmLeaf<i32, [{ return Imm.getBitWidth() == 1 && Imm.getZExtValue() == 0; }]>;
def ConstPseudoNull: IntImmLeaf<i64, [{ return Imm.isNullValue(); }]>;
def ConstPseudoNull: IntImmLeaf<i64, [{ return Imm.isZero(); }]>;

multiclass IntFPImm<bits<16> opCode, string name> {
def I: Op<opCode, (outs ID:$dst), (ins TYPE:$type, ID:$src, variable_ops),
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1080,8 +1080,8 @@ Register SPIRVInstructionSelector::buildOnesVal(bool AllOnes,
const SPIRVType *ResType,
MachineInstr &I) const {
unsigned BitWidth = GR.getScalarOrVectorBitWidth(ResType);
APInt One = AllOnes ? APInt::getAllOnesValue(BitWidth)
: APInt::getOneBitSet(BitWidth, 0);
APInt One =
AllOnes ? APInt::getAllOnes(BitWidth) : APInt::getOneBitSet(BitWidth, 0);
if (ResType->getOpcode() == SPIRV::OpTypeVector)
return GR.getOrCreateConsIntVector(One.getZExtValue(), I, ResType, TII);
return GR.getOrCreateConstInt(One.getZExtValue(), I, ResType, TII);
Expand Down Expand Up @@ -1180,10 +1180,10 @@ bool SPIRVInstructionSelector::selectConst(Register ResVReg,
const APInt &Imm,
MachineInstr &I) const {
unsigned TyOpcode = ResType->getOpcode();
assert(TyOpcode != SPIRV::OpTypePointer || Imm.isNullValue());
assert(TyOpcode != SPIRV::OpTypePointer || Imm.isZero());
MachineBasicBlock &BB = *I.getParent();
if ((TyOpcode == SPIRV::OpTypePointer || TyOpcode == SPIRV::OpTypeEvent) &&
Imm.isNullValue())
Imm.isZero())
return BuildMI(BB, I, I.getDebugLoc(), TII.get(SPIRV::OpConstantNull))
.addDef(ResVReg)
.addUse(GR.getSPIRVTypeID(ResType))
Expand Down