aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2009-01-18 16:26:26 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2009-01-18 08:26:26 -0800
commit6e4f11689b8ac84b5f3eb618e88b0b3a9cc74008 (patch)
treed74a458bc64925e0158a42b28d1bdf62ea7614fb /gcc/doc
parent890065bfe4a9d3367568a2f5a9a12b6289f377d0 (diff)
downloadgcc-6e4f11689b8ac84b5f3eb618e88b0b3a9cc74008.zip
gcc-6e4f11689b8ac84b5f3eb618e88b0b3a9cc74008.tar.gz
gcc-6e4f11689b8ac84b5f3eb618e88b0b3a9cc74008.tar.bz2
re PR target/38736 (-mavx can change the ABI via BIGGEST_ALIGNMENT)
gcc/ 2009-01-18 H.J. Lu <hongjiu.lu@intel.com> PR target/38736 * c-common.c (handle_aligned_attribute): Use ATTRIBUTE_ALIGNED_VALUE instead of BIGGEST_ALIGNMENT for default alignment value. * c-cppbuiltin.c (c_cpp_builtins): Define __BIGGEST_ALIGNMENT__. * defaults.h (ATTRIBUTE_ALIGNED_VALUE): New. * config/i386/i386.h (ATTRIBUTE_ALIGNED_VALUE): Likewise. * doc/extend.texi: Update __attribute__ ((aligned)). Document __BIGGEST_ALIGNMENT__. * doc/tm.texi: Document ATTRIBUTE_ALIGNED_VALUE. gcc/testsuite/ 2009-01-18 H.J. Lu <hongjiu.lu@intel.com> PR target/38736 * g++.dg/compat/abi/pr38736_main.C: New. * g++.dg/compat/abi/pr38736_x.C: Likewise. * g++.dg/compat/abi/pr38736_y.C: Likewise. * g++.dg/other/macro-1.C: Likewise. * gcc.dg/macro-1.c: Likewise. * gcc.dg/compat/pr38736_main.c: Likewise. * gcc.dg/compat/pr38736_x.c: Likewise. * gcc.dg/compat/pr38736_y.c: Likewise. From-SVN: r143486
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/extend.texi28
-rw-r--r--gcc/doc/tm.texi5
2 files changed, 22 insertions, 11 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index f131a4d..5a7e2d8 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3697,21 +3697,27 @@ that forces the union to be double-word aligned.
As in the preceding examples, you can explicitly specify the alignment
(in bytes) that you wish the compiler to use for a given variable or
structure field. Alternatively, you can leave out the alignment factor
-and just ask the compiler to align a variable or field to the maximum
-useful alignment for the target machine you are compiling for. For
-example, you could write:
+and just ask the compiler to align a variable or field to the
+default alignment for the target architecture you are compiling for.
+The default alignment is sufficient for all scalar types, but may not be
+enough for all vector types on a target which supports vector operations.
+The default alignment is fixed for a particular target ABI.
+
+Gcc also provides a target specific macro @code{__BIGGEST_ALIGNMENT__},
+which is the largest alignment ever used for any data type on the
+target machine you are compiling for. For example, you could write:
@smallexample
-short array[3] __attribute__ ((aligned));
+short array[3] __attribute__ ((aligned (__BIGGEST_ALIGNMENT__)));
@end smallexample
-Whenever you leave out the alignment factor in an @code{aligned} attribute
-specification, the compiler automatically sets the alignment for the declared
-variable or field to the largest alignment which is ever used for any data
-type on the target machine you are compiling for. Doing this can often make
-copy operations more efficient, because the compiler can use whatever
-instructions copy the biggest chunks of memory when performing copies to
-or from the variables or fields that you have aligned this way.
+The compiler automatically sets the alignment for the declared
+variable or field to @code{__BIGGEST_ALIGNMENT__}. Doing this can
+often make copy operations more efficient, because the compiler can
+use whatever instructions copy the biggest chunks of memory when
+performing copies to or from the variables or fields that you have
+aligned this way. Note that the value of @code{__BIGGEST_ALIGNMENT__}
+may change depending on command line options.
When used on a struct, or struct member, the @code{aligned} attribute can
only increase the alignment; in order to decrease it, the @code{packed}
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index d748a75..92de6e5 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -1105,6 +1105,11 @@ Alignment, in bits, a C conformant malloc implementation has to
provide. If not defined, the default value is @code{BITS_PER_WORD}.
@end defmac
+@defmac ATTRIBUTE_ALIGNED_VALUE
+Alignment used by the @code{__attribute__ ((aligned))} construct. If
+not defined, the default value is @code{BIGGEST_ALIGNMENT}.
+@end defmac
+
@defmac MINIMUM_ATOMIC_ALIGNMENT
If defined, the smallest alignment, in bits, that can be given to an
object that can be referenced in one operation, without disturbing any