[PATCH] D146425: [SystemZ] Enable AtomicExpandPass for i128

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 05:33:35 PDT 2023


jonpa updated this revision to Diff 506928.
jonpa added a comment.

New tests:

- gnu-atomic_is_lock_free.c

I wanted to write a test here for different types of alignments as well as for a null pointer, which I expected to return true for 16-byte aligned and null pointer, and false for underaligned pointers (which is not what happened on either compiler).

Clang:
atomic_is_lock_free: emits libcalls with pointer, True with null pointer (same for __c11_is_atomic_lock_free).
atomic_always_lock_free: False with both pointers, True with null pointer. Should return True with 16-byte aligned pointer..?

GCC:
Returns True in all cases except for __c11_is_atomic_lock_free, which it does not seem to recognize.
Should return False/libcall for 8-byte aligned pointer..?

- atomic-alignment.c

Clang: aligns to 16 bytes.
GCC: aligns to 8 bytes.

Per the above, I see these shortcomings in clang:

- Not returning True for atomic_ is/always _lock_free in case of 16-byte aligned pointer (not sure if strictly needed for correctness).
- Clang aligns the atomic int128 to 16 bytes, which is not what GCC is doing (only 8 bytes with GCC).

At least the alignment difference in the latter test case needs to be fixed, right?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146425/new/

https://reviews.llvm.org/D146425

Files:
  clang/lib/Basic/Targets/SystemZ.h
  clang/test/CodeGen/SystemZ/atomic-alignment.c
  clang/test/CodeGen/SystemZ/gnu-atomic-builtins-i128-16Al.c
  clang/test/CodeGen/SystemZ/gnu-atomic-builtins-i128-8Al.c
  clang/test/CodeGen/SystemZ/gnu-atomic-builtins-i16.c
  clang/test/CodeGen/SystemZ/gnu-atomic-builtins-i32.c
  clang/test/CodeGen/SystemZ/gnu-atomic-builtins-i64.c
  clang/test/CodeGen/SystemZ/gnu-atomic-builtins-i8.c
  clang/test/CodeGen/SystemZ/gnu-atomic_is_lock_free.c
  llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
  llvm/lib/Target/SystemZ/SystemZISelLowering.h
  llvm/lib/Target/SystemZ/SystemZRegisterInfo.cpp
  llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
  llvm/test/CodeGen/SystemZ/atomicrmw-ops-i128.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146425.506928.patch
Type: text/x-patch
Size: 79399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230321/ede343f7/attachment-0001.bin>


More information about the llvm-commits mailing list