Skip to content

Commit cec272d

Browse files
pguo-igcgfxbot
authored andcommitted
The derived const opt information is failed to be copied to
compiler output for VS. Also fixed one corner case with -0.0. Change-Id: I4cf2f0035a5800826881f20c86df5b86ae4c454b
1 parent c7dd226 commit cec272d

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

IGC/Compiler/GenUpdateCB.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,13 @@ namespace IGC
481481

482482
static inline float denormToZeroF(float f)
483483
{
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;
485489
}
490+
486491
static inline float utof(uint32_t bits)
487492
{
488493
union
@@ -645,7 +650,14 @@ namespace IGC
645650
ftodTemp.i = ftod0.i + ftod1.i;
646651
break;
647652
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+
}
649661
break;
650662
case Instruction::Mul:
651663
ftodTemp.i = ftod0.i * ftod1.i;
@@ -700,4 +712,4 @@ namespace IGC
700712
}
701713
}
702714
}
703-
}
715+
}

0 commit comments

Comments
 (0)