[llvm] AArch64/ARM/PPC/X86: Add some atomic tests (PR #92933)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Wed May 22 23:24:51 PDT 2024


================
@@ -787,3 +787,100 @@ define double @load_double_seq_cst(ptr %fptr) {
   %v = load atomic double, ptr %fptr seq_cst, align 8
   ret double %v
 }
+
+define void @store_bfloat(ptr %fptr, bfloat %v) {
+; X86-LABEL: store_bfloat:
+; X86:       # %bb.0:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movzwl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movw %cx, (%eax)
+; X86-NEXT:    retl
+;
+; X64-SSE-LABEL: store_bfloat:
+; X64-SSE:       # %bb.0:
+; X64-SSE-NEXT:    pextrw $0, %xmm0, %eax
+; X64-SSE-NEXT:    movw %ax, (%rdi)
+; X64-SSE-NEXT:    retq
+;
+; X64-AVX-LABEL: store_bfloat:
+; X64-AVX:       # %bb.0:
+; X64-AVX-NEXT:    vpextrw $0, %xmm0, %eax
+; X64-AVX-NEXT:    movw %ax, (%rdi)
+; X64-AVX-NEXT:    retq
+  store atomic bfloat %v, ptr %fptr unordered, align 2
+  ret void
+}
+
+; Work around issue #92899 by casting to float
----------------
phoebewang wrote:

That cannot be called a fix. It's not a simple "external function" problem, but the basestone functions like `__truncsfhf2`, `__extendhfsf2` that used by almost all operations. They are provided in library with standard ABI. You cannot make a meaningful application work without them.

The half has its own story. It's being supported in i16 prior to ABI definition. We leave it unchanged for ABI undefined case doesn't mean we have to duplicate it for new type.

https://github.com/llvm/llvm-project/pull/92933


More information about the llvm-commits mailing list