Skip to content

Commit 8be38d7

Browse files
aparshin-intelsys_zuul
authored andcommitted
added diagnostic for missing int<->double conversions
Change-Id: I149e98dc5594bec8bfcd0d209a688471fcb65fbe
1 parent 601d61e commit 8be38d7

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/GenXEmulate.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,10 @@ Value *GenXEmulate::Emu64Expander::visitAShr(BinaryOperator &Op) {
521521
return buildRightShift(SplitBuilder, Op);
522522
}
523523
Value *GenXEmulate::Emu64Expander::visitFPToUI(FPToUIInst &Op) {
524+
525+
if (Op.getType()->getScalarType() == Type::getDoubleTy(Op.getContext()))
526+
report_fatal_error("int_emu: double->UI conversions are not supported");
527+
524528
// TODO: try to detect the case where operand is a constant expression
525529
// and do the covertion manually
526530
auto Builder = getIRBuilder();
@@ -531,6 +535,10 @@ Value *GenXEmulate::Emu64Expander::visitFPToUI(FPToUIInst &Op) {
531535
Twine(Op.getOpcodeName()) + ".emu");
532536
}
533537
Value *GenXEmulate::Emu64Expander::visitFPToSI(FPToSIInst &Op) {
538+
539+
if (Op.getType()->getScalarType() == Type::getDoubleTy(Op.getContext()))
540+
report_fatal_error("int_emu: double->SI conversions are not supported");
541+
534542
// TODO: try to detect the case where operand is a constant expression
535543
// and do the covertion manually
536544
auto Builder = getIRBuilder();
@@ -542,6 +550,9 @@ Value *GenXEmulate::Emu64Expander::visitFPToSI(FPToSIInst &Op) {
542550
}
543551
Value *GenXEmulate::Emu64Expander::visitUIToFP(UIToFPInst &Op) {
544552

553+
if (Op.getType()->getScalarType() == Type::getDoubleTy(Op.getContext()))
554+
report_fatal_error("int_emu: UI->double conversions are not supported");
555+
545556
auto Builder = getIRBuilder();
546557
auto UI64 = SplitBuilder.splitOperandLoHi(0);
547558
ConstantEmitter K(UI64.Lo);
@@ -615,6 +626,10 @@ Value *GenXEmulate::Emu64Expander::visitUIToFP(UIToFPInst &Op) {
615626
return Result;
616627
}
617628
Value *GenXEmulate::Emu64Expander::visitSIToFP(SIToFPInst &Op) {
629+
630+
if (Op.getType()->getScalarType() == Type::getDoubleTy(Op.getContext()))
631+
report_fatal_error("int_emu: UI->double conversions are not supported");
632+
618633
// NOTE: SIToFP is special, since it does not do the convert by itself,
619634
// Instead it just creates a sequence of 64.bit operations which
620635
// are then expanded. As such some type convertion trickery is involved.
@@ -1393,8 +1408,7 @@ bool GenXEmulate::runOnModule(Module &M) {
13931408
for (const auto *Insn : DiscracedList) {
13941409
llvm::errs() << "I64EMU-FAILURE: " << *Insn << "\n";
13951410
}
1396-
report_fatal_error("GenXEmulate - strict emulation requirements failure",
1397-
false);
1411+
report_fatal_error("int_emu: strict emulation requirements failure", false);
13981412
}
13991413
return Changed;
14001414
}

0 commit comments

Comments
 (0)