[PATCH] Bugfix for Codegen of atomic load/store ops.

John McCall rjmccall at gmail.com
Wed Dec 3 12:35:38 PST 2014

Thanks for taking this on.  Please test all the basic atomic operations, not just loads and stores, and ensure that the extra bits take on some sensible behavior.

Comment at: test/CodeGen/x86_64-atomic-long_double.c:7
@@ +6,3 @@
+  // CHECK: load atomic i128*
+  // CHECK: bitcast x86_fp80* %{{.+}} to i128*
+  // CHECK: store i128 %{{.+}}, i128*
You need to be more specific in this test.  You should be able to match the alloca.

Comment at: test/CodeGen/x86_64-atomic-long_double.c:14
@@ +13,3 @@
+void  test_store(_Atomic long double *addr, long double val) {
+  // CHECK-LABEL: @test_store
This isn't good enough; x86_fp80's store size doesn't fill its rounded-up size.  So you also need to ensure that the extra bits have some consistent value — i.e. zero.  In other words, there needs to be a memset of the alloca to zero before you can store the long double into it.


More information about the cfe-commits mailing list