@@ -521,6 +521,10 @@ Value *GenXEmulate::Emu64Expander::visitAShr(BinaryOperator &Op) {
521
521
return buildRightShift (SplitBuilder, Op);
522
522
}
523
523
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
+
524
528
// TODO: try to detect the case where operand is a constant expression
525
529
// and do the covertion manually
526
530
auto Builder = getIRBuilder ();
@@ -531,6 +535,10 @@ Value *GenXEmulate::Emu64Expander::visitFPToUI(FPToUIInst &Op) {
531
535
Twine (Op.getOpcodeName ()) + " .emu" );
532
536
}
533
537
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
+
534
542
// TODO: try to detect the case where operand is a constant expression
535
543
// and do the covertion manually
536
544
auto Builder = getIRBuilder ();
@@ -542,6 +550,9 @@ Value *GenXEmulate::Emu64Expander::visitFPToSI(FPToSIInst &Op) {
542
550
}
543
551
Value *GenXEmulate::Emu64Expander::visitUIToFP (UIToFPInst &Op) {
544
552
553
+ if (Op.getType ()->getScalarType () == Type::getDoubleTy (Op.getContext ()))
554
+ report_fatal_error (" int_emu: UI->double conversions are not supported" );
555
+
545
556
auto Builder = getIRBuilder ();
546
557
auto UI64 = SplitBuilder.splitOperandLoHi (0 );
547
558
ConstantEmitter K (UI64.Lo );
@@ -615,6 +626,10 @@ Value *GenXEmulate::Emu64Expander::visitUIToFP(UIToFPInst &Op) {
615
626
return Result;
616
627
}
617
628
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
+
618
633
// NOTE: SIToFP is special, since it does not do the convert by itself,
619
634
// Instead it just creates a sequence of 64.bit operations which
620
635
// are then expanded. As such some type convertion trickery is involved.
@@ -1393,8 +1408,7 @@ bool GenXEmulate::runOnModule(Module &M) {
1393
1408
for (const auto *Insn : DiscracedList) {
1394
1409
llvm::errs () << " I64EMU-FAILURE: " << *Insn << " \n " ;
1395
1410
}
1396
- report_fatal_error (" GenXEmulate - strict emulation requirements failure" ,
1397
- false );
1411
+ report_fatal_error (" int_emu: strict emulation requirements failure" , false );
1398
1412
}
1399
1413
return Changed;
1400
1414
}
0 commit comments