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
Wed Jan 15 17:05:00 GMT 2014


On Tue, Jan 14, 2014 at 11:09 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Jan 14, 2014 at 06:18:22AM -0800, H.J. Lu wrote:
>> 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.
>
> This has added many FAILs on i686-linux (make sure to configure for a CPU
> that doesn't automatically turn on -msse or -mmmx, say i686):
>
> +FAIL: gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c (test for excess errors)
> +FAIL: gcc.dg/pr53060.c (test for excess errors)
> +FAIL: c-c++-common/convert-vec-1.c  -Wc++-compat  (test for excess errors)
> +FAIL: c-c++-common/scal-to-vec2.c  -Wc++-compat  (test for excess errors)
> +FAIL: c-c++-common/vector-compare-2.c  -Wc++-compat  (test for excess errors)
> +FAIL: g++.dg/conversion/simd1.C -std=c++98 (test for excess errors)
> +FAIL: g++.dg/conversion/simd1.C -std=c++11 (test for excess errors)
> +FAIL: g++.dg/cpp0x/constexpr-53094-2.C (test for excess errors)
> +FAIL: g++.dg/ext/attribute-test-1.C -std=gnu++98 (test for excess errors)
> +FAIL: g++.dg/ext/attribute-test-1.C -std=gnu++11 (test for excess errors)
> +FAIL: g++.dg/ext/attribute-test-2.C -std=gnu++98 (test for excess errors)
> +FAIL: g++.dg/ext/attribute-test-2.C -std=gnu++11 (test for excess errors)
> +FAIL: g++.dg/ext/attribute-test-3.C -std=c++98 (test for excess errors)
> +FAIL: g++.dg/ext/attribute-test-3.C -std=c++11 (test for excess errors)
> +FAIL: g++.dg/ext/attribute-test-4.C -std=c++98 (test for excess errors)
> +FAIL: g++.dg/ext/attribute-test-4.C -std=c++11 (test for excess errors)
> +FAIL: g++.dg/ext/pr56790-1.C -std=gnu++98 (test for excess errors)
> +FAIL: g++.dg/ext/pr56790-1.C -std=gnu++11 (test for excess errors)
> +FAIL: c-c++-common/convert-vec-1.c -std=c++98 (test for excess errors)
> +FAIL: c-c++-common/convert-vec-1.c -std=c++11 (test for excess errors)
> +FAIL: c-c++-common/scal-to-vec2.c -std=gnu++98 (test for excess errors)
> +FAIL: c-c++-common/scal-to-vec2.c -std=gnu++11 (test for excess errors)
> +FAIL: c-c++-common/vector-compare-2.c -std=gnu++98 (test for excess errors)
> +FAIL: c-c++-common/vector-compare-2.c -std=gnu++11 (test for excess errors)
> +FAIL: g++.dg/torture/pr38565.C  -O0  (test for excess errors)
> +FAIL: g++.dg/torture/pr38565.C  -O1  (test for excess errors)
> +FAIL: g++.dg/torture/pr38565.C  -O2  (test for excess errors)
> +FAIL: g++.dg/torture/pr38565.C  -O3 -fomit-frame-pointer  (test for excess errors)
> +FAIL: g++.dg/torture/pr38565.C  -O3 -g  (test for excess errors)
> +FAIL: g++.dg/torture/pr38565.C  -Os  (test for excess errors)
> +FAIL: g++.dg/torture/pr38565.C  -O2 -flto -flto-partition=none  (test for excess errors)
> +FAIL: g++.dg/torture/pr38565.C  -O2 -flto  (test for excess errors)
>
> Excess errors:
> /usr/src/gcc/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c:9:1: warning: SSE vector return without SSE enabled changes the ABI [enabled by default]
> /usr/src/gcc/gcc/testsuite/gcc.dg/pr53060.c:13:1: warning: SSE vector return without SSE enabled changes the ABI [enabled by default]
> /usr/src/gcc/gcc/testsuite/c-c++-common/convert-vec-1.c:3:1: warning: MMX vector return without MMX enabled changes the ABI [enabled by default]
> /usr/src/gcc/gcc/testsuite/c-c++-common/scal-to-vec2.c:19:1: warning: SSE vector return without SSE enabled changes the ABI [enabled by default]
> /usr/src/gcc/gcc/testsuite/c-c++-common/vector-compare-2.c:20:1: warning: SSE vector return without SSE enabled changes the ABI [enabled by default]
> /usr/src/gcc/gcc/testsuite/g++.dg/conversion/simd1.C:8:59: warning: SSE vector return without SSE enabled changes the ABI [enabled by default]
> /usr/src/gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-2.C:7:46: warning: SSE vector return without SSE enabled changes the ABI [enabled by default]
> /usr/src/gcc/gcc/testsuite/g++.dg/ext/attribute-test-1.C:10:52: warning: SSE vector return without SSE enabled changes the ABI [enabled by default]
> /usr/src/gcc/gcc/testsuite/g++.dg/ext/attribute-test-2.C:14:59: warning: SSE vector return without SSE enabled changes the ABI [enabled by default]
> /usr/src/gcc/gcc/testsuite/g++.dg/ext/attribute-test-3.C:26:26: warning: SSE vector return without SSE enabled changes the ABI [enabled by default]
> /usr/src/gcc/gcc/testsuite/g++.dg/ext/attribute-test-4.C:26:24: warning: SSE vector return without SSE enabled changes the ABI [enabled by default]
> /usr/src/gcc/gcc/testsuite/g++.dg/ext/pr56790-1.C:6:12: warning: MMX vector return without MMX enabled changes the ABI [enabled by default]
> /usr/src/gcc/gcc/testsuite/g++.dg/torture/pr38565.C:5:28: warning: SSE vector return without SSE enabled changes the ABI [enabled by default]
>
> Please review this if the warnings are really desirable in all those tests and if yes,
> dg-prune-output them (or add -Wno-psabi or whatever else turns them off).
>

All those warnings are valid.   We didn't see them before my change
due to the regression I fixed.  I am checking in this patch to silence
those warnings.

Thanks.

-- 
H.J.
---
2014-01-15  H.J. Lu  <hongjiu.lu@intel.com>

PR target/59794
* c-c++-common/convert-vec-1.c: Also prune ABI change for
Linux/x86.
* g++.dg/cpp0x/constexpr-53094-2.C: Likewise.
* g++.dg/ext/attribute-test-1.C: Likewise.
* g++.dg/ext/attribute-test-2.C: Likewise.
* g++.dg/ext/attribute-test-3.C: Likewise.
* g++.dg/ext/attribute-test-4.C: Likewise.
* g++.dg/ext/pr56790-1.C: Likewise.
* g++.dg/torture/pr38565.C: Likewise.
* gcc.dg/pr53060.c: Likewise.
* c-c++-common/scal-to-vec2.c: Add -msse2 for x86.
* c-c++-common/vector-compare-2.c: Likewise.
* gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c: Likewise.
* g++.dg/conversion/simd1.C: Add -msse2 for x86.  Adjust
dg-message line number.
diff --git a/gcc/testsuite/c-c++-common/convert-vec-1.c
b/gcc/testsuite/c-c++-common/convert-vec-1.c
index 4987298..862190d 100644
--- a/gcc/testsuite/c-c++-common/convert-vec-1.c
+++ b/gcc/testsuite/c-c++-common/convert-vec-1.c
@@ -1,3 +1,4 @@
 /* { dg-do compile } */
+/* { dg-prune-output "changes the ABI" } */
 typedef float v2sf __attribute__ ((vector_size (8)));
 v2sf sub (void) { return (v2sf) 0.0; } /* { dg-error "can't convert" } */
diff --git a/gcc/testsuite/c-c++-common/scal-to-vec2.c
b/gcc/testsuite/c-c++-common/scal-to-vec2.c
index 2721aa0..e2c93ee 100644
--- a/gcc/testsuite/c-c++-common/scal-to-vec2.c
+++ b/gcc/testsuite/c-c++-common/scal-to-vec2.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
 /* { dg-options "-mabi=altivec" { target { { powerpc*-*-linux* } &&
ilp32 } } } */
+/* { dg-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */
 /* Ignore warning on some powerpc-ibm-aix configurations. */
 /* { dg-prune-output "non-standard ABI extension" } */

diff --git a/gcc/testsuite/c-c++-common/vector-compare-2.c
b/gcc/testsuite/c-c++-common/vector-compare-2.c
index d17a1b4..5ebe9e3 100644
--- a/gcc/testsuite/c-c++-common/vector-compare-2.c
+++ b/gcc/testsuite/c-c++-common/vector-compare-2.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-fno-common" { target hppa*-*-hpux* } } */
 /* { dg-options "-mabi=altivec" { target { { powerpc*-*-linux* } &&
ilp32 } } } */
+/* { dg-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */
 /* Ignore warning on some powerpc-ibm-aix configurations. */
 /* { dg-prune-output "non-standard ABI extension" } */

diff --git a/gcc/testsuite/g++.dg/conversion/simd1.C
b/gcc/testsuite/g++.dg/conversion/simd1.C
index fa40b0e..522d8b5 100644
--- a/gcc/testsuite/g++.dg/conversion/simd1.C
+++ b/gcc/testsuite/g++.dg/conversion/simd1.C
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */

 /* Test overload resolution of vector types.
    From Janis Johnson and Paolo Bonzini, based on PR/16882 */
@@ -17,7 +18,7 @@ extern const vector signed short *cvssp;
 void foo ()
 {
   vss = vld(i, vscp);        /* { dg-error "no matching function for call" } */
-  // { dg-message "candidate" "candidate note" { target *-*-* } 19 }
+  // { dg-message "candidate" "candidate note" { target *-*-* } 20 }
   vss = vld(i, vssp);
   vss = vld(i, cvssp);
 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-2.C
b/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-2.C
index 3f66c4e..1c5129d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-2.C
@@ -2,6 +2,7 @@
 // { dg-options "-std=gnu++11" }
 // Ignore warning on some powerpc-ibm-aix configurations.
 // { dg-prune-output "non-standard ABI extension" }
+// { dg-prune-output "changes the ABI" }

 typedef float __attribute__ ((vector_size (4 * sizeof (float)))) V4;
 constexpr V4 build (float x, float y, float z) { return (V4){ x, y, z, 0 };}
diff --git a/gcc/testsuite/g++.dg/ext/attribute-test-1.C
b/gcc/testsuite/g++.dg/ext/attribute-test-1.C
index 7df6893..93e08d7 100644
--- a/gcc/testsuite/g++.dg/ext/attribute-test-1.C
+++ b/gcc/testsuite/g++.dg/ext/attribute-test-1.C
@@ -36,3 +36,4 @@ int main()

 /* Ignore a warning that is irrelevant to the purpose of this test.  */
 /* { dg-prune-output ".*GCC vector returned by reference.*" } */
+/* { dg-prune-output "changes the ABI" } */
diff --git a/gcc/testsuite/g++.dg/ext/attribute-test-2.C
b/gcc/testsuite/g++.dg/ext/attribute-test-2.C
index 1870673..d7c417d 100644
--- a/gcc/testsuite/g++.dg/ext/attribute-test-2.C
+++ b/gcc/testsuite/g++.dg/ext/attribute-test-2.C
@@ -50,3 +50,4 @@ int main()

 /* Ignore a warning that is irrelevant to the purpose of this test.  */
 /* { dg-prune-output ".*GCC vector returned by reference.*" } */
+/* { dg-prune-output "changes the ABI" } */
diff --git a/gcc/testsuite/g++.dg/ext/attribute-test-3.C
b/gcc/testsuite/g++.dg/ext/attribute-test-3.C
index 050cbb4..4b0939e 100644
--- a/gcc/testsuite/g++.dg/ext/attribute-test-3.C
+++ b/gcc/testsuite/g++.dg/ext/attribute-test-3.C
@@ -52,3 +52,4 @@ int main() {

 /* Ignore a warning that is irrelevant to the purpose of this test.  */
 /* { dg-prune-output ".*GCC vector returned by reference.*" } */
+/* { dg-prune-output "changes the ABI" } */
diff --git a/gcc/testsuite/g++.dg/ext/attribute-test-4.C
b/gcc/testsuite/g++.dg/ext/attribute-test-4.C
index 4783ee8..c3e949a 100644
--- a/gcc/testsuite/g++.dg/ext/attribute-test-4.C
+++ b/gcc/testsuite/g++.dg/ext/attribute-test-4.C
@@ -49,3 +49,4 @@ int main() {

 /* Ignore a warning that is irrelevant to the purpose of this test.  */
 /* { dg-prune-output ".*GCC vector returned by reference.*" } */
+/* { dg-prune-output "changes the ABI" } */
diff --git a/gcc/testsuite/g++.dg/ext/pr56790-1.C
b/gcc/testsuite/g++.dg/ext/pr56790-1.C
index 84feca1..ae465fa 100644
--- a/gcc/testsuite/g++.dg/ext/pr56790-1.C
+++ b/gcc/testsuite/g++.dg/ext/pr56790-1.C
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-ccp1" } */
+/* { dg-prune-output "changes the ABI" } */

 typedef long vec __attribute__ ((vector_size (2 * sizeof (long))));

diff --git a/gcc/testsuite/g++.dg/torture/pr38565.C
b/gcc/testsuite/g++.dg/torture/pr38565.C
index 8cd1e1d..7216b1c 100644
--- a/gcc/testsuite/g++.dg/torture/pr38565.C
+++ b/gcc/testsuite/g++.dg/torture/pr38565.C
@@ -1,6 +1,7 @@
 // { dg-do compile }
 // Ignore warning on some powerpc-linux configurations.
 // { dg-prune-output "non-standard ABI extension" }
+// { dg-prune-output "changes the ABI" }
 #define vector __attribute__((vector_size(16) ))
 vector unsigned int f(int a)
 {
diff --git a/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c
b/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c
index 42b3935..b1bee33 100644
--- a/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c
+++ b/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -Wall" } */
 /* { dg-options "-O2 -Wall -mabi=altivec" { target { {
powerpc*-*-linux* } && ilp32 } } } */
+/* { dg-options "-O2 -Wall -msse2" { target { i?86-*-* x86_64-*-* } } } */

 typedef long long __m128i __attribute__ ((__vector_size__ (16),
__may_alias__));

diff --git a/gcc/testsuite/gcc.dg/pr53060.c b/gcc/testsuite/gcc.dg/pr53060.c
index db5acbd..503f054 100644
--- a/gcc/testsuite/gcc.dg/pr53060.c
+++ b/gcc/testsuite/gcc.dg/pr53060.c
@@ -25,3 +25,4 @@ int main()

 /* Ignore a warning that is irrelevant to the purpose of this test.  */
 /* { dg-prune-output ".*GCC vector returned by reference.*" } */
+/* { dg-prune-output "changes the ABI" } */



More information about the Gcc-patches mailing list