mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-08 19:31:06 +08:00
re PR target/39162 (Gcc doesn't warn __m256 when -mavx isn't used)
gcc/ 2009-02-13 H.J. Lu <hongjiu.lu@intel.com> PR target/39162 * config/i386/i386.c (type_natural_mode): Add a new argument. Return the original mode and warn ABI change if vector size is 32byte. (function_arg_advance): Updated. (function_arg): Likewise. (ix86_function_value): Likewise. (ix86_return_in_memory): Likewise. (ix86_sol10_return_in_memory): Likewise. (ix86_gimplify_va_arg): Likewise. (function_arg_32): Don't warn ABX ABI change here. (function_arg_64): Likewise. gcc/testsuite/ 2009-02-13 H.J. Lu <hongjiu.lu@intel.com> PR target/39162 * gcc.target/i386/pr39162.c: New. From-SVN: r144157
This commit is contained in:
parent
df20009b99
commit
53f648e2a4
@ -1,3 +1,18 @@
|
||||
2009-02-13 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR target/39162
|
||||
* config/i386/i386.c (type_natural_mode): Add a new argument.
|
||||
Return the original mode and warn ABI change if vector size
|
||||
is 32byte.
|
||||
(function_arg_advance): Updated.
|
||||
(function_arg): Likewise.
|
||||
(ix86_function_value): Likewise.
|
||||
(ix86_return_in_memory): Likewise.
|
||||
(ix86_sol10_return_in_memory): Likewise.
|
||||
(ix86_gimplify_va_arg): Likewise.
|
||||
(function_arg_32): Don't warn ABX ABI change here.
|
||||
(function_arg_64): Likewise.
|
||||
|
||||
2008-02-13 Bernd Schmidt <bernd.schmidt@analog.com>
|
||||
|
||||
* loop-iv.c (implies_p): In the final case, test that operands 0
|
||||
|
@ -4719,17 +4719,21 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, /* Argument info to initialize */
|
||||
modes, the generic vector support in gcc will choose some non-vector mode
|
||||
in order to implement the type. By computing the natural mode, we'll
|
||||
select the proper ABI location for the operand and not depend on whatever
|
||||
the middle-end decides to do with these vector types. */
|
||||
the middle-end decides to do with these vector types.
|
||||
|
||||
The midde-end can't deal with the vector types > 16 bytes. In this
|
||||
case, we return the original mode and warn ABI change if CUM isn't
|
||||
NULL. */
|
||||
|
||||
static enum machine_mode
|
||||
type_natural_mode (const_tree type)
|
||||
type_natural_mode (const_tree type, CUMULATIVE_ARGS *cum)
|
||||
{
|
||||
enum machine_mode mode = TYPE_MODE (type);
|
||||
|
||||
if (TREE_CODE (type) == VECTOR_TYPE && !VECTOR_MODE_P (mode))
|
||||
{
|
||||
HOST_WIDE_INT size = int_size_in_bytes (type);
|
||||
if ((size == 8 || size == 16)
|
||||
if ((size == 8 || size == 16 || size == 32)
|
||||
/* ??? Generic code allows us to create width 1 vectors. Ignore. */
|
||||
&& TYPE_VECTOR_SUBPARTS (type) > 1)
|
||||
{
|
||||
@ -4744,7 +4748,24 @@ type_natural_mode (const_tree type)
|
||||
for (; mode != VOIDmode; mode = GET_MODE_WIDER_MODE (mode))
|
||||
if (GET_MODE_NUNITS (mode) == TYPE_VECTOR_SUBPARTS (type)
|
||||
&& GET_MODE_INNER (mode) == innermode)
|
||||
return mode;
|
||||
{
|
||||
if (size == 32 && !TARGET_AVX)
|
||||
{
|
||||
static bool warnedavx;
|
||||
|
||||
if (cum
|
||||
&& !warnedavx
|
||||
&& cum->warn_avx)
|
||||
{
|
||||
warnedavx = true;
|
||||
warning (0, "AVX vector argument without AVX "
|
||||
" enabled changes the ABI");
|
||||
}
|
||||
return TYPE_MODE (type);
|
||||
}
|
||||
else
|
||||
return mode;
|
||||
}
|
||||
|
||||
gcc_unreachable ();
|
||||
}
|
||||
@ -5539,7 +5560,7 @@ function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
|
||||
words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
|
||||
|
||||
if (type)
|
||||
mode = type_natural_mode (type);
|
||||
mode = type_natural_mode (type, NULL);
|
||||
|
||||
if (TARGET_64BIT && (cum ? cum->call_abi : DEFAULT_ABI) == MS_ABI)
|
||||
function_arg_advance_ms_64 (cum, bytes, words);
|
||||
@ -5567,7 +5588,7 @@ function_arg_32 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
|
||||
enum machine_mode orig_mode, tree type,
|
||||
HOST_WIDE_INT bytes, HOST_WIDE_INT words)
|
||||
{
|
||||
static bool warnedavx, warnedsse, warnedmmx;
|
||||
static bool warnedsse, warnedmmx;
|
||||
|
||||
/* Avoid the AL settings for the Unix64 ABI. */
|
||||
if (mode == VOIDmode)
|
||||
@ -5647,12 +5668,6 @@ function_arg_32 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
|
||||
case V4DImode:
|
||||
if (!type || !AGGREGATE_TYPE_P (type))
|
||||
{
|
||||
if (!TARGET_AVX && !warnedavx && cum->warn_avx)
|
||||
{
|
||||
warnedavx = true;
|
||||
warning (0, "AVX vector argument without AVX enabled "
|
||||
"changes the ABI");
|
||||
}
|
||||
if (cum->sse_nregs)
|
||||
return gen_reg_or_parallel (mode, orig_mode,
|
||||
cum->sse_regno + FIRST_SSE_REG);
|
||||
@ -5686,8 +5701,6 @@ static rtx
|
||||
function_arg_64 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
|
||||
enum machine_mode orig_mode, tree type, int named)
|
||||
{
|
||||
static bool warnedavx;
|
||||
|
||||
/* Handle a hidden AL argument containing number of registers
|
||||
for varargs x86-64 functions. */
|
||||
if (mode == VOIDmode)
|
||||
@ -5713,15 +5726,6 @@ function_arg_64 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
|
||||
case V4DImode:
|
||||
/* In 64bit, we pass TImode in interger registers and OImode on
|
||||
stack. */
|
||||
if (!type || !AGGREGATE_TYPE_P (type))
|
||||
{
|
||||
if (!TARGET_AVX && !warnedavx && cum->warn_avx)
|
||||
{
|
||||
warnedavx = true;
|
||||
warning (0, "AVX vector argument without AVX enabled "
|
||||
"changes the ABI");
|
||||
}
|
||||
}
|
||||
|
||||
/* Unnamed 256bit vector mode parameters are passed on stack. */
|
||||
if (!named)
|
||||
@ -5799,7 +5803,7 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode omode,
|
||||
/* To simplify the code below, represent vector types with a vector mode
|
||||
even if MMX/SSE are not active. */
|
||||
if (type && TREE_CODE (type) == VECTOR_TYPE)
|
||||
mode = type_natural_mode (type);
|
||||
mode = type_natural_mode (type, cum);
|
||||
|
||||
if (TARGET_64BIT && (cum ? cum->call_abi : DEFAULT_ABI) == MS_ABI)
|
||||
return function_arg_ms_64 (cum, mode, omode, named, bytes);
|
||||
@ -6115,7 +6119,7 @@ ix86_function_value (const_tree valtype, const_tree fntype_or_decl,
|
||||
enum machine_mode mode, orig_mode;
|
||||
|
||||
orig_mode = TYPE_MODE (valtype);
|
||||
mode = type_natural_mode (valtype);
|
||||
mode = type_natural_mode (valtype, NULL);
|
||||
return ix86_function_value_1 (valtype, fntype_or_decl, orig_mode, mode);
|
||||
}
|
||||
|
||||
@ -6191,14 +6195,14 @@ ix86_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
|
||||
#ifdef SUBTARGET_RETURN_IN_MEMORY
|
||||
return SUBTARGET_RETURN_IN_MEMORY (type, fntype);
|
||||
#else
|
||||
const enum machine_mode mode = type_natural_mode (type);
|
||||
const enum machine_mode mode = type_natural_mode (type, NULL);
|
||||
|
||||
if (TARGET_64BIT_MS_ABI)
|
||||
return return_in_memory_ms_64 (type, mode);
|
||||
else if (TARGET_64BIT)
|
||||
return return_in_memory_64 (type, mode);
|
||||
else
|
||||
return return_in_memory_32 (type, mode);
|
||||
return return_in_memory_ms_64 (type, mode);
|
||||
else if (TARGET_64BIT)
|
||||
return return_in_memory_64 (type, mode);
|
||||
else
|
||||
return return_in_memory_32 (type, mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -6211,7 +6215,7 @@ bool
|
||||
ix86_sol10_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int size;
|
||||
enum machine_mode mode = type_natural_mode (type);
|
||||
enum machine_mode mode = type_natural_mode (type, NULL);
|
||||
|
||||
if (TARGET_64BIT)
|
||||
return return_in_memory_64 (type, mode);
|
||||
@ -6665,7 +6669,7 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
|
||||
size = int_size_in_bytes (type);
|
||||
rsize = (size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
|
||||
|
||||
nat_mode = type_natural_mode (type);
|
||||
nat_mode = type_natural_mode (type, NULL);
|
||||
switch (nat_mode)
|
||||
{
|
||||
case V8SFmode:
|
||||
|
@ -1,3 +1,8 @@
|
||||
2009-02-13 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR target/39162
|
||||
* gcc.target/i386/pr39162.c: New.
|
||||
|
||||
2009-02-13 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
PR c/35444
|
||||
|
10
gcc/testsuite/gcc.target/i386/pr39162.c
Normal file
10
gcc/testsuite/gcc.target/i386/pr39162.c
Normal file
@ -0,0 +1,10 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -msse2 -mno-avx" } */
|
||||
|
||||
typedef long long __m256i __attribute__ ((__vector_size__ (32), __may_alias__));
|
||||
|
||||
__m256i
|
||||
bar (__m256i x) /* { dg-warning "AVX" "" } */
|
||||
{
|
||||
return x;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user