File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -481,8 +481,13 @@ namespace IGC
481
481
482
482
static inline float denormToZeroF (float f)
483
483
{
484
- return std::fpclassify (f) == FP_SUBNORMAL ? 0 .0f : f;
484
+ if (std::fpclassify (f) == FP_SUBNORMAL)
485
+ {
486
+ return f < 0 .0f ? -0 .0f : 0 .0f ;
487
+ }
488
+ return f;
485
489
}
490
+
486
491
static inline float utof (uint32_t bits)
487
492
{
488
493
union
@@ -645,7 +650,14 @@ namespace IGC
645
650
ftodTemp.i = ftod0.i + ftod1.i ;
646
651
break ;
647
652
case Instruction::FSub:
648
- ftodTemp.f = ftod0.f - ftod1.f ;
653
+ if (ftod0.f == 0 .0f && isa<ConstantFP>(inst->getOperand (0 )))
654
+ {
655
+ ftodTemp.f = -ftod1.f ;
656
+ }
657
+ else
658
+ {
659
+ ftodTemp.f = ftod0.f - ftod1.f ;
660
+ }
649
661
break ;
650
662
case Instruction::Mul:
651
663
ftodTemp.i = ftod0.i * ftod1.i ;
@@ -700,4 +712,4 @@ namespace IGC
700
712
}
701
713
}
702
714
}
703
- }
715
+ }
You can’t perform that action at this time.
0 commit comments