Hello! Just following what AVX warnings do.
2014-02-18 Uros Bizjak <ubiz...@gmail.com> PR target/60205 * config/i386/i386.h (struct ix86_args): Add warn_avx512f. * config/i386/i386.c (init_cumulative_args): Initialize warn_avx512f. (type_natural_mode): Warn ABI change when %zmm register is not available for AVX512F vector value passing. testsuite/ChangeLog: 2014-02-18 Uros Bizjak <ubiz...@gmail.com> PR target/60205 * gcc.target/i386/pr60205-1.c: New test. * gcc.target/i386/pr60205-2.c: Ditto. Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32} , will commit to mainline later today. Uros.
Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 207846) +++ config/i386/i386.c (working copy) @@ -6129,6 +6129,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, /* Ar } if (TARGET_MMX) cum->mmx_nregs = MMX_REGPARM_MAX; + cum->warn_avx512f = true; cum->warn_avx = true; cum->warn_sse = true; cum->warn_mmx = true; @@ -6154,6 +6155,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, /* Ar cum->nregs = 0; cum->sse_nregs = 0; cum->mmx_nregs = 0; + cum->warn_avx512f = 0; cum->warn_avx = 0; cum->warn_sse = 0; cum->warn_mmx = 0; @@ -6211,7 +6213,7 @@ type_natural_mode (const_tree type, const CUMULATI if (TREE_CODE (type) == VECTOR_TYPE && !VECTOR_MODE_P (mode)) { HOST_WIDE_INT size = int_size_in_bytes (type); - if ((size == 8 || size == 16 || size == 32) + if ((size == 8 || size == 16 || size == 32 || size == 64) /* ??? Generic code allows us to create width 1 vectors. Ignore. */ && TYPE_VECTOR_SUBPARTS (type) > 1) { @@ -6227,8 +6229,30 @@ type_natural_mode (const_tree type, const CUMULATI if (GET_MODE_NUNITS (mode) == TYPE_VECTOR_SUBPARTS (type) && GET_MODE_INNER (mode) == innermode) { - if (size == 32 && !TARGET_AVX) + if (size == 64 && !TARGET_AVX512F) { + static bool warnedavx512f; + static bool warnedavx512f_ret; + + if (cum + && !warnedavx512f + && cum->warn_avx512f) + { + warnedavx512f = true; + warning (0, "AVX512F vector argument without AVX512F " + "enabled changes the ABI"); + } + else if (in_return & !warnedavx512f_ret) + { + warnedavx512f_ret = true; + warning (0, "AVX512F vector return without AVX512F " + "enabled changes the ABI"); + } + + return TYPE_MODE (type); + } + else if (size == 32 && !TARGET_AVX) + { static bool warnedavx; static bool warnedavx_ret; Index: config/i386/i386.h =================================================================== --- config/i386/i386.h (revision 207846) +++ config/i386/i386.h (working copy) @@ -1606,6 +1606,8 @@ typedef struct ix86_args { is used */ int sse_words; /* # sse words passed so far */ int sse_nregs; /* # sse registers available for passing */ + int warn_avx512f; /* True when we want to warn + about AVX512F ABI. */ int warn_avx; /* True when we want to warn about AVX ABI. */ int warn_sse; /* True when we want to warn about SSE ABI. */ int warn_mmx; /* True when we want to warn about MMX ABI. */ Index: testsuite/gcc.target/i386/pr60205-1.c =================================================================== --- testsuite/gcc.target/i386/pr60205-1.c (revision 0) +++ testsuite/gcc.target/i386/pr60205-1.c (working copy) @@ -0,0 +1,14 @@ +/* PR target/60205 */ +/* { dg-options "-O2 -mno-avx512f -Wno-psabi" } */ +/* { dg-skip-if "no AVX512F vector" { *-*-mingw* } } */ + +typedef int __v16si __attribute__ ((__vector_size__ (64))); + +extern __v16si x; + +extern void bar (__v16si); +void +foo (void) +{ + bar (x); /* { dg-message "warning: AVX512F vector argument without AVX512F enabled changes the ABI" } */ +} Index: testsuite/gcc.target/i386/pr60205-2.c =================================================================== --- testsuite/gcc.target/i386/pr60205-2.c (revision 0) +++ testsuite/gcc.target/i386/pr60205-2.c (working copy) @@ -0,0 +1,13 @@ +/* PR target/60205 */ +/* { dg-options "-O2 -mno-avx512f" } */ +/* { dg-skip-if "no AVX512F vector" { *-*-mingw* } } */ + +typedef int __v16si __attribute__ ((__vector_size__ (64))); + +extern __v16si x; + +__v16si +foo (void) +{ /* { dg-warning "AVX512F vector return without AVX512F enabled changes the ABI" } */ + return x; +}