[clang] [llvm] [mlir] [openmp] [OMPIRBuilder] Fix atomic compare `==` on `x86-64` long double (PR #226567)
Akash Manna via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 19 22:09:36 PST 2026
================
@@ -199,6 +199,33 @@ llvm.func @compare_capture_float_failonly(%x : !llvm.ptr, %e : !llvm.ptr, %d : !
llvm.return
}
+// f80 postfix compare+capture: the value is padded to 16 bytes, so the old
+// value comes out of the i128 PHI through trunc and bitcast.
+// CHECK-LABEL: define void @compare_capture_f80_postfix(
+// CHECK: load atomic i128, ptr %{{.*}} monotonic
+// CHECK: fcmp oeq x86_fp80
+// CHECK: cmpxchg ptr %{{.*}}, i128 %{{.*}}, i128 %{{.*}} monotonic monotonic
+// CHECK: {{.*}}.atomic.exit:
+// CHECK: %[[OK:.*]] = phi i1 [ false,
+// CHECK: %[[OLD_BITS:.*]] = trunc i128 %{{.*}} to i80
+// CHECK: %[[OLD_FP:.*]] = bitcast i80 %[[OLD_BITS]] to x86_fp80
+// CHECK: %[[NEW:.*]] = select i1 %[[OK]], x86_fp80 %{{.*}}, x86_fp80 %[[OLD_FP]]
----------------
akash-manna-sky wrote:
Done, the PHI, the d load (through its zext into the cmpxchg) and v are bound and checked at their uses.
https://github.com/llvm/llvm-project/pull/226567
More information about the cfe-commits
mailing list