[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 05:39:50 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:

I don't think it is a problem, or it is not fixable if you like to call it a problem.
As a comparison, `exchange_half` does generate code under SSE1, but the code is invalid. You cannot call an external library successfully with a different calling conversion or mutual link with CU built with SSE2 and above.

In my opinion, spending efforts on invalid usage is unwise comparing to splitting the test case.

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


More information about the llvm-commits mailing list