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

CIRGen support for __sync_{and,or,xor,nand}_and_fetch builtin #1273

Open
bcardosolopes opened this issue Jan 9, 2025 · 6 comments
Open

CIRGen support for __sync_{and,or,xor,nand}_and_fetch builtin #1273

bcardosolopes opened this issue Jan 9, 2025 · 6 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@bcardosolopes
Copy link
Member

add and sub are already supported.

@bcardosolopes bcardosolopes added the good first issue Good for newcomers label Jan 9, 2025
@moar55
Copy link

moar55 commented Jan 9, 2025

I would like to take this issue.

@bcardosolopes
Copy link
Member Author

@moar55 neat, assigned to you!

@moar55
Copy link

moar55 commented Jan 27, 2025

Hey, I was looking at the previous tests. And was wondering why does sync_op_and_fetch translates to

cir.atomic.fetch(add, {{%.*}} : !cir.ptr<!s8i>, [[VAL0]] : !s8i, seq_cst) fetch_first : !s8i
cir.binop(add, [[RES0]], [[VAL0]]) : !s8i

Wouldn't it be less instructions if fetch_first was not set (and thus the following binop wouldn't be needed.
Or is there a reason for this that I may not be aware of?

@moar55
Copy link

moar55 commented Jan 27, 2025

One other thing more related to this task, I don't see the BinOpKind::Nand. Should this be added along with the lowering logic to mlir::llvm?

@bcardosolopes
Copy link
Member Author

Wouldn't it be less instructions if fetch_first was not set (and thus the following binop wouldn't be needed.
Or is there a reason for this that I may not be aware of?

What have you found when you compared to LLVM output from OG? We go about the same

@bcardosolopes
Copy link
Member Author

bcardosolopes commented Jan 29, 2025

One other thing more related to this task, I don't see the BinOpKind::Nand. Should this be added along with the lowering logic to mlir::llvm?

Do you need it as part of implementing anything? If so yes, if just for completeness best we don't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants