public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR target/66818: Define ATTRIBUTE_ALIGNED_VALUE to 32 for IA MCU
@ 2015-07-08 22:53 H.J. Lu
  2015-07-09  6:02 ` Uros Bizjak
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2015-07-08 22:53 UTC (permalink / raw)
  To: gcc-patches, Uros Bizjak

attribute ((aligned)) should align to the minimum of BIGGEST_ALIGNMENT,
which is 4 bytes for -miamcu.

Tested on Linux/x86-64.  OK for trunk?

Thanks.

H.J.
---
gcc/

	PR target/66818
	* config/i386/i386.h (ATTRIBUTE_ALIGNED_VALUE): Defined to 32
	for IA MCU.

gcc/testsuite/

	PR target/66818
	* gcc.target/i386/pr66818.c: New test.
---
 gcc/config/i386/i386.h                  | 2 +-
 gcc/testsuite/gcc.target/i386/pr66818.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr66818.c

diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index f357e79..74334ff 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -811,7 +811,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
 
 /* Alignment value for attribute ((aligned)).  It is a constant since
    it is the part of the ABI.  We shouldn't change it with -mavx.  */
-#define ATTRIBUTE_ALIGNED_VALUE 128
+#define ATTRIBUTE_ALIGNED_VALUE (TARGET_IAMCU ? 32 : 128)
 
 /* Decide whether a variable of mode MODE should be 128 bit aligned.  */
 #define ALIGN_MODE_128(MODE) \
diff --git a/gcc/testsuite/gcc.target/i386/pr66818.c b/gcc/testsuite/gcc.target/i386/pr66818.c
new file mode 100644
index 0000000..d90394c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr66818.c
@@ -0,0 +1,5 @@
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2 -mno-sse -mno-mmx -miamcu" } */
+
+struct dummy { int x __attribute__((aligned)); };
+int array[__alignof__(struct dummy) == 4 ? 1 : -1];
-- 
2.4.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-09  6:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-08 22:53 [PATCH] PR target/66818: Define ATTRIBUTE_ALIGNED_VALUE to 32 for IA MCU H.J. Lu
2015-07-09  6:02 ` Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).