Commit 00edcfbe by Yufeng Zhang Committed by Yufeng Zhang

[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
parent 43be9a95
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.
......
......@@ -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;
......
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.
......
/* { 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment