Skip to content
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

Clean up in LowerFusedMultiplyAdd #110113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Nov 23, 2024

Also, closes #110109

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 23, 2024
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@EgorBo
Copy link
Member Author

EgorBo commented Nov 25, 2024

PTAL @tannergooding @dotnet/jit-contrib

Just a clean up + the previous implementation just gave up if one of the arguments is e.g. GT_CNS_DBL, hence, this PR fixes #110109

@EgorBo EgorBo requested a review from tannergooding November 25, 2024 08:20
for (size_t i = 1; i <= 3; i++)
{
GenTree* arg = node->Op(i);

if (!arg->OperIsHWIntrinsic() || (arg->AsHWIntrinsic()->GetHWIntrinsicId() != NI_Vector128_CreateScalarUnsafe))
if (arg->OperIsHWIntrinsic() && (arg->AsHWIntrinsic()->GetHWIntrinsicId() == NI_Vector128_CreateScalarUnsafe))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, we can make this a bit simpler/more readable:

Suggested change
if (arg->OperIsHWIntrinsic() && (arg->AsHWIntrinsic()->GetHWIntrinsicId() == NI_Vector128_CreateScalarUnsafe))
if (arg->OperIsHWIntrinsic(NI_Vector128_CreateScalarUnsafe))

@@ -1330,49 +1330,29 @@ void Lowering::LowerHWIntrinsicCC(GenTreeHWIntrinsic* node, NamedIntrinsic newIn
void Lowering::LowerFusedMultiplyAdd(GenTreeHWIntrinsic* node)
{
assert(node->GetHWIntrinsicId() == NI_FMA_MultiplyAddScalar);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really for this PR; but the changes you've made here are notably a bit more supportive/general-purpose.

It would be nice to expand this helper to support the non-scalar FusedMultiplyAdd APIs as well and to support cases like -Vector128.CreateScalarUnsafe(x) (which more generally is just the -x handling needed for vector variants) not just Vector128.CreateScalarUnsafe(-x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FusedMultiplyAdd not using all available instructions
2 participants