@@ -1766,70 +1766,6 @@ namespace IGC
1766
1766
1767
1767
void CEncoder::Arithmetic (ISA_Opcode opcode, CVariable* dst, CVariable* src0, CVariable* src1, CVariable* src2)
1768
1768
{
1769
- // Single Precision or Double precision denorm mode in
1770
- // control register must be set to retain denorm mode
1771
- // when executing Math Macro instruction sequence.
1772
- // It applies to the platforms which has correctly implemented
1773
- // macros and INV and SQRT instructions.
1774
- // 1. Set appropriate bit in control register.
1775
- // 2. Execute inv or sqrt instruction
1776
- // 3. Flush denorm in the result if flushing was enabled.
1777
- // 4. Restore original denorm mode in control register.
1778
- bool forceRetainDenorms =
1779
- m_program->m_Platform ->hasCorrectlyRoundedMacros () &&
1780
- ((opcode == ISA_Opcode::ISA_INV) || (opcode == ISA_Opcode::ISA_SQRT)) &&
1781
- IsFloat (src0->GetType ()) &&
1782
- (src1 == nullptr );
1783
-
1784
- // Save original denorm mode. This value is a mask of bits
1785
- // corresponding to the denorm bits in Control register.
1786
- uint32_t oldDenormMode = m_fpDenormMode;
1787
-
1788
- if (forceRetainDenorms)
1789
- {
1790
- IGC_ASSERT_MESSAGE (src1 == nullptr , " Unsupported opcode for Forcing Retain Denorm Mode." );
1791
-
1792
- DenormModeEncoding denormMode = DenormModeEncoding::DenormFlushToZero;
1793
-
1794
- // Check the type of src0, currently the restrictions applied only
1795
- // to unary instructions.
1796
- // Get the denorm mode mask for that data type.
1797
- switch (src0->GetType ())
1798
- {
1799
- case ISA_TYPE_DF:
1800
- denormMode = DenormModeEncoding::Float64DenormRetain;
1801
- break ;
1802
-
1803
- case ISA_TYPE_F:
1804
- denormMode = DenormModeEncoding::Float32DenormRetain;
1805
- break ;
1806
-
1807
- case ISA_TYPE_HF:
1808
- denormMode = DenormModeEncoding::Float16DenormRetain;
1809
- break ;
1810
-
1811
- case ISA_TYPE_BF:
1812
- denormMode = DenormModeEncoding::FloatBFTFDenormRetain;
1813
- break ;
1814
-
1815
- default :
1816
- IGC_ASSERT_MESSAGE (0 , " Incorrect Float type." );
1817
- }
1818
-
1819
- // Check if the original denorm mode for the src0 data type
1820
- // was 0 (flush to zero).
1821
- // denormMode will always have a bit set for the given data
1822
- // type. If currently set mode is 0 (flush to zero), the
1823
- // ANDing these values will give 0, thus cr must be temporarily
1824
- // updated and flushing the destination must be added,
1825
- forceRetainDenorms &= (m_fpDenormMode && denormMode) == 0 ;
1826
-
1827
- if (forceRetainDenorms)
1828
- {
1829
- SetDenormMode (denormMode);
1830
- }
1831
- }
1832
-
1833
1769
VISA_VectorOpnd* srcOpnd0 = GetSourceOperand (src0, m_encoderState.m_srcOperand [0 ]);
1834
1770
VISA_VectorOpnd* srcOpnd1 = GetSourceOperand (src1, m_encoderState.m_srcOperand [1 ]);
1835
1771
VISA_VectorOpnd* srcOpnd2 = GetSourceOperand (src2, m_encoderState.m_srcOperand [2 ]);
@@ -1845,17 +1781,6 @@ namespace IGC
1845
1781
srcOpnd0,
1846
1782
srcOpnd1,
1847
1783
srcOpnd2));
1848
-
1849
- if (forceRetainDenorms)
1850
- {
1851
- // Restore the original denorm mode.
1852
- SetDenormMode (oldDenormMode);
1853
-
1854
- // Force flushing the destination to zero by adding -0 to it.
1855
- CVariable* negativeZero = m_program->ImmToVariable ((uint64_t )-0.0 , dst->GetType ());
1856
- Add (dst, dst, negativeZero);
1857
- }
1858
-
1859
1784
}
1860
1785
1861
1786
void CEncoder::Bfn (uint8_t booleanFuncCtrl, CVariable* dst, CVariable* src0, CVariable* src1, CVariable* src2)
@@ -2939,17 +2864,13 @@ namespace IGC
2939
2864
2940
2865
CodeGenContext* pCtx = m_program->GetContext ();
2941
2866
if (pCtx->m_floatDenormMode16 == FLOAT_DENORM_RETAIN)
2942
- imm_data |= DenormModeEncoding::Float16DenormRetain ;
2867
+ imm_data |= 0x400 ;
2943
2868
if (pCtx->m_floatDenormMode32 == FLOAT_DENORM_RETAIN)
2944
- imm_data |= DenormModeEncoding::Float32DenormRetain ;
2869
+ imm_data |= 0x80 ;
2945
2870
if (pCtx->m_floatDenormMode64 == FLOAT_DENORM_RETAIN)
2946
- imm_data |= DenormModeEncoding::Float64DenormRetain ;
2871
+ imm_data |= 0x40 ;
2947
2872
if (pCtx->m_floatDenormModeBFTF == FLOAT_DENORM_RETAIN)
2948
- imm_data |= DenormModeEncoding::FloatBFTFDenormRetain;
2949
-
2950
- // Store current denorm mode in the encoder for easier handling
2951
- // its temporary changes.
2952
- m_fpDenormMode = imm_data;
2873
+ imm_data |= (0x1 << 30 );
2953
2874
2954
2875
uint RM_bits = 0 ;
2955
2876
ERoundingMode RM_FPCvtInt = static_cast <ERoundingMode>(pCtx->getModuleMetaData ()->compOpt .FloatCvtIntRoundingMode );
@@ -3017,51 +2938,6 @@ namespace IGC
3017
2938
src1_Opnd));
3018
2939
}
3019
2940
3020
- // Update denorm mode in CR0 register.
3021
- // Set only the 4 bits controlling the state of denorm
3022
- // handling.
3023
- void CEncoder::SetDenormMode (uint32_t newDenormMode)
3024
- {
3025
- // Do not update if current denorm state is the same
3026
- // as a target one.
3027
- if ((m_fpDenormMode && newDenormMode) != 0 )
3028
- {
3029
- return ;
3030
- }
3031
-
3032
- VISA_VectorOpnd* src0_Opnd = nullptr ;
3033
- VISA_VectorOpnd* src1_Opnd = nullptr ;
3034
- VISA_VectorOpnd* dst_Opnd = nullptr ;
3035
- VISA_GenVar* cr0_var = nullptr ;
3036
-
3037
- // Prepare data for the update.
3038
- // Xor current denorm mode with a new mode.
3039
- // The result will be xored with the CR register.
3040
- // This way CR will be updated only on bits related to
3041
- // denorm mode.
3042
- // To keep m_fpDenormMode in sync with CR0, xor it
3043
- // also with the same value CR0 will be xored with.
3044
- uint32_t value = m_fpDenormMode ^ newDenormMode;
3045
- m_fpDenormMode = m_fpDenormMode ^ value;
3046
-
3047
- IGC_ASSERT (nullptr != vKernel);
3048
-
3049
- V (vKernel->GetPredefinedVar (cr0_var, PREDEFINED_CR0));
3050
- V (vKernel->CreateVISASrcOperand (src0_Opnd, cr0_var, MODIFIER_NONE, 0 , 1 , 0 , 0 , 0 ));
3051
- V (vKernel->CreateVISAImmediate (src1_Opnd, &value, ISA_TYPE_UD));
3052
- V (vKernel->CreateVISADstOperand (dst_Opnd, cr0_var, 1 , 0 , 0 ));
3053
-
3054
- V (vKernel->AppendVISAArithmeticInst (
3055
- ISA_XOR,
3056
- nullptr ,
3057
- false ,
3058
- vISA_EMASK_M1_NM,
3059
- EXEC_SIZE_1,
3060
- dst_Opnd,
3061
- src0_Opnd,
3062
- src1_Opnd));
3063
- }
3064
-
3065
2941
void CEncoder::SetRoundingMode_FP (ERoundingMode actualRM, ERoundingMode newRM)
3066
2942
{
3067
2943
IGC_ASSERT_MESSAGE (newRM != ERoundingMode::ROUND_TO_ANY, " Invalid rounding mode" );
0 commit comments