This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][i386][AVX512] PR60204 - update abi for large structs.
- From: Ilya Tocar <tocarip dot intel at gmail dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>, Jakub Jelinek <jakub at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Kirill Yukhin <kirill dot yukhin at gmail dot com>
- Date: Wed, 19 Feb 2014 17:30:45 +0400
- Subject: [PATCH][i386][AVX512] PR60204 - update abi for large structs.
- Authentication-results: sourceware.org; auth=none
Hi everyone,
As AVX512 abi for passing/returing structs was recently changed in
https://github.com/hjl-tools/x86-64-psABI/commit/6d7ccd614fe67111d2aecec853c3df0310b372d2
We need to update GCC accordingly. This patch does it.
It bootstraps, passes make check (including updated abi tests), spec2006
is ok. Ok for trunk?
ChangeLog bellow:
2014-02-19 Ilya Tocar <ilya.tocar@intel.com>
* config/i386/i386.c (classify_argument): Update to reflect abi fix.
And for testsuite:
2014-02-19 Ilya Tocar <ilya.tocar@intel.com>
* gcc.target/x86_64/abi/avx512f/test_passing_structs.c: Update to
reflect abi fix.
* gcc.target/x86_64/abi/avx512f/test_passing_unions.c: Ditto.
---
gcc/config/i386/i386.c | 4 +-
.../x86_64/abi/avx512f/test_passing_structs.c | 12 +---
.../x86_64/abi/avx512f/test_passing_unions.c | 78 +++-------------------
3 files changed, 12 insertions(+), 82 deletions(-)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index acfc021..2d16fb9 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6431,8 +6431,8 @@ classify_argument (enum machine_mode mode, const_tree type,
tree field;
enum x86_64_reg_class subclasses[MAX_CLASSES];
- /* On x86-64 we pass structures larger than 32 bytes on the stack. */
- if (bytes > 32)
+ /* On x86-64 we pass structures larger than 64 bytes on the stack. */
+ if (bytes > 64)
return 0;
for (i = 0; i < words; i++)
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_structs.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_structs.c
index a5e1477..8daa676 100644
--- a/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_structs.c
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_structs.c
@@ -26,16 +26,8 @@ check_struct_passing1 (struct m512_struct ms1 ATTRIBUTE_UNUSED,
struct m512_struct ms7 ATTRIBUTE_UNUSED,
struct m512_struct ms8 ATTRIBUTE_UNUSED)
{
- /* Check the passing on the stack by comparing the address of the
- stack elements to the expected place on the stack. */
- assert ((unsigned long)&ms1.x == rsp+8);
- assert ((unsigned long)&ms2.x == rsp+72);
- assert ((unsigned long)&ms3.x == rsp+136);
- assert ((unsigned long)&ms4.x == rsp+200);
- assert ((unsigned long)&ms5.x == rsp+264);
- assert ((unsigned long)&ms6.x == rsp+328);
- assert ((unsigned long)&ms7.x == rsp+392);
- assert ((unsigned long)&ms8.x == rsp+456);
+ /* Check register contents. */
+ check_m512_arguments;
}
void
diff --git a/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_unions.c b/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_unions.c
index 9712290..370d15b6 100644
--- a/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_unions.c
+++ b/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_unions.c
@@ -52,24 +52,8 @@ check_union_passing1(union un1 u1 ATTRIBUTE_UNUSED,
union un1 u7 ATTRIBUTE_UNUSED,
union un1 u8 ATTRIBUTE_UNUSED)
{
- /* Check the passing on the stack by comparing the address of the
- stack elements to the expected place on the stack. */
- assert ((unsigned long)&u1.x == rsp+8);
- assert ((unsigned long)&u1.f == rsp+8);
- assert ((unsigned long)&u2.x == rsp+72);
- assert ((unsigned long)&u2.f == rsp+72);
- assert ((unsigned long)&u3.x == rsp+136);
- assert ((unsigned long)&u3.f == rsp+136);
- assert ((unsigned long)&u4.x == rsp+200);
- assert ((unsigned long)&u4.f == rsp+200);
- assert ((unsigned long)&u5.x == rsp+264);
- assert ((unsigned long)&u5.f == rsp+264);
- assert ((unsigned long)&u6.x == rsp+328);
- assert ((unsigned long)&u6.f == rsp+328);
- assert ((unsigned long)&u7.x == rsp+392);
- assert ((unsigned long)&u7.f == rsp+392);
- assert ((unsigned long)&u8.x == rsp+456);
- assert ((unsigned long)&u8.f == rsp+456);
+ /* Check register contents. */
+ check_m512_arguments;
}
void
@@ -82,24 +66,8 @@ check_union_passing2(union un2 u1 ATTRIBUTE_UNUSED,
union un2 u7 ATTRIBUTE_UNUSED,
union un2 u8 ATTRIBUTE_UNUSED)
{
- /* Check the passing on the stack by comparing the address of the
- stack elements to the expected place on the stack. */
- assert ((unsigned long)&u1.x == rsp+8);
- assert ((unsigned long)&u1.d == rsp+8);
- assert ((unsigned long)&u2.x == rsp+72);
- assert ((unsigned long)&u2.d == rsp+72);
- assert ((unsigned long)&u3.x == rsp+136);
- assert ((unsigned long)&u3.d == rsp+136);
- assert ((unsigned long)&u4.x == rsp+200);
- assert ((unsigned long)&u4.d == rsp+200);
- assert ((unsigned long)&u5.x == rsp+264);
- assert ((unsigned long)&u5.d == rsp+264);
- assert ((unsigned long)&u6.x == rsp+328);
- assert ((unsigned long)&u6.d == rsp+328);
- assert ((unsigned long)&u7.x == rsp+392);
- assert ((unsigned long)&u7.d == rsp+392);
- assert ((unsigned long)&u8.x == rsp+456);
- assert ((unsigned long)&u8.d == rsp+456);
+ /* Check register contents. */
+ check_m512_arguments;
}
void
@@ -112,24 +80,8 @@ check_union_passing3(union un3 u1 ATTRIBUTE_UNUSED,
union un3 u7 ATTRIBUTE_UNUSED,
union un3 u8 ATTRIBUTE_UNUSED)
{
- /* Check the passing on the stack by comparing the address of the
- stack elements to the expected place on the stack. */
- assert ((unsigned long)&u1.x == rsp+8);
- assert ((unsigned long)&u1.v == rsp+8);
- assert ((unsigned long)&u2.x == rsp+72);
- assert ((unsigned long)&u2.v == rsp+72);
- assert ((unsigned long)&u3.x == rsp+136);
- assert ((unsigned long)&u3.v == rsp+136);
- assert ((unsigned long)&u4.x == rsp+200);
- assert ((unsigned long)&u4.v == rsp+200);
- assert ((unsigned long)&u5.x == rsp+264);
- assert ((unsigned long)&u5.v == rsp+264);
- assert ((unsigned long)&u6.x == rsp+328);
- assert ((unsigned long)&u6.v == rsp+328);
- assert ((unsigned long)&u7.x == rsp+392);
- assert ((unsigned long)&u7.v == rsp+392);
- assert ((unsigned long)&u8.x == rsp+456);
- assert ((unsigned long)&u8.v == rsp+456);
+ /* Check register contents. */
+ check_m512_arguments;
}
void
@@ -160,22 +112,8 @@ check_union_passing6(union un6 u1 ATTRIBUTE_UNUSED,
union un6 u7 ATTRIBUTE_UNUSED,
union un6 u8 ATTRIBUTE_UNUSED)
{
- assert ((unsigned long)&u1.x == rsp+8);
- assert ((unsigned long)&u1.v == rsp+8);
- assert ((unsigned long)&u2.x == rsp+72);
- assert ((unsigned long)&u2.v == rsp+72);
- assert ((unsigned long)&u3.x == rsp+136);
- assert ((unsigned long)&u3.v == rsp+136);
- assert ((unsigned long)&u4.x == rsp+200);
- assert ((unsigned long)&u4.v == rsp+200);
- assert ((unsigned long)&u5.x == rsp+264);
- assert ((unsigned long)&u5.v == rsp+264);
- assert ((unsigned long)&u6.x == rsp+328);
- assert ((unsigned long)&u6.v == rsp+328);
- assert ((unsigned long)&u7.x == rsp+392);
- assert ((unsigned long)&u7.v == rsp+392);
- assert ((unsigned long)&u8.x == rsp+456);
- assert ((unsigned long)&u8.v == rsp+456);
+ /* Check register contents. */
+ check_m512_arguments;
}
#define check_union_passing1 WRAP_CALL(check_union_passing1)
--
1.8.3.1