@@ -60,28 +60,6 @@ static APFloat fmed3AMDGCN(const APFloat &Src0, const APFloat &Src1,
6060 return maxnum (Src0, Src1);
6161}
6262
63- enum class KnownIEEEMode { Unknown, On, Off };
64-
65- // / Return KnownIEEEMode::On if we know if the use context can assume
66- // / "amdgpu-ieee"="true" and KnownIEEEMode::Off if we can assume
67- // / "amdgpu-ieee"="false".
68- static KnownIEEEMode fpenvIEEEMode (const Instruction &I,
69- const GCNSubtarget &ST) {
70- if (!ST.hasIEEEMode ()) // Only mode on gfx12
71- return KnownIEEEMode::On;
72-
73- const Function *F = I.getFunction ();
74- if (!F)
75- return KnownIEEEMode::Unknown;
76-
77- Attribute IEEEAttr = F->getFnAttribute (" amdgpu-ieee" );
78- if (IEEEAttr.isValid ())
79- return IEEEAttr.getValueAsBool () ? KnownIEEEMode::On : KnownIEEEMode::Off;
80-
81- return AMDGPU::isShader (F->getCallingConv ()) ? KnownIEEEMode::Off
82- : KnownIEEEMode::On;
83- }
84-
8563// Check if a value can be converted to a 16-bit value without losing
8664// precision.
8765// The value is expected to be either a float (IsFloat = true) or an unsigned
@@ -1004,7 +982,7 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
1004982 // TODO: Also can fold to 2 operands with infinities.
1005983 if ((match (Src0, m_APFloat (ConstSrc0)) && ConstSrc0->isNaN ()) ||
1006984 isa<UndefValue>(Src0)) {
1007- switch (fpenvIEEEMode (II, *ST )) {
985+ switch (fpenvIEEEMode (II)) {
1008986 case KnownIEEEMode::On:
1009987 // TODO: If Src2 is snan, does it need quieting?
1010988 if (ConstSrc0 && ConstSrc0->isSignaling ())
@@ -1019,7 +997,7 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
1019997 }
1020998 } else if ((match (Src1, m_APFloat (ConstSrc1)) && ConstSrc1->isNaN ()) ||
1021999 isa<UndefValue>(Src1)) {
1022- switch (fpenvIEEEMode (II, *ST )) {
1000+ switch (fpenvIEEEMode (II)) {
10231001 case KnownIEEEMode::On:
10241002 // TODO: If Src2 is snan, does it need quieting?
10251003 if (ConstSrc1 && ConstSrc1->isSignaling ())
@@ -1035,7 +1013,7 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
10351013 }
10361014 } else if ((match (Src2, m_APFloat (ConstSrc2)) && ConstSrc2->isNaN ()) ||
10371015 isa<UndefValue>(Src2)) {
1038- switch (fpenvIEEEMode (II, *ST )) {
1016+ switch (fpenvIEEEMode (II)) {
10391017 case KnownIEEEMode::On:
10401018 if (ConstSrc2 && ConstSrc2->isSignaling ()) {
10411019 auto *Quieted = ConstantFP::get (II.getType (), ConstSrc2->makeQuiet ());
0 commit comments