mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-11 10:18:21 +09:00
Update constant prop to only consider certain hwintrinsics (#97616)
* Update constant prop to only consider certain hwintrinsics * Don't use gtFindLink unnecessarily * Apply formatting patch * Still allow constant propagation for single use locals * Apply formatting patch
This commit is contained in:
parent
900bc5a300
commit
803afaad00
8 changed files with 270 additions and 57 deletions
|
@ -7405,6 +7405,8 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE2_And:
|
||||
case NI_AVX_And:
|
||||
case NI_AVX2_And:
|
||||
case NI_AVX512F_And:
|
||||
case NI_AVX512DQ_And:
|
||||
#endif
|
||||
{
|
||||
return EvaluateBinarySimd(this, GT_AND, /* scalar */ false, type, baseType, arg0VN, arg1VN);
|
||||
|
@ -7420,6 +7422,8 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE2_AndNot:
|
||||
case NI_AVX_AndNot:
|
||||
case NI_AVX2_AndNot:
|
||||
case NI_AVX512F_AndNot:
|
||||
case NI_AVX512DQ_AndNot:
|
||||
{
|
||||
// xarch does: ~arg0VN & arg1VN
|
||||
return EvaluateBinarySimd(this, GT_AND_NOT, /* scalar */ false, type, baseType, arg1VN, arg0VN);
|
||||
|
@ -7472,6 +7476,18 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_XARCH
|
||||
case NI_AVX512F_Multiply:
|
||||
{
|
||||
if (!varTypeIsFloating(baseType))
|
||||
{
|
||||
// We don't support this for integrals since it returns a different size than the input
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
}
|
||||
#endif // TARGET_XARCH
|
||||
|
||||
#ifdef TARGET_ARM64
|
||||
case NI_AdvSimd_Multiply:
|
||||
case NI_AdvSimd_Arm64_Multiply:
|
||||
|
@ -7482,6 +7498,10 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE41_MultiplyLow:
|
||||
case NI_AVX_Multiply:
|
||||
case NI_AVX2_MultiplyLow:
|
||||
case NI_AVX512F_MultiplyLow:
|
||||
case NI_AVX512BW_MultiplyLow:
|
||||
case NI_AVX512DQ_MultiplyLow:
|
||||
case NI_AVX512DQ_VL_MultiplyLow:
|
||||
#endif
|
||||
{
|
||||
return EvaluateBinarySimd(this, GT_MUL, /* scalar */ false, type, baseType, arg0VN, arg1VN);
|
||||
|
@ -7504,6 +7524,8 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE2_Or:
|
||||
case NI_AVX_Or:
|
||||
case NI_AVX2_Or:
|
||||
case NI_AVX512F_Or:
|
||||
case NI_AVX512DQ_Or:
|
||||
#endif
|
||||
{
|
||||
return EvaluateBinarySimd(this, GT_OR, /* scalar */ false, type, baseType, arg0VN, arg1VN);
|
||||
|
@ -7669,6 +7691,8 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE2_Xor:
|
||||
case NI_AVX_Xor:
|
||||
case NI_AVX2_Xor:
|
||||
case NI_AVX512F_Xor:
|
||||
case NI_AVX512DQ_Xor:
|
||||
#endif
|
||||
{
|
||||
return EvaluateBinarySimd(this, GT_XOR, /* scalar */ false, type, baseType, arg0VN, arg1VN);
|
||||
|
@ -7717,6 +7741,8 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE2_And:
|
||||
case NI_AVX_And:
|
||||
case NI_AVX2_And:
|
||||
case NI_AVX512F_And:
|
||||
case NI_AVX512DQ_And:
|
||||
#endif
|
||||
{
|
||||
// Handle `x & 0 == 0` and `0 & x == 0`
|
||||
|
@ -7744,6 +7770,8 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE2_AndNot:
|
||||
case NI_AVX_AndNot:
|
||||
case NI_AVX2_AndNot:
|
||||
case NI_AVX512F_AndNot:
|
||||
case NI_AVX512DQ_AndNot:
|
||||
{
|
||||
#ifdef TARGET_ARM64
|
||||
if (cnsVN == arg0VN)
|
||||
|
@ -7837,6 +7865,18 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_XARCH
|
||||
case NI_AVX512F_Multiply:
|
||||
{
|
||||
if (!varTypeIsFloating(baseType))
|
||||
{
|
||||
// We don't support this for integrals since it returns a different size than the input
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
}
|
||||
#endif // TARGET_XARCH
|
||||
|
||||
#ifdef TARGET_ARM64
|
||||
case NI_AdvSimd_Multiply:
|
||||
case NI_AdvSimd_Arm64_Multiply:
|
||||
|
@ -7847,7 +7887,6 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE41_MultiplyLow:
|
||||
case NI_AVX_Multiply:
|
||||
case NI_AVX2_MultiplyLow:
|
||||
case NI_AVX512F_Multiply:
|
||||
case NI_AVX512F_MultiplyLow:
|
||||
case NI_AVX512BW_MultiplyLow:
|
||||
case NI_AVX512DQ_MultiplyLow:
|
||||
|
@ -7893,6 +7932,8 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE2_Or:
|
||||
case NI_AVX_Or:
|
||||
case NI_AVX2_Or:
|
||||
case NI_AVX512F_Or:
|
||||
case NI_AVX512DQ_Or:
|
||||
#endif
|
||||
{
|
||||
// Handle `x | 0 == x` and `0 | x == x`
|
||||
|
@ -7980,6 +8021,8 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE2_Xor:
|
||||
case NI_AVX_Xor:
|
||||
case NI_AVX2_Xor:
|
||||
case NI_AVX512F_Xor:
|
||||
case NI_AVX512DQ_Xor:
|
||||
#endif
|
||||
{
|
||||
// Handle `x | 0 == x` and `0 | x == x`
|
||||
|
@ -8007,6 +8050,8 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE2_And:
|
||||
case NI_AVX_And:
|
||||
case NI_AVX2_And:
|
||||
case NI_AVX512F_And:
|
||||
case NI_AVX512DQ_And:
|
||||
#endif
|
||||
{
|
||||
// Handle `x & x == x`
|
||||
|
@ -8020,6 +8065,8 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE2_AndNot:
|
||||
case NI_AVX_AndNot:
|
||||
case NI_AVX2_AndNot:
|
||||
case NI_AVX512F_AndNot:
|
||||
case NI_AVX512DQ_AndNot:
|
||||
{
|
||||
// Handle `x & ~x == 0`
|
||||
return VNZeroForType(type);
|
||||
|
@ -8033,6 +8080,8 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE2_Or:
|
||||
case NI_AVX_Or:
|
||||
case NI_AVX2_Or:
|
||||
case NI_AVX512F_Or:
|
||||
case NI_AVX512DQ_Or:
|
||||
#endif
|
||||
{
|
||||
// Handle `x | x == x`
|
||||
|
@ -8068,6 +8117,8 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunBinary(var_types type,
|
|||
case NI_SSE2_Xor:
|
||||
case NI_AVX_Xor:
|
||||
case NI_AVX2_Xor:
|
||||
case NI_AVX512F_Xor:
|
||||
case NI_AVX512DQ_Xor:
|
||||
#endif
|
||||
{
|
||||
// Handle `x ^ x == 0`
|
||||
|
@ -8144,7 +8195,6 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunTernary(var_types type,
|
|||
{
|
||||
if (IsVNConstant(arg0VN) && IsVNConstant(arg1VN) && IsVNConstant(arg2VN))
|
||||
{
|
||||
|
||||
switch (ni)
|
||||
{
|
||||
case NI_Vector128_WithElement:
|
||||
|
@ -8170,6 +8220,7 @@ ValueNum ValueNumStore::EvalHWIntrinsicFunTernary(var_types type,
|
|||
|
||||
return EvaluateSimdFloatWithElement(this, type, arg0VN, index, value);
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue