@@ -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
@@ -1003,7 +981,7 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
1003981 // TODO: Also can fold to 2 operands with infinities.
1004982 if ((match (Src0, m_APFloat (ConstSrc0)) && ConstSrc0->isNaN ()) ||
1005983 isa<UndefValue>(Src0)) {
1006- switch (fpenvIEEEMode (II, *ST )) {
984+ switch (fpenvIEEEMode (II)) {
1007985 case KnownIEEEMode::On:
1008986 // TODO: If Src2 is snan, does it need quieting?
1009987 if (ConstSrc0 && ConstSrc0->isSignaling ())
@@ -1018,7 +996,7 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
1018996 }
1019997 } else if ((match (Src1, m_APFloat (ConstSrc1)) && ConstSrc1->isNaN ()) ||
1020998 isa<UndefValue>(Src1)) {
1021- switch (fpenvIEEEMode (II, *ST )) {
999+ switch (fpenvIEEEMode (II)) {
10221000 case KnownIEEEMode::On:
10231001 // TODO: If Src2 is snan, does it need quieting?
10241002 if (ConstSrc1 && ConstSrc1->isSignaling ())
@@ -1034,7 +1012,7 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
10341012 }
10351013 } else if ((match (Src2, m_APFloat (ConstSrc2)) && ConstSrc2->isNaN ()) ||
10361014 isa<UndefValue>(Src2)) {
1037- switch (fpenvIEEEMode (II, *ST )) {
1015+ switch (fpenvIEEEMode (II)) {
10381016 case KnownIEEEMode::On:
10391017 if (ConstSrc2 && ConstSrc2->isSignaling ()) {
10401018 auto *Quieted = ConstantFP::get (II.getType (), ConstSrc2->makeQuiet ());
0 commit comments