PATCH: PR target/59794: [4.7/4.8/4.9 Regression] i386 backend fails to detect MMX/SSE/AVX ABI changes

H.J. Lu hjl.tools@gmail.com
Fri Jan 17 19:04:00 GMT 2014


On Tue, Jan 14, 2014 at 8:12 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Tue, Jan 14, 2014 at 3:18 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>
>> There are several problems with i386 MMX/SSE/AVX ABI change detection:
>>
>> 1. MMX/SSE return value isn't checked for -m32 since revision 83533:
>>
>> http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=83533
>>
>> which added ix86_struct_value_rtx.  Since MMX/SSE condition is always
>> false, the MMX/SSE return value ABI change is disabled.
>> 2. For -m32, the same warning on MMX/SSE argument is issued twice, one from
>> type_natural_mode and one from function_arg_32.
>> 3. AVX return value ABI change isn't checked.
>>
>> This patch does followings:
>>
>> 1. Remove the ineffective ix86_struct_value_rtx.
>> 2. Add a bool parameter to indicate if type is used for function return
>> value.  Warn ABI change if the vector mode isn't available for function
>> return value.  Add AVX function return value ABI change warning.
>> 3. Consolidate ABI change warning into type_natural_mode.
>> 4. Update g++.dg/ext/vector23.C to prune ABI change for Linux/x86
>> added by the AVX function return value ABI change warning.
>> 5. Update gcc.target/i386/pr39162.c to avoid the AVX function return
>> value ABI change warning.
>> 6. Add testcases for warning MMX/SSE/AVX ABI changes in parameter
>> passing and function return.
>>
>> Tested on Linux/x86-64 with -m32/-m64 for "make check".  OK to install?
>>
>> Thanks.
>>
>> H.J.
>> ---
>> gcc/
>>
>> 2014-01-14  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>         PR target/59794
>>         * config/i386/i386.c (type_natural_mode): Add a bool parameter
>>         to indicate if type is used for function return value.  Warn
>>         ABI change if the vector mode isn't available for function
>>         return value.
>>         (ix86_function_arg_advance): Pass false to type_natural_mode.
>>         (ix86_function_arg): Likewise.
>>         (ix86_gimplify_va_arg): Likewise.
>>         (function_arg_32): Don't warn ABI change.
>>         (ix86_function_value): Pass true to type_natural_mode.
>>         (ix86_return_in_memory): Likewise.
>>         (ix86_struct_value_rtx): Removed.
>>         (TARGET_STRUCT_VALUE_RTX): Likewise.
>>
>> gcc/testsuite/
>>
>> 2014-01-14  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>         PR target/59794
>>         * g++.dg/ext/vector23.C: Also prune ABI change for Linux/x86.
>>         * gcc.target/i386/pr39162.c (y): New __m256i variable.
>>         (bar): Change return type to void.  Set y to x.
>>         * gcc.target/i386/pr59794-1.c: New testcase.
>>         * gcc.target/i386/pr59794-2.c: Likewise.
>>         * gcc.target/i386/pr59794-3.c: Likewise.
>>         * gcc.target/i386/pr59794-4.c: Likewise.
>>         * gcc.target/i386/pr59794-5.c: Likewise.
>>         * gcc.target/i386/pr59794-6.c: Likewise.
>>         * gcc.target/i386/pr59794-7.c: Likewise.
>
> OK for mainline and release branches after a couple of days.
>

I back ported it to 4.8 branch.  But type_natural_mode on 4.7
branch is too different from trunk.  I stopped at 4.8 branch.

-- 
H.J.



More information about the Gcc-patches mailing list