summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/volatile-complex.c
diff options
context:
space:
mode:
authorJF Bastien <jfb@google.com>2013-07-17 05:57:42 +0000
committerJF Bastien <jfb@google.com>2013-07-17 05:57:42 +0000
commit27dcbb24e535d4e96eb9c1083d9888b4f5c9e92d (patch)
tree4855645205a89c53469a5c87c37b44b43375a8c9 /clang/test/CodeGen/volatile-complex.c
parentcd4c64d2347e2fd92ab2a2a32e3c315cbdb3fc20 (diff)
downloadbcm5719-llvm-27dcbb24e535d4e96eb9c1083d9888b4f5c9e92d.tar.gz
bcm5719-llvm-27dcbb24e535d4e96eb9c1083d9888b4f5c9e92d.zip
Propagate alignment for _Complex
_Complex load/store didn't have their alignment set properly, which was visible when GCC's torture tests use volatile _Complex. Update some existing tests to check for alignment, and add a new test which also has over-aligned volatile _Complex (since the imaginary part shouldn't be overaligned, only the real part). llvm-svn: 186490
Diffstat (limited to 'clang/test/CodeGen/volatile-complex.c')
-rw-r--r--clang/test/CodeGen/volatile-complex.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/clang/test/CodeGen/volatile-complex.c b/clang/test/CodeGen/volatile-complex.c
new file mode 100644
index 00000000000..b34ec1305e2
--- /dev/null
+++ b/clang/test/CodeGen/volatile-complex.c
@@ -0,0 +1,63 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+volatile _Complex float cf;
+volatile _Complex double cd;
+volatile _Complex float cf32 __attribute__((aligned(32)));
+volatile _Complex double cd32 __attribute__((aligned(32)));
+
+
+// CHECK: define void @test_cf()
+// CHECK-NEXT: entry:
+void test_cf() {
+ // CHECK-NEXT: load volatile float* getelementptr inbounds ({ float, float }* @cf, i32 0, i32 0), align 4
+ // CHECK-NEXT: load volatile float* getelementptr inbounds ({ float, float }* @cf, i32 0, i32 1), align 4
+ (void)(cf);
+ // CHECK-NEXT: [[R:%.*]] = load volatile float* getelementptr inbounds ({ float, float }* @cf, i32 0, i32 0), align 4
+ // CHECK-NEXT: [[I:%.*]] = load volatile float* getelementptr inbounds ({ float, float }* @cf, i32 0, i32 1), align 4
+ // CHECK-NEXT: store volatile float [[R]], float* getelementptr inbounds ({ float, float }* @cf, i32 0, i32 0), align 4
+ // CHECK-NEXT: store volatile float [[I]], float* getelementptr inbounds ({ float, float }* @cf, i32 0, i32 1), align 4
+ (void)(cf=cf);
+ // CHECK-NEXT: ret void
+}
+
+// CHECK: define void @test_cd()
+// CHECK-NEXT: entry:
+void test_cd() {
+ // CHECK-NEXT: load volatile double* getelementptr inbounds ({ double, double }* @cd, i32 0, i32 0), align 8
+ // CHECK-NEXT: load volatile double* getelementptr inbounds ({ double, double }* @cd, i32 0, i32 1), align 8
+ (void)(cd);
+ // CHECK-NEXT: [[R:%.*]] = load volatile double* getelementptr inbounds ({ double, double }* @cd, i32 0, i32 0), align 8
+ // CHECK-NEXT: [[I:%.*]] = load volatile double* getelementptr inbounds ({ double, double }* @cd, i32 0, i32 1), align 8
+ // CHECK-NEXT: store volatile double [[R]], double* getelementptr inbounds ({ double, double }* @cd, i32 0, i32 0), align 8
+ // CHECK-NEXT: store volatile double [[I]], double* getelementptr inbounds ({ double, double }* @cd, i32 0, i32 1), align 8
+ (void)(cd=cd);
+ // CHECK-NEXT: ret void
+}
+
+// CHECK: define void @test_cf32()
+// CHECK-NEXT: entry:
+void test_cf32() {
+ // CHECK-NEXT: load volatile float* getelementptr inbounds ({ float, float }* @cf32, i32 0, i32 0), align 32
+ // CHECK-NEXT: load volatile float* getelementptr inbounds ({ float, float }* @cf32, i32 0, i32 1), align 4
+ (void)(cf32);
+ // CHECK-NEXT: [[R:%.*]] = load volatile float* getelementptr inbounds ({ float, float }* @cf32, i32 0, i32 0), align 32
+ // CHECK-NEXT: [[I:%.*]] = load volatile float* getelementptr inbounds ({ float, float }* @cf32, i32 0, i32 1), align 4
+ // CHECK-NEXT: store volatile float [[R]], float* getelementptr inbounds ({ float, float }* @cf32, i32 0, i32 0), align 32
+ // CHECK-NEXT: store volatile float [[I]], float* getelementptr inbounds ({ float, float }* @cf32, i32 0, i32 1), align 4
+ (void)(cf32=cf32);
+ // CHECK-NEXT: ret void
+}
+
+// CHECK: define void @test_cd32()
+// CHECK-NEXT: entry:
+void test_cd32() {
+ // CHECK-NEXT: load volatile double* getelementptr inbounds ({ double, double }* @cd32, i32 0, i32 0), align 32
+ // CHECK-NEXT: load volatile double* getelementptr inbounds ({ double, double }* @cd32, i32 0, i32 1), align 8
+ (void)(cd32);
+ // CHECK-NEXT: [[R:%.*]] = load volatile double* getelementptr inbounds ({ double, double }* @cd32, i32 0, i32 0), align 32
+ // CHECK-NEXT: [[I:%.*]] = load volatile double* getelementptr inbounds ({ double, double }* @cd32, i32 0, i32 1), align 8
+ // CHECK-NEXT: store volatile double [[R]], double* getelementptr inbounds ({ double, double }* @cd32, i32 0, i32 0), align 32
+ // CHECK-NEXT: store volatile double [[I]], double* getelementptr inbounds ({ double, double }* @cd32, i32 0, i32 1), align 8
+ (void)(cd32=cd32);
+ // CHECK-NEXT: ret void
+}
OpenPOWER on IntegriCloud