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

[GlobalISel] Add constant folding support for G_FMA/G_FMAD in the combiner. #65659

Merged
merged 2 commits into from
Sep 9, 2023

Conversation

aemerson
Copy link
Contributor

@aemerson aemerson commented Sep 7, 2023

No description provided.

MatchInfo = ConstantFP::get(MI.getMF()->getFunction().getContext(), Op1F);
break;
case TargetOpcode::G_FMAD: {
APFloat Res = (Op1F * Op2F) + Op3F;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should just fold the same as FMA, that's what the IR does for fmuladd. This is also making this host dependent on compiler choice to contract

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't the whole point of having 2 different intrinsics that we have different behaviour?

Also, this isn't host dependent because this is still doing APFloat arithmetic through the operator overloads.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a codegen selected behavior. You may get fma or muladd

@aemerson aemerson merged commit eaab324 into llvm:main Sep 9, 2023
2 checks passed
@aemerson aemerson deleted the fma-cfold branch September 9, 2023 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants