Skip to content

Conversation

@vishruth-thimmaiah
Copy link
Contributor

Adds support for the __sync_swap builtin.

Adds support for the __sync_swap builtin

Signed-off-by: vishruth-thimmaiah <[email protected]>
@bcardosolopes bcardosolopes changed the title feat: add support for the __sync_swap builtin [CIR] Add support for __sync_swap builtin Nov 7, 2025
Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

Thanks for working on this. One minor nit and this LGTM

// CHECK: cir.atomic.fetch(xchg, {{.*}} : !cir.ptr<!s32i>, {{.*}} : !s32i, seq_cst) fetch_first : !s32i

// LLVM-LABEL: @_Z4swapPii
// LLVM: atomicrmw xchg ptr {{.*}}, i32 {{.*}} seq_cst, align 4
Copy link
Member

@bcardosolopes bcardosolopes Nov 7, 2025

Choose a reason for hiding this comment

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

Nit: please add OGCG lines too (see clang/test/CIR/CodeGen/alignment.c for examples). No need to add it for the existing tests, just the new ones are fine.

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.

2 participants