summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorSunil Srivastava <sunil_srivastava@playstation.sony.com>2016-02-05 20:50:02 +0000
committerSunil Srivastava <sunil_srivastava@playstation.sony.com>2016-02-05 20:50:02 +0000
commit0ce2f227e83bb46da47921165792eaa26002a9e9 (patch)
tree4c0349fab2cfa069e223914873a5f3c3212c2ff3 /clang/test
parent00ab73dcb0d602608a0851bb61aa378ef5ed3215 (diff)
downloadbcm5719-llvm-0ce2f227e83bb46da47921165792eaa26002a9e9.tar.gz
bcm5719-llvm-0ce2f227e83bb46da47921165792eaa26002a9e9.zip
Do not honor explicit alignment attribute on fields for PS4.
This change reverts r257462 for PS4 triple. Differential Revision: http://reviews.llvm.org/D16788 llvm-svn: 259916
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Sema/bitfield-layout.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/clang/test/Sema/bitfield-layout.c b/clang/test/Sema/bitfield-layout.c
index 3affa21a365..7b434dddcf7 100644
--- a/clang/test/Sema/bitfield-layout.c
+++ b/clang/test/Sema/bitfield-layout.c
@@ -2,6 +2,7 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=arm-linux-gnueabihf
// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=aarch64-linux-gnu
// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=x86_64-pc-linux-gnu
+// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=x86_64-scei-ps4
// expected-no-diagnostics
#include <stddef.h>
@@ -96,9 +97,15 @@ struct g0 {
char c;
};
+#if defined(__PS4__)
+CHECK_SIZE(struct, g0, 16);
+CHECK_ALIGN(struct, g0, 16);
+CHECK_OFFSET(struct, g0, c, 2);
+#else
CHECK_SIZE(struct, g0, 32);
CHECK_ALIGN(struct, g0, 16);
CHECK_OFFSET(struct, g0, c, 17);
+#endif
// Bit-field with explicit align smaller than normal.
struct g1 {
@@ -109,7 +116,11 @@ struct g1 {
CHECK_SIZE(struct, g1, 4);
CHECK_ALIGN(struct, g1, 4);
+#if defined(__PS4__)
+CHECK_OFFSET(struct, g1, c, 2);
+#else
CHECK_OFFSET(struct, g1, c, 3);
+#endif
// Same as above but without explicit align.
struct g2 {
@@ -130,9 +141,14 @@ struct __attribute__((packed)) g3 {
char c;
};
-CHECK_SIZE(struct, g3, 32);
CHECK_ALIGN(struct, g3, 16);
+#if defined(__PS4__)
+CHECK_SIZE(struct, g3, 16);
+CHECK_OFFSET(struct, g3, c, 2);
+#else
+CHECK_SIZE(struct, g3, 32);
CHECK_OFFSET(struct, g3, c, 17);
+#endif
struct __attribute__((packed)) g4 {
char a;
@@ -142,7 +158,11 @@ struct __attribute__((packed)) g4 {
CHECK_SIZE(struct, g4, 4);
CHECK_ALIGN(struct, g4, 2);
+#if defined(__PS4__)
+CHECK_OFFSET(struct, g4, c, 2);
+#else
CHECK_OFFSET(struct, g4, c, 3);
+#endif
struct g5 {
char : 1;
@@ -162,28 +182,44 @@ struct g7 {
char : 1;
__attribute__((aligned(1))) int n : 25;
};
+#if defined(__PS4__)
+CHECK_SIZE(struct, g7, 4);
+#else
CHECK_SIZE(struct, g7, 8);
+#endif
CHECK_ALIGN(struct, g7, 4);
struct __attribute__((packed)) g8 {
char : 1;
__attribute__((aligned(1))) int n : 25;
};
+#if defined(__PS4__)
+CHECK_SIZE(struct, g8, 4);
+#else
CHECK_SIZE(struct, g8, 5);
+#endif
CHECK_ALIGN(struct, g8, 1);
struct g9 {
__attribute__((aligned(1))) char a : 2, b : 2, c : 2, d : 2, e : 2;
int i;
};
+#if defined(__PS4__)
+CHECK_SIZE(struct, g9, 8);
+#else
CHECK_SIZE(struct, g9, 12);
+#endif
CHECK_ALIGN(struct, g9, 4);
struct __attribute__((packed)) g10 {
__attribute__((aligned(1))) char a : 2, b : 2, c : 2, d : 2, e : 2;
int i;
};
+#if defined(__PS4__)
+CHECK_SIZE(struct, g10, 6);
+#else
CHECK_SIZE(struct, g10, 9);
+#endif
CHECK_ALIGN(struct, g10, 1);
struct g11 {
OpenPOWER on IntegriCloud