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)
