Skip to content

[CIR][CIRGen] Simplify __builtin_elementwise_abs #1393

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

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

FantasqueX
Copy link
Collaborator

If type of operand is not integer, it can be handled like what I do in __builtin_elementwise_exp.

Copy link
Member

@Lancern Lancern left a comment

Choose a reason for hiding this comment

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

AFAIK, emitUnaryFPBuiltin does not check for CGF.getBuilder().getIsFPConstrained(), while emitUnaryMaybeConstrainedFPBuiltin does. Although constraint FP arithmetic is not implemented yet, we intentionally leave it there thus we could more easily implement it in the future.

@FantasqueX
Copy link
Collaborator Author

OG uses emitBuiltinWithOneOverloadedType for all elementwise builtin, while uses emitUnaryMaybeConstrainedFPBuiltin for normal builtin as I pointed out in #1376. I don't know whether it is intentional. Maybe should file an issue to upstream clang?

Copy link
Member

@Lancern Lancern left a comment

Choose a reason for hiding this comment

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

OG uses emitBuiltinWithOneOverloadedType for all elementwise builtin, while uses emitUnaryMaybeConstrainedFPBuiltin for normal builtin as I pointed out in #1376.

OK I checked #1376 out and it seems fine. I'm approving this.

@bcardosolopes bcardosolopes merged commit ee515c7 into llvm:main Feb 26, 2025
7 checks passed
xlauko pushed a commit to xlauko/clangir that referenced this pull request Feb 28, 2025
If type of operand is not integer, it can be handled like what I do in
`__builtin_elementwise_exp`.
xlauko pushed a commit to xlauko/clangir that referenced this pull request Feb 28, 2025
If type of operand is not integer, it can be handled like what I do in
`__builtin_elementwise_exp`.
@FantasqueX
Copy link
Collaborator Author

FantasqueX commented Mar 13, 2025

@Lancern Hi, I agree with you that __builtin_elementwise should honor FP mode. So, I filed an issue to clang llvm/llvm-project#131122
If they change in clang, I'll change in clangir :)

@FantasqueX FantasqueX deleted the elementwise-abs branch March 13, 2025 11:06
lanza pushed a commit that referenced this pull request Mar 18, 2025
If type of operand is not integer, it can be handled like what I do in
`__builtin_elementwise_exp`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants