From: H.J. Lu Date: Fri, 22 Mar 2013 17:00:36 +0000 (+0000) Subject: Set callee_pass_avx256_p before emitting call instruction X-Git-Tag: releases/gcc-4.6.4~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a8d26fe3d87f58170657cc102999b540cea6f48;p=thirdparty%2Fgcc.git Set callee_pass_avx256_p before emitting call instruction gcc/ PR target/56560 * config/i386/i386.c (init_cumulative_args): Also set cum->callee_return_avx256_p. (ix86_function_arg): Set cum->callee_pass_avx256_p. Set cfun->machine->callee_pass_avx256_p only when MODE == VOIDmode. * config/i386/i386.h (ix86_args): Add callee_pass_avx256_p and callee_return_avx256_p. gcc/ PR target/56560 * gcc.target/i386/pr56560.c: New file. From-SVN: r196979 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7ad3623c2272..1a8f96e8480d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2013-03-22 H.J. Lu + + PR target/56560 + * config/i386/i386.c (init_cumulative_args): Also set + cum->callee_return_avx256_p. + (ix86_function_arg): Set cum->callee_pass_avx256_p. Set + cfun->machine->callee_pass_avx256_p only when MODE == VOIDmode. + + * config/i386/i386.h (ix86_args): Add callee_pass_avx256_p and + callee_return_avx256_p. + 2013-03-20 Jack Howarth PR bootstrap/56258 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 436fa4f4f9fc..86804a472a58 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -5938,7 +5938,10 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, /* Argument info to initialize */ { /* The return value of this function uses 256bit AVX modes. */ if (caller) - cfun->machine->callee_return_avx256_p = true; + { + cfun->machine->callee_return_avx256_p = true; + cum->callee_return_avx256_p = true; + } else cfun->machine->caller_return_avx256_p = true; } @@ -7206,11 +7209,20 @@ ix86_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode omode, { /* This argument uses 256bit AVX modes. */ if (cum->caller) - cfun->machine->callee_pass_avx256_p = true; + cum->callee_pass_avx256_p = true; else cfun->machine->caller_pass_avx256_p = true; } + if (cum->caller && mode == VOIDmode) + { + /* This function is called with MODE == VOIDmode immediately + before the call instruction is emitted. We copy callee 256bit + AVX info from the current CUM here. */ + cfun->machine->callee_return_avx256_p = cum->callee_return_avx256_p; + cfun->machine->callee_pass_avx256_p = cum->callee_pass_avx256_p; + } + return arg; } diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 281f9e127656..bb23674d7898 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1494,6 +1494,7 @@ enum reg_class /* 1 if N is a possible register number for function argument passing. */ #define FUNCTION_ARG_REGNO_P(N) ix86_function_arg_regno_p (N) +#ifndef USED_FOR_TARGET /* Define a data type for recording info about an argument list during the scan of that argument list. This data type should hold all necessary information about the function itself @@ -1522,7 +1523,12 @@ typedef struct ix86_args { in SSE registers. Otherwise 0. */ enum calling_abi call_abi; /* Set to SYSV_ABI for sysv abi. Otherwise MS_ABI for ms abi. */ + /* Nonzero if it passes 256bit AVX modes. */ + BOOL_BITFIELD callee_pass_avx256_p : 1; + /* Nonzero if it returns 256bit AVX modes. */ + BOOL_BITFIELD callee_return_avx256_p : 1; } CUMULATIVE_ARGS; +#endif /* Initialize a variable CUM of type CUMULATIVE_ARGS for a call to a function whose data type is FNTYPE. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e6e078069c90..b502eac159bd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-03-22 H.J. Lu + + PR target/56560 + * gcc.target/i386/pr56560.c: New file. + 2013-03-15 Tobias Burnus PR fortran/56615 diff --git a/gcc/testsuite/gcc.target/i386/pr56560.c b/gcc/testsuite/gcc.target/i386/pr56560.c new file mode 100644 index 000000000000..5417cbddedb4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr56560.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mavx -mvzeroupper -dp" } */ + +extern void abort (void); + +typedef double vec_t __attribute__((vector_size(32))); + +struct S { int i1; int i2; int i3; }; + +extern int bar (vec_t, int, int, int, int, int, struct S); + +void foo (vec_t v, struct S s) +{ + int i = bar (v, 1, 2, 3, 4, 5, s); + if (i == 0) + abort (); +} + +/* { dg-final { scan-assembler-not "avx_vzeroupper" } } */