diff options
author | Yufeng Zhang <yufeng.zhang@arm.com> | 2013-07-23 12:29:51 +0000 |
---|---|---|
committer | Yufeng Zhang <yufeng@gcc.gnu.org> | 2013-07-23 12:29:51 +0000 |
commit | 00edcfbe01b2bd34ff997984a6e73bcc184c727c (patch) | |
tree | fa1de50320142b4c6304113e829f41e14e3dbee3 | |
parent | 43be9a95d93785cb99ea5168f9c0538291e6e193 (diff) | |
download | gcc-00edcfbe01b2bd34ff997984a6e73bcc184c727c.zip gcc-00edcfbe01b2bd34ff997984a6e73bcc184c727c.tar.gz gcc-00edcfbe01b2bd34ff997984a6e73bcc184c727c.tar.bz2 |
[AArch64, ILP32] 5/6 Pad pointer-typed stack argument downward in ILP32.
gcc/
* config/aarch64/aarch64.c (aarch64_pad_arg_upward): In big-endian,
pad pointer-typed argument downward.
gcc/testsuite/
* gcc.target/aarch64/test-ptr-arg-on-stack-1.c: New test.
From-SVN: r201168
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/test-ptr-arg-on-stack-1.c | 39 |
4 files changed, 51 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c8d6a1b..df9bb94 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2013-07-23 Yufeng Zhang <yufeng.zhang@arm.com> + * config/aarch64/aarch64.c (aarch64_pad_arg_upward): In big-endian, + pad pointer-typed argument downward. + +2013-07-23 Yufeng Zhang <yufeng.zhang@arm.com> + * config/aarch64/aarch64.h (TARGET_CPU_CPP_BUILTINS): Define _ILP32 and __ILP32__ when the ILP32 model is in use. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index da041f8..73e8657 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1612,11 +1612,12 @@ aarch64_pad_arg_upward (enum machine_mode mode, const_tree type) if (!BYTES_BIG_ENDIAN) return true; - /* Otherwise, integral types and floating point types are padded downward: + /* Otherwise, integral, floating-point and pointer types are padded downward: the least significant byte of a stack argument is passed at the highest byte address of the stack slot. */ if (type - ? (INTEGRAL_TYPE_P (type) || SCALAR_FLOAT_TYPE_P (type)) + ? (INTEGRAL_TYPE_P (type) || SCALAR_FLOAT_TYPE_P (type) + || POINTER_TYPE_P (type)) : (SCALAR_INT_MODE_P (mode) || SCALAR_FLOAT_MODE_P (mode))) return false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e715ca5..7df09a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2013-07-23 Yufeng Zhang <yufeng.zhang@arm.com> + * gcc.target/aarch64/test-ptr-arg-on-stack-1.c: New test. + +2013-07-23 Yufeng Zhang <yufeng.zhang@arm.com> + * gcc.dg/20020219-1.c: Skip the test on aarch64*-*-* in ilp32. * gcc.target/aarch64/aapcs64/test_18.c (struct y): Change the field type from long to long long. diff --git a/gcc/testsuite/gcc.target/aarch64/test-ptr-arg-on-stack-1.c b/gcc/testsuite/gcc.target/aarch64/test-ptr-arg-on-stack-1.c new file mode 100644 index 0000000..bb68e0a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/test-ptr-arg-on-stack-1.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline" } */ + +/* Test pass-by-reference and pointer-typed argument passing on stack. + This test shall pass on any of the following four combinitions: + {big-endian, little-endian} {LP64, ILP32}. */ + +struct s5 +{ + double a; + double b; + double c; + double d; + double e; +} gS = {1.0, 2.0, 3.0, 4.0, 5.0}; + +double __attribute__ ((noinline)) +foo (struct s5 p1, struct s5 p2, struct s5 p3, struct s5 p4, + struct s5 p5, struct s5 p6, struct s5 p7, struct s5 p8, + struct s5 p9) +{ + asm (""); + return p9.c; +} + +void abort (void); +int printf (const char *, ...); + +int main (void) +{ + printf ("Here we print out some values and more importantly hope that" + " the stack is getting a bit dirty for the bug to manifest itself" + "\n\t%f, %f, %f, %f, %f\n", gS.a, gS.b, gS.c, gS.d, gS.e); + + if (foo (gS, gS, gS, gS, gS, gS, gS, gS, gS) != 3.0) + abort (); + + return 0; +} |