-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arm64/SVE: Implemented ConvertToint64
and ConvertToUInt64
#104069
Arm64/SVE: Implemented ConvertToint64
and ConvertToUInt64
#104069
Conversation
updating branch due to assert issue.
@@ -1731,6 +1731,8 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, | |||
{ | |||
case NI_Sve_ConvertToInt32: | |||
case NI_Sve_ConvertToUInt32: | |||
case NI_Sve_ConvertToInt64: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expected to have entries for ConvertToSingle
and ConvertToDouble
here as well. Did you confirm this works for scenario where maskSize != operSize
in lowering?
src/coreclr/jit/lowerarmarch.cpp
Outdated
(embOp->GetHWIntrinsicId() == NI_Sve_ConvertToUInt32)); | ||
assert((embOp->GetHWIntrinsicId() == NI_Sve_ConvertToInt32) || | ||
(embOp->GetHWIntrinsicId() == NI_Sve_ConvertToUInt32) || | ||
(embOp->GetHWIntrinsicId() == NI_Sve_ConvertToInt64) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise here.
opt = intrinEmbMask.baseType == TYP_DOUBLE ? INS_OPTS_D_TO_S : INS_OPTS_SCALABLE_S; | ||
embOpt = intrinEmbMask.baseType == TYP_DOUBLE ? INS_OPTS_D_TO_S : INS_OPTS_SCALABLE_S; | ||
break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs handling of ConvertToSingle
embOpt = intrinEmbMask.baseType == TYP_DOUBLE ? INS_OPTS_D_TO_S : INS_OPTS_SCALABLE_S;
and ConvertToDouble
:
embOpt = intrinEmbMask.baseType == TYP_FLOAT ? INS_OPTS_S_TO_D : INS_OPTS_SCALABLE_D;
which means you can combine ConvertToSingle
with Convert*32
and ConvertToDouble
with Convert*64
.
ConvertToint64
, ConvertToUInt64
, ConvertToDouble
and ConvertToSingle
ConvertToint64
and ConvertToUInt64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments around test. code changes looks good.
@@ -78,9 +78,9 @@ | |||
} | |||
}"; | |||
|
|||
const string SimpleVecOpTest_ValidationLogicForCndSelForNarrowing = @"for (var i = 0; i < Op1ElementCount; i++) | |||
const string SimpleVecOpTest_ValidationLogicForCndSelNarrowing = @"for (var i = 0; i < Op1ElementCount; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted this change -- shouldn't have been in this PR
("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary<string, string> { ["TestName"] = "Sve_ConvertToInt32_int_double", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateIterResult"] = "Helpers.ConvertDoubleToInt32(firstOp[i]) != result[i]", ["GetIterResult"] = "Helpers.ConvertDoubleToInt32(leftOp[i])"}), | ||
("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary<string, string> { ["TestName"] = "Sve_ConvertToUInt32_uint_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToUInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["ValidateIterResult"] = "Helpers.ConvertToUInt32(firstOp[i]) != result[i]", ["GetIterResult"] = "Helpers.ConvertToUInt32(leftOp[i])"}), | ||
("SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary<string, string> { ["TestName"] = "Sve_ConvertToUInt32_uint_double", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConvertToUInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["ValidateIterResult"] = "Helpers.ConvertDoubleToUInt32(firstOp[i]) != result[i]", ["GetIterResult"] = "Helpers.ConvertDoubleToUInt32(leftOp[i])"}), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you delete the 2 empty lines?
@@ -177,7 +177,7 @@ | |||
("_BinaryOpTestTemplate.template", "SecureHashBinOpTest.template", new Dictionary<string, string> { ["TemplateName"] = "SecureHash", ["TemplateValidationLogic"] = SecureHashOpTest_ValidationLogic }), | |||
("_TernaryOpTestTemplate.template", "SecureHashTernOpTest.template", new Dictionary<string, string> { ["TemplateName"] = "SecureHash", ["TemplateValidationLogic"] = SecureHashOpTest_ValidationLogic }), | |||
("_SveUnaryOpTestTemplate.template", "SveSimpleVecOpTest.template", new Dictionary<string, string> { ["TemplateName"] = "Simple", ["TemplateValidationLogic"] = SimpleVecOpTest_ValidationLogic, ["TemplateValidationLogicForCndSel"] = SimpleVecOpTest_ValidationLogicForCndSel }), | |||
("_SveUnaryOpDifferentRetTypeTestTemplate.template", "SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary<string, string> { ["TemplateName"] = "Simple", ["TemplateValidationLogic"] = SimpleVecOpTest_ValidationLogicForNarrowing, ["TemplateValidationLogicForCndSel"] = SimpleVecOpTest_ValidationLogicForCndSelForNarrowing }), | |||
("_SveUnaryOpDifferentRetTypeTestTemplate.template", "SveSimpleVecOpDifferentRetTypeTest.template", new Dictionary<string, string> { ["TemplateName"] = "Simple", ["TemplateValidationLogic"] = SimpleVecOpTest_ValidationLogicForNarrowing, ["TemplateValidationLogicForCndSel"] = SimpleVecOpTest_ValidationLogicForCndSelNarrowing }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise here.
@@ -80,7 +80,7 @@ | |||
|
|||
const string SimpleVecOpTest_ValidationLogicForCndSelForNarrowing = @"for (var i = 0; i < Op1ElementCount; i++) | |||
{ | |||
{Op1BaseType} iterResult = (mask[i] != 0) ? {GetIterResult} : falseVal[i]; | |||
{RetBaseType} iterResult = (mask[i] != 0) ? {GetIterResult} : falseVal[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{RetBaseType} iterResult = (mask[i] != 0) ? {GetIterResult} : falseVal[i]; | |
{Op1BaseType} iterResult = (mask[i] != 0) ? {GetIterResult} : falseVal[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to test this version one more time. Not sure why these changes even appeared, but I think they were supposed to be part of the ConvertToInt32
commit. These changes may be necessary for the tests to run properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/azp |
Supported commands
See additional documentation. |
Contributes to #99957
ConvertToInt64
andConvertToUInt64
stress test output:cc @dotnet/arm64-contrib