summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/volatile-complex.c
diff options
context:
space:
mode:
authorJF Bastien <jfb@google.com>2013-07-18 06:11:45 +0000
committerJF Bastien <jfb@google.com>2013-07-18 06:11:45 +0000
commit2a0a476e74b5650ebf16b061bd617ca7830ba121 (patch)
tree0d7ef84f64bd616078bfdc64ce1ad2045cc7ed66 /clang/test/CodeGen/volatile-complex.c
parent7d7036b8c63eac8e6fe5ad8d398c6e0d548d3f25 (diff)
downloadbcm5719-llvm-2a0a476e74b5650ebf16b061bd617ca7830ba121.tar.gz
bcm5719-llvm-2a0a476e74b5650ebf16b061bd617ca7830ba121.zip
Fix volatile _Complex alignment test on platforms where 64-bit floating point isn't 64-bit aligned
Add x86-64 triple, and check its datalayout. Also add some comments, and use the new CHECK-LABEL. llvm-svn: 186564
Diffstat (limited to 'clang/test/CodeGen/volatile-complex.c')
-rw-r--r--clang/test/CodeGen/volatile-complex.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/clang/test/CodeGen/volatile-complex.c b/clang/test/CodeGen/volatile-complex.c
index 1240aefb6a0..15001e03244 100644
--- a/clang/test/CodeGen/volatile-complex.c
+++ b/clang/test/CodeGen/volatile-complex.c
@@ -1,12 +1,20 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+// Validate that volatile _Complex loads and stores are generated
+// properly, including their alignment (even when overaligned).
+//
+// This test assumes that floats are 32-bit aligned and doubles are
+// 64-bit aligned, and uses x86-64 as a target that should have this
+// datalayout.
+
+// CHECK: target datalayout = "{{.*}}f32:32:32-f64:64:64{{.*}}"
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-LABEL: define void @test_cf()
void test_cf() {
// CHECK: 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
@@ -19,7 +27,7 @@ void test_cf() {
// CHECK-NEXT: ret void
}
-// CHECK: define void @test_cd()
+// CHECK-LABEL: define void @test_cd()
void test_cd() {
// CHECK: 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
@@ -32,7 +40,7 @@ void test_cd() {
// CHECK-NEXT: ret void
}
-// CHECK: define void @test_cf32()
+// CHECK-LABEL: define void @test_cf32()
void test_cf32() {
// CHECK: 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
@@ -45,7 +53,7 @@ void test_cf32() {
// CHECK-NEXT: ret void
}
-// CHECK: define void @test_cd32()
+// CHECK-LABEL: define void @test_cd32()
void test_cd32() {
// CHECK: 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
OpenPOWER on IntegriCloud