aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.target/x86_64')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/README.gcc25
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/abi-x86_64.exp48
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/args.h186
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s77
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S85
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/abi-avx.exp61
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/args.h180
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S82
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/avx-check.h28
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_m256_returning.c32
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_passing_m256.c168
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_passing_structs.c61
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_passing_unions.c143
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/abi-avx512f.exp61
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/args.h184
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S98
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/avx512f-check.h41
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_m512_returning.c32
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_m512.c168
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_structs.c65
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_unions.c180
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp36
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.h50
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c40
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2a.c27
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2b.c13
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2a.c17
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2b.c24
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c24
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-1.c11
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-2.c25
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c47
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c47
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c47
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4a.c24
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4b.c31
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5a.c17
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5b.c37
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/defines.h148
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/macros.h53
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_3_element_struct_and_unions.c523
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_alignment.c42
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_array_size_and_align.c41
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_returning.c78
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_sizes.c42
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_struct_size_and_align.c42
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_union_size_and_align.c41
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_bitfields.c162
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_complex_returning.c83
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_m64m128_returning.c54
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_floats.c502
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_integers.c203
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_m64m128.c249
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_structs.c261
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_structs_and_unions.c95
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_unions.c229
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_struct_returning.c230
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_varargs.c97
59 files changed, 5707 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/README.gcc b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/README.gcc
new file mode 100644
index 000000000..e668a4dd8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/README.gcc
@@ -0,0 +1,25 @@
+This contains a testsuite for the AMD64 psABI.
+The ABI document is at http://www.x86-64.org/documentation/abi.pdf .
+The content of this directory in the GCC tree is just a (partial) copy of the
+ABI testsuite at cvs.x86-64.org.
+
+See http://www.x86-64.org/cvsaccess for accessing the anonymous CVS server.
+The module 'abitest' contains the master copy of this directory.
+
+The whole testsuite is licensed under GPL v2.
+
+Be aware that some of the test_*.c files here are generated, with the
+generators only being in the master copy of the testsuite.
+
+To change anything, please contact discuss@x86-64.org or the current
+maintainer of the testuite directly.
+
+The current maintainer is:
+ matz@suse.de
+
+
+Copyright (C) 2005-2014 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/abi-x86_64.exp b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/abi-x86_64.exp
new file mode 100644
index 000000000..5ecfe4be8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/abi-x86_64.exp
@@ -0,0 +1,48 @@
+# Copyright (C) 2005-2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# The x86-64 ABI testsuite needs one additional assembler file for most
+# testcases. For simplicity we will just link it into each test.
+
+load_lib c-torture.exp
+load_lib target-supports.exp
+load_lib torture-options.exp
+
+if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
+ || ![is-effective-target lp64] } then {
+ return
+}
+
+
+torture-init
+set-torture-options $C_TORTURE_OPTIONS
+set additional_flags "-W -Wall -Wno-abi"
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] {
+ if {[runtest_file_p $runtests $src]} {
+ if { ([istarget *-*-darwin*]) } then {
+ c-torture-execute [list $src \
+ $srcdir/$subdir/asm-support-darwin.s] \
+ $additional_flags
+ } else {
+ c-torture-execute [list $src \
+ $srcdir/$subdir/asm-support.S] \
+ $additional_flags
+ }
+ }
+}
+
+torture-finish
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/args.h b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/args.h
new file mode 100644
index 000000000..99d7b76f8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/args.h
@@ -0,0 +1,186 @@
+#ifndef INCLUDED_ARGS_H
+#define INCLUDED_ARGS_H
+
+#include <string.h>
+
+/* This defines the calling sequences for integers and floats. */
+#define I0 rdi
+#define I1 rsi
+#define I2 rdx
+#define I3 rcx
+#define I4 r8
+#define I5 r9
+#define F0 xmm0
+#define F1 xmm1
+#define F2 xmm2
+#define F3 xmm3
+#define F4 xmm4
+#define F5 xmm5
+#define F6 xmm6
+#define F7 xmm7
+
+typedef union {
+ float _float[4];
+ double _double[2];
+ long _long[2];
+ int _int[4];
+ unsigned long _ulong[2];
+#ifdef CHECK_M64_M128
+ __m64 _m64[2];
+ __m128 _m128[1];
+#endif
+} XMM_T;
+
+typedef union {
+ float _float;
+ double _double;
+ ldouble _ldouble;
+ ulong _ulong[2];
+} X87_T;
+extern void (*callthis)(void);
+extern unsigned long rax,rbx,rcx,rdx,rsi,rdi,rsp,rbp,r8,r9,r10,r11,r12,r13,r14,r15;
+XMM_T xmm_regs[16];
+X87_T x87_regs[8];
+extern volatile unsigned long volatile_var;
+extern void snapshot (void);
+extern void snapshot_ret (void);
+#define WRAP_CALL(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot)
+#define WRAP_RET(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot_ret)
+
+/* Clear all integer registers. */
+#define clear_int_hardware_registers \
+ asm __volatile__ ("xor %%rax, %%rax\n\t" \
+ "xor %%rbx, %%rbx\n\t" \
+ "xor %%rcx, %%rcx\n\t" \
+ "xor %%rdx, %%rdx\n\t" \
+ "xor %%rsi, %%rsi\n\t" \
+ "xor %%rdi, %%rdi\n\t" \
+ "xor %%r8, %%r8\n\t" \
+ "xor %%r9, %%r9\n\t" \
+ "xor %%r10, %%r10\n\t" \
+ "xor %%r11, %%r11\n\t" \
+ "xor %%r12, %%r12\n\t" \
+ "xor %%r13, %%r13\n\t" \
+ "xor %%r14, %%r14\n\t" \
+ "xor %%r15, %%r15\n\t" \
+ ::: "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", \
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15");
+
+/* This is the list of registers available for passing arguments. Not all of
+ these are used or even really available. */
+struct IntegerRegisters
+{
+ unsigned long rax, rbx, rcx, rdx, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15;
+};
+struct FloatRegisters
+{
+ double mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7;
+ ldouble st0, st1, st2, st3, st4, st5, st6, st7;
+ XMM_T xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9,
+ xmm10, xmm11, xmm12, xmm13, xmm14, xmm15;
+};
+
+/* Implemented in scalarargs.c */
+extern struct IntegerRegisters iregs;
+extern struct FloatRegisters fregs;
+extern unsigned int num_iregs, num_fregs;
+
+#define check_int_arguments do { \
+ assert (num_iregs <= 0 || iregs.I0 == I0); \
+ assert (num_iregs <= 1 || iregs.I1 == I1); \
+ assert (num_iregs <= 2 || iregs.I2 == I2); \
+ assert (num_iregs <= 3 || iregs.I3 == I3); \
+ assert (num_iregs <= 4 || iregs.I4 == I4); \
+ assert (num_iregs <= 5 || iregs.I5 == I5); \
+ } while (0)
+
+#define check_char_arguments check_int_arguments
+#define check_short_arguments check_int_arguments
+#define check_long_arguments check_int_arguments
+
+/* Clear register struct. */
+#define clear_struct_registers \
+ rax = rbx = rcx = rdx = rdi = rsi = rbp = rsp \
+ = r8 = r9 = r10 = r11 = r12 = r13 = r14 = r15 = 0; \
+ memset (&iregs, 0, sizeof (iregs)); \
+ memset (&fregs, 0, sizeof (fregs)); \
+ memset (xmm_regs, 0, sizeof (xmm_regs)); \
+ memset (x87_regs, 0, sizeof (x87_regs));
+
+/* Clear both hardware and register structs for integers. */
+#define clear_int_registers \
+ clear_struct_registers \
+ clear_int_hardware_registers
+
+/* TODO: Do the checking. */
+#define check_f_arguments(T) do { \
+ assert (num_fregs <= 0 || fregs.xmm0._ ## T [0] == xmm_regs[0]._ ## T [0]); \
+ assert (num_fregs <= 1 || fregs.xmm1._ ## T [0] == xmm_regs[1]._ ## T [0]); \
+ assert (num_fregs <= 2 || fregs.xmm2._ ## T [0] == xmm_regs[2]._ ## T [0]); \
+ assert (num_fregs <= 3 || fregs.xmm3._ ## T [0] == xmm_regs[3]._ ## T [0]); \
+ assert (num_fregs <= 4 || fregs.xmm4._ ## T [0] == xmm_regs[4]._ ## T [0]); \
+ assert (num_fregs <= 5 || fregs.xmm5._ ## T [0] == xmm_regs[5]._ ## T [0]); \
+ assert (num_fregs <= 6 || fregs.xmm6._ ## T [0] == xmm_regs[6]._ ## T [0]); \
+ assert (num_fregs <= 7 || fregs.xmm7._ ## T [0] == xmm_regs[7]._ ## T [0]); \
+ } while (0)
+
+#define check_float_arguments check_f_arguments(float)
+#define check_double_arguments check_f_arguments(double)
+
+#define check_vector_arguments(T,O) do { \
+ assert (num_fregs <= 0 \
+ || memcmp (((char *) &fregs.xmm0) + (O), \
+ &xmm_regs[0], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 1 \
+ || memcmp (((char *) &fregs.xmm1) + (O), \
+ &xmm_regs[1], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 2 \
+ || memcmp (((char *) &fregs.xmm2) + (O), \
+ &xmm_regs[2], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 3 \
+ || memcmp (((char *) &fregs.xmm3) + (O), \
+ &xmm_regs[3], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 4 \
+ || memcmp (((char *) &fregs.xmm4) + (O), \
+ &xmm_regs[4], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 5 \
+ || memcmp (((char *) &fregs.xmm5) + (O), \
+ &xmm_regs[5], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 6 \
+ || memcmp (((char *) &fregs.xmm6) + (O), \
+ &xmm_regs[6], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 7 \
+ || memcmp (((char *) &fregs.xmm7) + (O), \
+ &xmm_regs[7], \
+ sizeof (__ ## T) - (O)) == 0); \
+ } while (0)
+
+#define check_m64_arguments check_vector_arguments(m64, 0)
+#define check_m128_arguments check_vector_arguments(m128, 0)
+
+/* ldoubles are not passed in registers */
+#define check_ldouble_arguments
+
+/* TODO: Do the clearing. */
+#define clear_float_hardware_registers
+#define clear_x87_hardware_registers
+
+#define clear_float_registers \
+ clear_struct_registers \
+ clear_float_hardware_registers
+
+#define clear_x87_registers \
+ clear_struct_registers \
+ clear_x87_hardware_registers
+
+
+#endif /* INCLUDED_ARGS_H */
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s
new file mode 100644
index 000000000..b3b88466a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/asm-support-darwin.s
@@ -0,0 +1,77 @@
+ .file "snapshot.S"
+ .text
+ .p2align 4,,15
+.globl _snapshot
+_snapshot:
+.LFB3:
+ movq %rax, _rax(%rip)
+ movq %rbx, _rbx(%rip)
+ movq %rcx, _rcx(%rip)
+ movq %rdx, _rdx(%rip)
+ movq %rdi, _rdi(%rip)
+ movq %rsi, _rsi(%rip)
+ movq %rbp, _rbp(%rip)
+ movq %rsp, _rsp(%rip)
+ movq %r8, _r8(%rip)
+ movq %r9, _r9(%rip)
+ movq %r10, _r10(%rip)
+ movq %r11, _r11(%rip)
+ movq %r12, _r12(%rip)
+ movq %r13, _r13(%rip)
+ movq %r14, _r14(%rip)
+ movq %r15, _r15(%rip)
+ movdqu %xmm0, _xmm_regs+0(%rip)
+ movdqu %xmm1, _xmm_regs+16(%rip)
+ movdqu %xmm2, _xmm_regs+32(%rip)
+ movdqu %xmm3, _xmm_regs+48(%rip)
+ movdqu %xmm4, _xmm_regs+64(%rip)
+ movdqu %xmm5, _xmm_regs+80(%rip)
+ movdqu %xmm6, _xmm_regs+96(%rip)
+ movdqu %xmm7, _xmm_regs+112(%rip)
+ movdqu %xmm8, _xmm_regs+128(%rip)
+ movdqu %xmm9, _xmm_regs+144(%rip)
+ movdqu %xmm10, _xmm_regs+160(%rip)
+ movdqu %xmm11, _xmm_regs+176(%rip)
+ movdqu %xmm12, _xmm_regs+192(%rip)
+ movdqu %xmm13, _xmm_regs+208(%rip)
+ movdqu %xmm14, _xmm_regs+224(%rip)
+ movdqu %xmm15, _xmm_regs+240(%rip)
+ jmp *_callthis(%rip)
+.LFE3:
+ .p2align 4,,15
+.globl _snapshot_ret
+_snapshot_ret:
+ movq %rdi, _rdi(%rip)
+ subq $8, %rsp
+ call *_callthis(%rip)
+ addq $8, %rsp
+ movq %rax, _rax(%rip)
+ movq %rdx, _rdx(%rip)
+ movdqu %xmm0, _xmm_regs+0(%rip)
+ movdqu %xmm1, _xmm_regs+16(%rip)
+ fstpt _x87_regs(%rip)
+ fstpt _x87_regs+16(%rip)
+ fldt _x87_regs+16(%rip)
+ fldt _x87_regs(%rip)
+ ret
+
+ .comm _callthis,8
+ .comm _rax,8
+ .comm _rbx,8
+ .comm _rcx,8
+ .comm _rdx,8
+ .comm _rsi,8
+ .comm _rdi,8
+ .comm _rsp,8
+ .comm _rbp,8
+ .comm _r8,8
+ .comm _r9,8
+ .comm _r10,8
+ .comm _r11,8
+ .comm _r12,8
+ .comm _r13,8
+ .comm _r14,8
+ .comm _r15,8
+ .comm _xmm_regs,256
+ .comm _x87_regs,128
+ .comm _volatile_var,8
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S
new file mode 100644
index 000000000..8e0bffe8b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S
@@ -0,0 +1,85 @@
+ .file "snapshot.S"
+#ifdef __AVX__
+ .sse_check none
+#endif
+ .text
+ .p2align 4,,15
+.globl snapshot
+ .type snapshot, @function
+snapshot:
+.LFB3:
+ movq %rax, rax(%rip)
+ movq %rbx, rbx(%rip)
+ movq %rcx, rcx(%rip)
+ movq %rdx, rdx(%rip)
+ movq %rdi, rdi(%rip)
+ movq %rsi, rsi(%rip)
+ movq %rbp, rbp(%rip)
+ movq %rsp, rsp(%rip)
+ movq %r8, r8(%rip)
+ movq %r9, r9(%rip)
+ movq %r10, r10(%rip)
+ movq %r11, r11(%rip)
+ movq %r12, r12(%rip)
+ movq %r13, r13(%rip)
+ movq %r14, r14(%rip)
+ movq %r15, r15(%rip)
+ movdqu %xmm0, xmm_regs+0(%rip)
+ movdqu %xmm1, xmm_regs+16(%rip)
+ movdqu %xmm2, xmm_regs+32(%rip)
+ movdqu %xmm3, xmm_regs+48(%rip)
+ movdqu %xmm4, xmm_regs+64(%rip)
+ movdqu %xmm5, xmm_regs+80(%rip)
+ movdqu %xmm6, xmm_regs+96(%rip)
+ movdqu %xmm7, xmm_regs+112(%rip)
+ movdqu %xmm8, xmm_regs+128(%rip)
+ movdqu %xmm9, xmm_regs+144(%rip)
+ movdqu %xmm10, xmm_regs+160(%rip)
+ movdqu %xmm11, xmm_regs+176(%rip)
+ movdqu %xmm12, xmm_regs+192(%rip)
+ movdqu %xmm13, xmm_regs+208(%rip)
+ movdqu %xmm14, xmm_regs+224(%rip)
+ movdqu %xmm15, xmm_regs+240(%rip)
+ jmp *callthis(%rip)
+.LFE3:
+ .size snapshot, .-snapshot
+
+ .p2align 4,,15
+.globl snapshot_ret
+ .type snapshot_ret, @function
+snapshot_ret:
+ movq %rdi, rdi(%rip)
+ subq $8, %rsp
+ call *callthis(%rip)
+ addq $8, %rsp
+ movq %rax, rax(%rip)
+ movq %rdx, rdx(%rip)
+ movdqu %xmm0, xmm_regs+0(%rip)
+ movdqu %xmm1, xmm_regs+16(%rip)
+ fstpt x87_regs(%rip)
+ fstpt x87_regs+16(%rip)
+ fldt x87_regs+16(%rip)
+ fldt x87_regs(%rip)
+ ret
+ .size snapshot_ret, .-snapshot_ret
+
+ .comm callthis,8,8
+ .comm rax,8,8
+ .comm rbx,8,8
+ .comm rcx,8,8
+ .comm rdx,8,8
+ .comm rsi,8,8
+ .comm rdi,8,8
+ .comm rsp,8,8
+ .comm rbp,8,8
+ .comm r8,8,8
+ .comm r9,8,8
+ .comm r10,8,8
+ .comm r11,8,8
+ .comm r12,8,8
+ .comm r13,8,8
+ .comm r14,8,8
+ .comm r15,8,8
+ .comm xmm_regs,256,32
+ .comm x87_regs,128,32
+ .comm volatile_var,8,8
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/abi-avx.exp b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/abi-avx.exp
new file mode 100644
index 000000000..d6fc1874f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/abi-avx.exp
@@ -0,0 +1,61 @@
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# The x86-64 AVX ABI testsuite needs one additional assembler file for most
+# testcases. For simplicity we will just link it into each test.
+
+load_lib c-torture.exp
+load_lib target-supports.exp
+load_lib torture-options.exp
+
+if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
+ || ![is-effective-target lp64]
+ || ![is-effective-target avx] } then {
+ return
+}
+
+
+# If the linker used understands -M <mapfile>, pass it to clear hardware
+# capabilities set by the Sun assembler.
+set flags ""
+set clearcap_ldflags "-Wl,-M,$srcdir/gcc.target/i386/clearcap.map"
+
+if [check_no_compiler_messages mapfile executable {
+ int main (void) { return 0; }
+ } $clearcap_ldflags ] {
+ set flags $clearcap_ldflags
+}
+
+torture-init
+set-torture-options $C_TORTURE_OPTIONS
+set additional_flags "-W -Wall -mavx $flags"
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] {
+ if {[runtest_file_p $runtests $src]} {
+ if { ([istarget *-*-darwin*]) } then {
+ # FIXME: Darwin isn't tested.
+ c-torture-execute [list $src \
+ $srcdir/$subdir/asm-support-darwin.s] \
+ $additional_flags
+ } else {
+ c-torture-execute [list $src \
+ $srcdir/$subdir/asm-support.S] \
+ $additional_flags
+ }
+ }
+}
+
+torture-finish
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/args.h b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/args.h
new file mode 100644
index 000000000..5fa4a5e6c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/args.h
@@ -0,0 +1,180 @@
+#ifndef INCLUDED_ARGS_H
+#define INCLUDED_ARGS_H
+
+#include <immintrin.h>
+#include <string.h>
+
+/* Assertion macro. */
+#define assert(test) if (!(test)) abort()
+
+#ifdef __GNUC__
+#define ATTRIBUTE_UNUSED __attribute__((__unused__))
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+/* This defines the calling sequences for integers and floats. */
+#define I0 rdi
+#define I1 rsi
+#define I2 rdx
+#define I3 rcx
+#define I4 r8
+#define I5 r9
+#define F0 ymm0
+#define F1 ymm1
+#define F2 ymm2
+#define F3 ymm3
+#define F4 ymm4
+#define F5 ymm5
+#define F6 ymm6
+#define F7 ymm7
+
+typedef union {
+ float _float[8];
+ double _double[4];
+ long _long[4];
+ int _int[8];
+ unsigned long _ulong[4];
+ __m64 _m64[4];
+ __m128 _m128[2];
+ __m256 _m256[1];
+} YMM_T;
+
+typedef union {
+ float _float;
+ double _double;
+ long double _ldouble;
+ unsigned long _ulong[2];
+} X87_T;
+extern void (*callthis)(void);
+extern unsigned long rax,rbx,rcx,rdx,rsi,rdi,rsp,rbp,r8,r9,r10,r11,r12,r13,r14,r15;
+YMM_T ymm_regs[16];
+X87_T x87_regs[8];
+extern volatile unsigned long volatile_var;
+extern void snapshot (void);
+extern void snapshot_ret (void);
+#define WRAP_CALL(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot)
+#define WRAP_RET(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot_ret)
+
+/* Clear all integer registers. */
+#define clear_int_hardware_registers \
+ asm __volatile__ ("xor %%rax, %%rax\n\t" \
+ "xor %%rbx, %%rbx\n\t" \
+ "xor %%rcx, %%rcx\n\t" \
+ "xor %%rdx, %%rdx\n\t" \
+ "xor %%rsi, %%rsi\n\t" \
+ "xor %%rdi, %%rdi\n\t" \
+ "xor %%r8, %%r8\n\t" \
+ "xor %%r9, %%r9\n\t" \
+ "xor %%r10, %%r10\n\t" \
+ "xor %%r11, %%r11\n\t" \
+ "xor %%r12, %%r12\n\t" \
+ "xor %%r13, %%r13\n\t" \
+ "xor %%r14, %%r14\n\t" \
+ "xor %%r15, %%r15\n\t" \
+ ::: "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", \
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15");
+
+/* This is the list of registers available for passing arguments. Not all of
+ these are used or even really available. */
+struct IntegerRegisters
+{
+ unsigned long rax, rbx, rcx, rdx, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15;
+};
+struct FloatRegisters
+{
+ double mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7;
+ long double st0, st1, st2, st3, st4, st5, st6, st7;
+ YMM_T ymm0, ymm1, ymm2, ymm3, ymm4, ymm5, ymm6, ymm7, ymm8, ymm9,
+ ymm10, ymm11, ymm12, ymm13, ymm14, ymm15;
+};
+
+/* Implemented in scalarargs.c */
+extern struct IntegerRegisters iregs;
+extern struct FloatRegisters fregs;
+extern unsigned int num_iregs, num_fregs;
+
+#define check_int_arguments do { \
+ assert (num_iregs <= 0 || iregs.I0 == I0); \
+ assert (num_iregs <= 1 || iregs.I1 == I1); \
+ assert (num_iregs <= 2 || iregs.I2 == I2); \
+ assert (num_iregs <= 3 || iregs.I3 == I3); \
+ assert (num_iregs <= 4 || iregs.I4 == I4); \
+ assert (num_iregs <= 5 || iregs.I5 == I5); \
+ } while (0)
+
+#define check_char_arguments check_int_arguments
+#define check_short_arguments check_int_arguments
+#define check_long_arguments check_int_arguments
+
+/* Clear register struct. */
+#define clear_struct_registers \
+ rax = rbx = rcx = rdx = rdi = rsi = rbp = rsp \
+ = r8 = r9 = r10 = r11 = r12 = r13 = r14 = r15 = 0; \
+ memset (&iregs, 0, sizeof (iregs)); \
+ memset (&fregs, 0, sizeof (fregs)); \
+ memset (ymm_regs, 0, sizeof (ymm_regs)); \
+ memset (x87_regs, 0, sizeof (x87_regs));
+
+/* Clear both hardware and register structs for integers. */
+#define clear_int_registers \
+ clear_struct_registers \
+ clear_int_hardware_registers
+
+/* TODO: Do the checking. */
+#define check_f_arguments(T) do { \
+ assert (num_fregs <= 0 || fregs.ymm0._ ## T [0] == ymm_regs[0]._ ## T [0]); \
+ assert (num_fregs <= 1 || fregs.ymm1._ ## T [0] == ymm_regs[1]._ ## T [0]); \
+ assert (num_fregs <= 2 || fregs.ymm2._ ## T [0] == ymm_regs[2]._ ## T [0]); \
+ assert (num_fregs <= 3 || fregs.ymm3._ ## T [0] == ymm_regs[3]._ ## T [0]); \
+ assert (num_fregs <= 4 || fregs.ymm4._ ## T [0] == ymm_regs[4]._ ## T [0]); \
+ assert (num_fregs <= 5 || fregs.ymm5._ ## T [0] == ymm_regs[5]._ ## T [0]); \
+ assert (num_fregs <= 6 || fregs.ymm6._ ## T [0] == ymm_regs[6]._ ## T [0]); \
+ assert (num_fregs <= 7 || fregs.ymm7._ ## T [0] == ymm_regs[7]._ ## T [0]); \
+ } while (0)
+
+#define check_float_arguments check_f_arguments(float)
+#define check_double_arguments check_f_arguments(double)
+
+#define check_vector_arguments(T,O) do { \
+ assert (num_fregs <= 0 \
+ || memcmp (((char *) &fregs.ymm0) + (O), \
+ &ymm_regs[0], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 1 \
+ || memcmp (((char *) &fregs.ymm1) + (O), \
+ &ymm_regs[1], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 2 \
+ || memcmp (((char *) &fregs.ymm2) + (O), \
+ &ymm_regs[2], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 3 \
+ || memcmp (((char *) &fregs.ymm3) + (O), \
+ &ymm_regs[3], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 4 \
+ || memcmp (((char *) &fregs.ymm4) + (O), \
+ &ymm_regs[4], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 5 \
+ || memcmp (((char *) &fregs.ymm5) + (O), \
+ &ymm_regs[5], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 6 \
+ || memcmp (((char *) &fregs.ymm6) + (O), \
+ &ymm_regs[6], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 7 \
+ || memcmp (((char *) &fregs.ymm7) + (O), \
+ &ymm_regs[7], \
+ sizeof (__ ## T) - (O)) == 0); \
+ } while (0)
+
+#define check_m64_arguments check_vector_arguments(m64, 0)
+#define check_m128_arguments check_vector_arguments(m128, 0)
+#define check_m256_arguments check_vector_arguments(m256, 0)
+
+#endif /* INCLUDED_ARGS_H */
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S
new file mode 100644
index 000000000..d248ef02e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/asm-support.S
@@ -0,0 +1,82 @@
+ .file "snapshot.S"
+ .text
+ .p2align 4,,15
+.globl snapshot
+ .type snapshot, @function
+snapshot:
+.LFB3:
+ movq %rax, rax(%rip)
+ movq %rbx, rbx(%rip)
+ movq %rcx, rcx(%rip)
+ movq %rdx, rdx(%rip)
+ movq %rdi, rdi(%rip)
+ movq %rsi, rsi(%rip)
+ movq %rbp, rbp(%rip)
+ movq %rsp, rsp(%rip)
+ movq %r8, r8(%rip)
+ movq %r9, r9(%rip)
+ movq %r10, r10(%rip)
+ movq %r11, r11(%rip)
+ movq %r12, r12(%rip)
+ movq %r13, r13(%rip)
+ movq %r14, r14(%rip)
+ movq %r15, r15(%rip)
+ vmovdqu %ymm0, ymm_regs+0(%rip)
+ vmovdqu %ymm1, ymm_regs+32(%rip)
+ vmovdqu %ymm2, ymm_regs+64(%rip)
+ vmovdqu %ymm3, ymm_regs+96(%rip)
+ vmovdqu %ymm4, ymm_regs+128(%rip)
+ vmovdqu %ymm5, ymm_regs+160(%rip)
+ vmovdqu %ymm6, ymm_regs+192(%rip)
+ vmovdqu %ymm7, ymm_regs+224(%rip)
+ vmovdqu %ymm8, ymm_regs+256(%rip)
+ vmovdqu %ymm9, ymm_regs+288(%rip)
+ vmovdqu %ymm10, ymm_regs+320(%rip)
+ vmovdqu %ymm11, ymm_regs+352(%rip)
+ vmovdqu %ymm12, ymm_regs+384(%rip)
+ vmovdqu %ymm13, ymm_regs+416(%rip)
+ vmovdqu %ymm14, ymm_regs+448(%rip)
+ vmovdqu %ymm15, ymm_regs+480(%rip)
+ jmp *callthis(%rip)
+.LFE3:
+ .size snapshot, .-snapshot
+
+ .p2align 4,,15
+.globl snapshot_ret
+ .type snapshot_ret, @function
+snapshot_ret:
+ movq %rdi, rdi(%rip)
+ subq $8, %rsp
+ call *callthis(%rip)
+ addq $8, %rsp
+ movq %rax, rax(%rip)
+ movq %rdx, rdx(%rip)
+ vmovdqu %ymm0, ymm_regs+0(%rip)
+ vmovdqu %ymm1, ymm_regs+32(%rip)
+ fstpt x87_regs(%rip)
+ fstpt x87_regs+16(%rip)
+ fldt x87_regs+16(%rip)
+ fldt x87_regs(%rip)
+ ret
+ .size snapshot_ret, .-snapshot_ret
+
+ .comm callthis,8,8
+ .comm rax,8,8
+ .comm rbx,8,8
+ .comm rcx,8,8
+ .comm rdx,8,8
+ .comm rsi,8,8
+ .comm rdi,8,8
+ .comm rsp,8,8
+ .comm rbp,8,8
+ .comm r8,8,8
+ .comm r9,8,8
+ .comm r10,8,8
+ .comm r11,8,8
+ .comm r12,8,8
+ .comm r13,8,8
+ .comm r14,8,8
+ .comm r15,8,8
+ .comm ymm_regs,512,32
+ .comm x87_regs,128,32
+ .comm volatile_var,8,8
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/avx-check.h b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/avx-check.h
new file mode 100644
index 000000000..e66a27e9a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/avx-check.h
@@ -0,0 +1,28 @@
+#include <stdlib.h>
+#include "cpuid.h"
+
+static void avx_test (void);
+
+int
+main ()
+{
+ unsigned int eax, ebx, ecx, edx;
+
+ if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
+ return 0;
+
+ /* Run AVX test only if host has AVX support. */
+ if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE))
+ {
+ avx_test ();
+#ifdef DEBUG
+ printf ("PASSED\n");
+#endif
+ }
+#ifdef DEBUG
+ else
+ printf ("SKIPPED\n");
+#endif
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_m256_returning.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_m256_returning.c
new file mode 100644
index 000000000..072d83962
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_m256_returning.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include "avx-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+__m256
+fun_test_returning___m256 (void)
+{
+ volatile_var++;
+ return (__m256){73,0,0,0,0,0,0,0};
+}
+
+__m256 test_256;
+
+static void
+avx_test (void)
+{
+ unsigned failed = 0;
+ YMM_T ymmt1, ymmt2;
+
+ clear_struct_registers;
+ test_256 = (__m256){73,0,0,0,0,0,0,0};
+ ymmt1._m256[0] = test_256;
+ ymmt2._m256[0] = WRAP_RET (fun_test_returning___m256)();
+ if (memcmp (&ymmt1, &ymmt2, sizeof (ymmt2)) != 0)
+ printf ("fail m256\n"), failed++;
+ if (failed)
+ abort ();
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_passing_m256.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_passing_m256.c
new file mode 100644
index 000000000..ffc3ec36b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_passing_m256.c
@@ -0,0 +1,168 @@
+#include <stdio.h>
+#include "avx-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ YMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+fun_check_passing_m256_8_values (__m256 i0 ATTRIBUTE_UNUSED, __m256 i1 ATTRIBUTE_UNUSED, __m256 i2 ATTRIBUTE_UNUSED, __m256 i3 ATTRIBUTE_UNUSED, __m256 i4 ATTRIBUTE_UNUSED, __m256 i5 ATTRIBUTE_UNUSED, __m256 i6 ATTRIBUTE_UNUSED, __m256 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m256);
+ compare (values.i1, i1, __m256);
+ compare (values.i2, i2, __m256);
+ compare (values.i3, i3, __m256);
+ compare (values.i4, i4, __m256);
+ compare (values.i5, i5, __m256);
+ compare (values.i6, i6, __m256);
+ compare (values.i7, i7, __m256);
+}
+
+void
+fun_check_passing_m256_8_regs (__m256 i0 ATTRIBUTE_UNUSED, __m256 i1 ATTRIBUTE_UNUSED, __m256 i2 ATTRIBUTE_UNUSED, __m256 i3 ATTRIBUTE_UNUSED, __m256 i4 ATTRIBUTE_UNUSED, __m256 i5 ATTRIBUTE_UNUSED, __m256 i6 ATTRIBUTE_UNUSED, __m256 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m256_arguments;
+}
+
+void
+fun_check_passing_m256_20_values (__m256 i0 ATTRIBUTE_UNUSED, __m256 i1 ATTRIBUTE_UNUSED, __m256 i2 ATTRIBUTE_UNUSED, __m256 i3 ATTRIBUTE_UNUSED, __m256 i4 ATTRIBUTE_UNUSED, __m256 i5 ATTRIBUTE_UNUSED, __m256 i6 ATTRIBUTE_UNUSED, __m256 i7 ATTRIBUTE_UNUSED, __m256 i8 ATTRIBUTE_UNUSED, __m256 i9 ATTRIBUTE_UNUSED, __m256 i10 ATTRIBUTE_UNUSED, __m256 i11 ATTRIBUTE_UNUSED, __m256 i12 ATTRIBUTE_UNUSED, __m256 i13 ATTRIBUTE_UNUSED, __m256 i14 ATTRIBUTE_UNUSED, __m256 i15 ATTRIBUTE_UNUSED, __m256 i16 ATTRIBUTE_UNUSED, __m256 i17 ATTRIBUTE_UNUSED, __m256 i18 ATTRIBUTE_UNUSED, __m256 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m256);
+ compare (values.i1, i1, __m256);
+ compare (values.i2, i2, __m256);
+ compare (values.i3, i3, __m256);
+ compare (values.i4, i4, __m256);
+ compare (values.i5, i5, __m256);
+ compare (values.i6, i6, __m256);
+ compare (values.i7, i7, __m256);
+ compare (values.i8, i8, __m256);
+ compare (values.i9, i9, __m256);
+ compare (values.i10, i10, __m256);
+ compare (values.i11, i11, __m256);
+ compare (values.i12, i12, __m256);
+ compare (values.i13, i13, __m256);
+ compare (values.i14, i14, __m256);
+ compare (values.i15, i15, __m256);
+ compare (values.i16, i16, __m256);
+ compare (values.i17, i17, __m256);
+ compare (values.i18, i18, __m256);
+ compare (values.i19, i19, __m256);
+}
+
+void
+fun_check_passing_m256_20_regs (__m256 i0 ATTRIBUTE_UNUSED, __m256 i1 ATTRIBUTE_UNUSED, __m256 i2 ATTRIBUTE_UNUSED, __m256 i3 ATTRIBUTE_UNUSED, __m256 i4 ATTRIBUTE_UNUSED, __m256 i5 ATTRIBUTE_UNUSED, __m256 i6 ATTRIBUTE_UNUSED, __m256 i7 ATTRIBUTE_UNUSED, __m256 i8 ATTRIBUTE_UNUSED, __m256 i9 ATTRIBUTE_UNUSED, __m256 i10 ATTRIBUTE_UNUSED, __m256 i11 ATTRIBUTE_UNUSED, __m256 i12 ATTRIBUTE_UNUSED, __m256 i13 ATTRIBUTE_UNUSED, __m256 i14 ATTRIBUTE_UNUSED, __m256 i15 ATTRIBUTE_UNUSED, __m256 i16 ATTRIBUTE_UNUSED, __m256 i17 ATTRIBUTE_UNUSED, __m256 i18 ATTRIBUTE_UNUSED, __m256 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m256_arguments;
+}
+
+
+#define def_check_passing8(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7); \
+ \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7);
+
+#define def_check_passing20(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, _i18, _i19, _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ values.i10.TYPE[0] = _i10; \
+ values.i11.TYPE[0] = _i11; \
+ values.i12.TYPE[0] = _i12; \
+ values.i13.TYPE[0] = _i13; \
+ values.i14.TYPE[0] = _i14; \
+ values.i15.TYPE[0] = _i15; \
+ values.i16.TYPE[0] = _i16; \
+ values.i17.TYPE[0] = _i17; \
+ values.i18.TYPE[0] = _i18; \
+ values.i19.TYPE[0] = _i19; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, _i18, _i19); \
+ \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, _i18, _i19);
+
+void
+test_m256_on_stack ()
+{
+ __m256 x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m256){32+i, 0, 0, 0, 0, 0, 0, 0};
+ pass = "m256-8";
+ def_check_passing8(x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], fun_check_passing_m256_8_values, fun_check_passing_m256_8_regs, _m256);
+}
+
+void
+test_too_many_m256 ()
+{
+ __m256 x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m256){32+i, 0, 0, 0, 0, 0, 0, 0};
+ pass = "m256-20";
+ def_check_passing20(x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16], x[17], x[18], x[19], fun_check_passing_m256_20_values, fun_check_passing_m256_20_regs, _m256);
+}
+
+static void
+avx_test (void)
+{
+ test_m256_on_stack ();
+ test_too_many_m256 ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_passing_structs.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_passing_structs.c
new file mode 100644
index 000000000..7dbf6a59b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_passing_structs.c
@@ -0,0 +1,61 @@
+#include "avx-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+struct m256_struct
+{
+ __m256 x;
+};
+
+struct m256_2_struct
+{
+ __m256 x1, x2;
+};
+
+/* Check that the struct is passed as the individual members in fregs. */
+void
+check_struct_passing1 (struct m256_struct ms1 ATTRIBUTE_UNUSED,
+ struct m256_struct ms2 ATTRIBUTE_UNUSED,
+ struct m256_struct ms3 ATTRIBUTE_UNUSED,
+ struct m256_struct ms4 ATTRIBUTE_UNUSED,
+ struct m256_struct ms5 ATTRIBUTE_UNUSED,
+ struct m256_struct ms6 ATTRIBUTE_UNUSED,
+ struct m256_struct ms7 ATTRIBUTE_UNUSED,
+ struct m256_struct ms8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_struct_passing2 (struct m256_2_struct ms 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)&ms.x1 == rsp+8);
+ assert ((unsigned long)&ms.x2 == rsp+40);
+}
+
+static void
+avx_test (void)
+{
+ struct m256_struct m256s [8];
+ struct m256_2_struct m256_2s = {
+ { 48.394, 39.3, -397.9, 3484.9, -8.394, -93.3, 7.9, 84.94 },
+ { -8.394, -3.3, -39.9, 34.9, 7.9, 84.94, -48.394, 39.3 }
+ };
+ int i;
+
+ for (i = 0; i < 8; i++)
+ m256s[i].x = (__m256){32+i, 0, i, 0, -i, 0, i - 12, i + 8};
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.ymm0)[i]._m256[0] = m256s[i].x;
+ num_fregs = 8;
+ WRAP_CALL (check_struct_passing1)(m256s[0], m256s[1], m256s[2], m256s[3],
+ m256s[4], m256s[5], m256s[6], m256s[7]);
+ WRAP_CALL (check_struct_passing2)(m256_2s);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_passing_unions.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_passing_unions.c
new file mode 100644
index 000000000..127dd5f30
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx/test_passing_unions.c
@@ -0,0 +1,143 @@
+#include "avx-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+union un1
+{
+ __m256 x;
+ float f;
+};
+
+union un2
+{
+ __m256 x;
+ double d;
+};
+
+union un3
+{
+ __m256 x;
+ __m128 v;
+};
+
+union un4
+{
+ __m256 x;
+ long double ld;
+};
+
+union un5
+{
+ __m256 x;
+ int i;
+};
+
+void
+check_union_passing1(union un1 u1 ATTRIBUTE_UNUSED,
+ union un1 u2 ATTRIBUTE_UNUSED,
+ union un1 u3 ATTRIBUTE_UNUSED,
+ union un1 u4 ATTRIBUTE_UNUSED,
+ union un1 u5 ATTRIBUTE_UNUSED,
+ union un1 u6 ATTRIBUTE_UNUSED,
+ union un1 u7 ATTRIBUTE_UNUSED,
+ union un1 u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing2(union un2 u1 ATTRIBUTE_UNUSED,
+ union un2 u2 ATTRIBUTE_UNUSED,
+ union un2 u3 ATTRIBUTE_UNUSED,
+ union un2 u4 ATTRIBUTE_UNUSED,
+ union un2 u5 ATTRIBUTE_UNUSED,
+ union un2 u6 ATTRIBUTE_UNUSED,
+ union un2 u7 ATTRIBUTE_UNUSED,
+ union un2 u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing3(union un3 u1 ATTRIBUTE_UNUSED,
+ union un3 u2 ATTRIBUTE_UNUSED,
+ union un3 u3 ATTRIBUTE_UNUSED,
+ union un3 u4 ATTRIBUTE_UNUSED,
+ union un3 u5 ATTRIBUTE_UNUSED,
+ union un3 u6 ATTRIBUTE_UNUSED,
+ union un3 u7 ATTRIBUTE_UNUSED,
+ union un3 u8 ATTRIBUTE_UNUSED)
+{
+ check_m256_arguments;
+}
+
+void
+check_union_passing4(union un4 u 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)&u.x == rsp+8);
+ assert ((unsigned long)&u.ld == rsp+8);
+}
+
+void
+check_union_passing5(union un5 u 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)&u.x == rsp+8);
+ assert ((unsigned long)&u.i == rsp+8);
+}
+
+#define check_union_passing1 WRAP_CALL(check_union_passing1)
+#define check_union_passing2 WRAP_CALL(check_union_passing2)
+#define check_union_passing3 WRAP_CALL(check_union_passing3)
+#define check_union_passing4 WRAP_CALL(check_union_passing4)
+#define check_union_passing5 WRAP_CALL(check_union_passing5)
+
+static void
+avx_test (void)
+{
+ union un1 u1[8];
+ union un2 u2[8];
+ union un3 u3[8];
+ union un4 u4;
+ union un5 u5;
+ int i;
+
+ for (i = 0; i < 8; i++)
+ u1[i].x = (__m256){32+i, 0, i, 0, -i, 0, i - 12, i + 8};
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.ymm0)[i]._m256[0] = u1[i].x;
+ num_fregs = 8;
+ check_union_passing1(u1[0], u1[1], u1[2], u1[3],
+ u1[4], u1[5], u1[6], u1[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u2[i].x = u1[i].x;
+ (&fregs.ymm0)[i]._m256[0] = u2[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing2(u2[0], u2[1], u2[2], u2[3],
+ u2[4], u2[5], u2[6], u2[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u3[i].x = u1[i].x;
+ (&fregs.ymm0)[i]._m256[0] = u3[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing3(u3[0], u3[1], u3[2], u3[3],
+ u3[4], u3[5], u3[6], u3[7]);
+
+ check_union_passing4(u4);
+ check_union_passing5(u5);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/abi-avx512f.exp b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/abi-avx512f.exp
new file mode 100644
index 000000000..cef6fa141
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/abi-avx512f.exp
@@ -0,0 +1,61 @@
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# The x86-64 AVX512F ABI testsuite needs one additional assembler file for most
+# testcases. For simplicity we will just link it into each test.
+
+load_lib c-torture.exp
+load_lib target-supports.exp
+load_lib torture-options.exp
+
+if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
+ || ![is-effective-target lp64]
+ || ![is-effective-target avx512f] } then {
+ return
+}
+
+
+# If the linker used understands -M <mapfile>, pass it to clear hardware
+# capabilities set by the Sun assembler.
+set flags ""
+set clearcap_ldflags "-Wl,-M,$srcdir/gcc.target/i386/clearcap.map"
+
+if [check_no_compiler_messages mapfile executable {
+ int main (void) { return 0; }
+ } $clearcap_ldflags ] {
+ set flags $clearcap_ldflags
+}
+
+torture-init
+set-torture-options $C_TORTURE_OPTIONS
+set additional_flags "-W -Wall -mavx512f $flags"
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/test_*.c]] {
+ if {[runtest_file_p $runtests $src]} {
+ if { ([istarget *-*-darwin*]) } then {
+ # FIXME: Darwin isn't tested.
+ c-torture-execute [list $src \
+ $srcdir/$subdir/asm-support-darwin.s] \
+ $additional_flags
+ } else {
+ c-torture-execute [list $src \
+ $srcdir/$subdir/asm-support.S] \
+ $additional_flags
+ }
+ }
+}
+
+torture-finish
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/args.h b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/args.h
new file mode 100644
index 000000000..5e3b265ec
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/args.h
@@ -0,0 +1,184 @@
+#ifndef INCLUDED_ARGS_H
+#define INCLUDED_ARGS_H
+
+#include <immintrin.h>
+#include <string.h>
+
+/* Assertion macro. */
+#define assert(test) if (!(test)) abort()
+
+#ifdef __GNUC__
+#define ATTRIBUTE_UNUSED __attribute__((__unused__))
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+/* This defines the calling sequences for integers and floats. */
+#define I0 rdi
+#define I1 rsi
+#define I2 rdx
+#define I3 rcx
+#define I4 r8
+#define I5 r9
+#define F0 zmm0
+#define F1 zmm1
+#define F2 zmm2
+#define F3 zmm3
+#define F4 zmm4
+#define F5 zmm5
+#define F6 zmm6
+#define F7 zmm7
+
+typedef union {
+ float _float[16];
+ double _double[8];
+ long _long[8];
+ int _int[16];
+ unsigned long _ulong[8];
+ __m64 _m64[8];
+ __m128 _m128[4];
+ __m256 _m256[2];
+ __m512 _m512[1];
+} ZMM_T;
+
+typedef union {
+ float _float;
+ double _double;
+ long double _ldouble;
+ unsigned long _ulong[2];
+} X87_T;
+extern void (*callthis)(void);
+extern unsigned long rax,rbx,rcx,rdx,rsi,rdi,rsp,rbp,r8,r9,r10,r11,r12,r13,r14,r15;
+ZMM_T zmm_regs[32];
+X87_T x87_regs[8];
+extern volatile unsigned long volatile_var;
+extern void snapshot (void);
+extern void snapshot_ret (void);
+#define WRAP_CALL(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot)
+#define WRAP_RET(N) \
+ (callthis = (void (*)()) (N), (typeof (&N)) snapshot_ret)
+
+/* Clear all integer registers. */
+#define clear_int_hardware_registers \
+ asm __volatile__ ("xor %%rax, %%rax\n\t" \
+ "xor %%rbx, %%rbx\n\t" \
+ "xor %%rcx, %%rcx\n\t" \
+ "xor %%rdx, %%rdx\n\t" \
+ "xor %%rsi, %%rsi\n\t" \
+ "xor %%rdi, %%rdi\n\t" \
+ "xor %%r8, %%r8\n\t" \
+ "xor %%r9, %%r9\n\t" \
+ "xor %%r10, %%r10\n\t" \
+ "xor %%r11, %%r11\n\t" \
+ "xor %%r12, %%r12\n\t" \
+ "xor %%r13, %%r13\n\t" \
+ "xor %%r14, %%r14\n\t" \
+ "xor %%r15, %%r15\n\t" \
+ ::: "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", \
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15");
+
+/* This is the list of registers available for passing arguments. Not all of
+ these are used or even really available. */
+struct IntegerRegisters
+{
+ unsigned long rax, rbx, rcx, rdx, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15;
+};
+struct FloatRegisters
+{
+ double mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7;
+ long double st0, st1, st2, st3, st4, st5, st6, st7;
+ ZMM_T zmm0, zmm1, zmm2, zmm3, zmm4, zmm5, zmm6, zmm7, zmm8, zmm9,
+ zmm10, zmm11, zmm12, zmm13, zmm14, zmm15, zmm16, zmm17, zmm18,
+ zmm19, zmm20, zmm21, zmm22, zmm23, zmm24, zmm25, zmm26, zmm27,
+ zmm28, zmm29, zmm30, zmm31;
+};
+
+/* Implemented in scalarargs.c */
+extern struct IntegerRegisters iregs;
+extern struct FloatRegisters fregs;
+extern unsigned int num_iregs, num_fregs;
+
+#define check_int_arguments do { \
+ assert (num_iregs <= 0 || iregs.I0 == I0); \
+ assert (num_iregs <= 1 || iregs.I1 == I1); \
+ assert (num_iregs <= 2 || iregs.I2 == I2); \
+ assert (num_iregs <= 3 || iregs.I3 == I3); \
+ assert (num_iregs <= 4 || iregs.I4 == I4); \
+ assert (num_iregs <= 5 || iregs.I5 == I5); \
+ } while (0)
+
+#define check_char_arguments check_int_arguments
+#define check_short_arguments check_int_arguments
+#define check_long_arguments check_int_arguments
+
+/* Clear register struct. */
+#define clear_struct_registers \
+ rax = rbx = rcx = rdx = rdi = rsi = rbp = rsp \
+ = r8 = r9 = r10 = r11 = r12 = r13 = r14 = r15 = 0; \
+ memset (&iregs, 0, sizeof (iregs)); \
+ memset (&fregs, 0, sizeof (fregs)); \
+ memset (zmm_regs, 0, sizeof (zmm_regs)); \
+ memset (x87_regs, 0, sizeof (x87_regs));
+
+/* Clear both hardware and register structs for integers. */
+#define clear_int_registers \
+ clear_struct_registers \
+ clear_int_hardware_registers
+
+/* TODO: Do the checking. */
+#define check_f_arguments(T) do { \
+ assert (num_fregs <= 0 || fregs.zmm0._ ## T [0] == zmm_regs[0]._ ## T [0]); \
+ assert (num_fregs <= 1 || fregs.zmm1._ ## T [0] == zmm_regs[1]._ ## T [0]); \
+ assert (num_fregs <= 2 || fregs.zmm2._ ## T [0] == zmm_regs[2]._ ## T [0]); \
+ assert (num_fregs <= 3 || fregs.zmm3._ ## T [0] == zmm_regs[3]._ ## T [0]); \
+ assert (num_fregs <= 4 || fregs.zmm4._ ## T [0] == zmm_regs[4]._ ## T [0]); \
+ assert (num_fregs <= 5 || fregs.zmm5._ ## T [0] == zmm_regs[5]._ ## T [0]); \
+ assert (num_fregs <= 6 || fregs.zmm6._ ## T [0] == zmm_regs[6]._ ## T [0]); \
+ assert (num_fregs <= 7 || fregs.zmm7._ ## T [0] == zmm_regs[7]._ ## T [0]); \
+ } while (0)
+
+#define check_float_arguments check_f_arguments(float)
+#define check_double_arguments check_f_arguments(double)
+
+#define check_vector_arguments(T,O) do { \
+ assert (num_fregs <= 0 \
+ || memcmp (((char *) &fregs.zmm0) + (O), \
+ &zmm_regs[0], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 1 \
+ || memcmp (((char *) &fregs.zmm1) + (O), \
+ &zmm_regs[1], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 2 \
+ || memcmp (((char *) &fregs.zmm2) + (O), \
+ &zmm_regs[2], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 3 \
+ || memcmp (((char *) &fregs.zmm3) + (O), \
+ &zmm_regs[3], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 4 \
+ || memcmp (((char *) &fregs.zmm4) + (O), \
+ &zmm_regs[4], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 5 \
+ || memcmp (((char *) &fregs.zmm5) + (O), \
+ &zmm_regs[5], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 6 \
+ || memcmp (((char *) &fregs.zmm6) + (O), \
+ &zmm_regs[6], \
+ sizeof (__ ## T) - (O)) == 0); \
+ assert (num_fregs <= 7 \
+ || memcmp (((char *) &fregs.zmm7) + (O), \
+ &zmm_regs[7], \
+ sizeof (__ ## T) - (O)) == 0); \
+ } while (0)
+
+#define check_m64_arguments check_vector_arguments(m64, 0)
+#define check_m128_arguments check_vector_arguments(m128, 0)
+#define check_m256_arguments check_vector_arguments(m256, 0)
+#define check_m512_arguments check_vector_arguments(m512, 0)
+
+#endif /* INCLUDED_ARGS_H */
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S
new file mode 100644
index 000000000..e0309aeac
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/asm-support.S
@@ -0,0 +1,98 @@
+ .file "snapshot.S"
+ .text
+ .p2align 4,,15
+.globl snapshot
+ .type snapshot, @function
+snapshot:
+.LFB3:
+ movq %rax, rax(%rip)
+ movq %rbx, rbx(%rip)
+ movq %rcx, rcx(%rip)
+ movq %rdx, rdx(%rip)
+ movq %rdi, rdi(%rip)
+ movq %rsi, rsi(%rip)
+ movq %rbp, rbp(%rip)
+ movq %rsp, rsp(%rip)
+ movq %r8, r8(%rip)
+ movq %r9, r9(%rip)
+ movq %r10, r10(%rip)
+ movq %r11, r11(%rip)
+ movq %r12, r12(%rip)
+ movq %r13, r13(%rip)
+ movq %r14, r14(%rip)
+ movq %r15, r15(%rip)
+ vmovdqu32 %zmm0, zmm_regs+0(%rip)
+ vmovdqu32 %zmm1, zmm_regs+64(%rip)
+ vmovdqu32 %zmm2, zmm_regs+128(%rip)
+ vmovdqu32 %zmm3, zmm_regs+192(%rip)
+ vmovdqu32 %zmm4, zmm_regs+256(%rip)
+ vmovdqu32 %zmm5, zmm_regs+320(%rip)
+ vmovdqu32 %zmm6, zmm_regs+384(%rip)
+ vmovdqu32 %zmm7, zmm_regs+448(%rip)
+ vmovdqu32 %zmm8, zmm_regs+512(%rip)
+ vmovdqu32 %zmm9, zmm_regs+576(%rip)
+ vmovdqu32 %zmm10, zmm_regs+640(%rip)
+ vmovdqu32 %zmm11, zmm_regs+704(%rip)
+ vmovdqu32 %zmm12, zmm_regs+768(%rip)
+ vmovdqu32 %zmm13, zmm_regs+832(%rip)
+ vmovdqu32 %zmm14, zmm_regs+896(%rip)
+ vmovdqu32 %zmm15, zmm_regs+960(%rip)
+ vmovdqu32 %zmm16, zmm_regs+1024(%rip)
+ vmovdqu32 %zmm17, zmm_regs+1088(%rip)
+ vmovdqu32 %zmm18, zmm_regs+1152(%rip)
+ vmovdqu32 %zmm19, zmm_regs+1216(%rip)
+ vmovdqu32 %zmm20, zmm_regs+1280(%rip)
+ vmovdqu32 %zmm21, zmm_regs+1344(%rip)
+ vmovdqu32 %zmm22, zmm_regs+1408(%rip)
+ vmovdqu32 %zmm23, zmm_regs+1472(%rip)
+ vmovdqu32 %zmm24, zmm_regs+1536(%rip)
+ vmovdqu32 %zmm25, zmm_regs+1600(%rip)
+ vmovdqu32 %zmm26, zmm_regs+1664(%rip)
+ vmovdqu32 %zmm27, zmm_regs+1728(%rip)
+ vmovdqu32 %zmm28, zmm_regs+1792(%rip)
+ vmovdqu32 %zmm29, zmm_regs+1856(%rip)
+ vmovdqu32 %zmm30, zmm_regs+1920(%rip)
+ vmovdqu32 %zmm31, zmm_regs+1984(%rip)
+ jmp *callthis(%rip)
+.LFE3:
+ .size snapshot, .-snapshot
+
+ .p2align 4,,15
+.globl snapshot_ret
+ .type snapshot_ret, @function
+snapshot_ret:
+ movq %rdi, rdi(%rip)
+ subq $8, %rsp
+ call *callthis(%rip)
+ addq $8, %rsp
+ movq %rax, rax(%rip)
+ movq %rdx, rdx(%rip)
+ vmovdqu32 %zmm0, zmm_regs+0(%rip)
+ vmovdqu32 %zmm1, zmm_regs+64(%rip)
+ fstpt x87_regs(%rip)
+ fstpt x87_regs+16(%rip)
+ fldt x87_regs+16(%rip)
+ fldt x87_regs(%rip)
+ ret
+ .size snapshot_ret, .-snapshot_ret
+
+ .comm callthis,8,8
+ .comm rax,8,8
+ .comm rbx,8,8
+ .comm rcx,8,8
+ .comm rdx,8,8
+ .comm rsi,8,8
+ .comm rdi,8,8
+ .comm rsp,8,8
+ .comm rbp,8,8
+ .comm r8,8,8
+ .comm r9,8,8
+ .comm r10,8,8
+ .comm r11,8,8
+ .comm r12,8,8
+ .comm r13,8,8
+ .comm r14,8,8
+ .comm r15,8,8
+ .comm zmm_regs,2048,64
+ .comm x87_regs,128,32
+ .comm volatile_var,8,8
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/avx512f-check.h b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/avx512f-check.h
new file mode 100644
index 000000000..25ce544c4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/avx512f-check.h
@@ -0,0 +1,41 @@
+#include <stdlib.h>
+#include "cpuid.h"
+
+static void avx512f_test (void);
+
+int
+main ()
+{
+ unsigned int eax, ebx, ecx, edx;
+
+ if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
+ return 0;
+
+#define DEBUG
+ /* Run AVX test only if host has AVX support. */
+ if ((ecx & bit_OSXSAVE) == bit_OSXSAVE)
+ {
+ if (__get_cpuid_max (0, NULL) < 7)
+ return 0;
+
+ __cpuid_count (7, 0, eax, ebx, ecx, edx);
+
+ if ((ebx & bit_AVX512F) == bit_AVX512F)
+ {
+ avx512f_test ();
+#ifdef DEBUG
+ printf ("PASSED\n");
+#endif
+ }
+#ifdef DEBUG
+ else
+ printf ("SKIPPED\n");
+#endif
+ }
+#ifdef DEBUG
+ else
+ printf ("SKIPPED\n");
+#endif
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_m512_returning.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_m512_returning.c
new file mode 100644
index 000000000..ee126b551
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_m512_returning.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include "avx512f-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+__m512
+fun_test_returning___m512 (void)
+{
+ volatile_var++;
+ return (__m512){73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+}
+
+__m512 test_512;
+
+static void
+avx512f_test (void)
+{
+ unsigned failed = 0;
+ ZMM_T zmmt1, zmmt2;
+
+ clear_struct_registers;
+ test_512 = (__m512){73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ zmmt1._m512[0] = test_512;
+ zmmt2._m512[0] = WRAP_RET (fun_test_returning___m512)();
+ if (memcmp (&zmmt1, &zmmt2, sizeof (zmmt2)) != 0)
+ printf ("fail m512\n"), failed++;
+ if (failed)
+ abort ();
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_m512.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_m512.c
new file mode 100644
index 000000000..ead9c6797
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_m512.c
@@ -0,0 +1,168 @@
+#include <stdio.h>
+#include "avx512f-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ ZMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+fun_check_passing_m512_8_values (__m512 i0 ATTRIBUTE_UNUSED, __m512 i1 ATTRIBUTE_UNUSED, __m512 i2 ATTRIBUTE_UNUSED, __m512 i3 ATTRIBUTE_UNUSED, __m512 i4 ATTRIBUTE_UNUSED, __m512 i5 ATTRIBUTE_UNUSED, __m512 i6 ATTRIBUTE_UNUSED, __m512 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m512);
+ compare (values.i1, i1, __m512);
+ compare (values.i2, i2, __m512);
+ compare (values.i3, i3, __m512);
+ compare (values.i4, i4, __m512);
+ compare (values.i5, i5, __m512);
+ compare (values.i6, i6, __m512);
+ compare (values.i7, i7, __m512);
+}
+
+void
+fun_check_passing_m512_8_regs (__m512 i0 ATTRIBUTE_UNUSED, __m512 i1 ATTRIBUTE_UNUSED, __m512 i2 ATTRIBUTE_UNUSED, __m512 i3 ATTRIBUTE_UNUSED, __m512 i4 ATTRIBUTE_UNUSED, __m512 i5 ATTRIBUTE_UNUSED, __m512 i6 ATTRIBUTE_UNUSED, __m512 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+fun_check_passing_m512_20_values (__m512 i0 ATTRIBUTE_UNUSED, __m512 i1 ATTRIBUTE_UNUSED, __m512 i2 ATTRIBUTE_UNUSED, __m512 i3 ATTRIBUTE_UNUSED, __m512 i4 ATTRIBUTE_UNUSED, __m512 i5 ATTRIBUTE_UNUSED, __m512 i6 ATTRIBUTE_UNUSED, __m512 i7 ATTRIBUTE_UNUSED, __m512 i8 ATTRIBUTE_UNUSED, __m512 i9 ATTRIBUTE_UNUSED, __m512 i10 ATTRIBUTE_UNUSED, __m512 i11 ATTRIBUTE_UNUSED, __m512 i12 ATTRIBUTE_UNUSED, __m512 i13 ATTRIBUTE_UNUSED, __m512 i14 ATTRIBUTE_UNUSED, __m512 i15 ATTRIBUTE_UNUSED, __m512 i16 ATTRIBUTE_UNUSED, __m512 i17 ATTRIBUTE_UNUSED, __m512 i18 ATTRIBUTE_UNUSED, __m512 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m512);
+ compare (values.i1, i1, __m512);
+ compare (values.i2, i2, __m512);
+ compare (values.i3, i3, __m512);
+ compare (values.i4, i4, __m512);
+ compare (values.i5, i5, __m512);
+ compare (values.i6, i6, __m512);
+ compare (values.i7, i7, __m512);
+ compare (values.i8, i8, __m512);
+ compare (values.i9, i9, __m512);
+ compare (values.i10, i10, __m512);
+ compare (values.i11, i11, __m512);
+ compare (values.i12, i12, __m512);
+ compare (values.i13, i13, __m512);
+ compare (values.i14, i14, __m512);
+ compare (values.i15, i15, __m512);
+ compare (values.i16, i16, __m512);
+ compare (values.i17, i17, __m512);
+ compare (values.i18, i18, __m512);
+ compare (values.i19, i19, __m512);
+}
+
+void
+fun_check_passing_m512_20_regs (__m512 i0 ATTRIBUTE_UNUSED, __m512 i1 ATTRIBUTE_UNUSED, __m512 i2 ATTRIBUTE_UNUSED, __m512 i3 ATTRIBUTE_UNUSED, __m512 i4 ATTRIBUTE_UNUSED, __m512 i5 ATTRIBUTE_UNUSED, __m512 i6 ATTRIBUTE_UNUSED, __m512 i7 ATTRIBUTE_UNUSED, __m512 i8 ATTRIBUTE_UNUSED, __m512 i9 ATTRIBUTE_UNUSED, __m512 i10 ATTRIBUTE_UNUSED, __m512 i11 ATTRIBUTE_UNUSED, __m512 i12 ATTRIBUTE_UNUSED, __m512 i13 ATTRIBUTE_UNUSED, __m512 i14 ATTRIBUTE_UNUSED, __m512 i15 ATTRIBUTE_UNUSED, __m512 i16 ATTRIBUTE_UNUSED, __m512 i17 ATTRIBUTE_UNUSED, __m512 i18 ATTRIBUTE_UNUSED, __m512 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+
+#define def_check_passing8(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7); \
+ \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7);
+
+#define def_check_passing20(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, _i18, _i19, _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ values.i10.TYPE[0] = _i10; \
+ values.i11.TYPE[0] = _i11; \
+ values.i12.TYPE[0] = _i12; \
+ values.i13.TYPE[0] = _i13; \
+ values.i14.TYPE[0] = _i14; \
+ values.i15.TYPE[0] = _i15; \
+ values.i16.TYPE[0] = _i16; \
+ values.i17.TYPE[0] = _i17; \
+ values.i18.TYPE[0] = _i18; \
+ values.i19.TYPE[0] = _i19; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, _i18, _i19); \
+ \
+ clear_struct_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, _i18, _i19);
+
+void
+test_m512_on_stack ()
+{
+ __m512 x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m512){32+i, 0, 0, 0, 0, 0, 0, 0};
+ pass = "m512-8";
+ def_check_passing8(x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], fun_check_passing_m512_8_values, fun_check_passing_m512_8_regs, _m512);
+}
+
+void
+test_too_many_m512 ()
+{
+ __m512 x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m512){32+i, 0, 0, 0, 0, 0, 0, 0};
+ pass = "m512-20";
+ def_check_passing20(x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16], x[17], x[18], x[19], fun_check_passing_m512_20_values, fun_check_passing_m512_20_regs, _m512);
+}
+
+static void
+avx512f_test (void)
+{
+ test_m512_on_stack ();
+ test_too_many_m512 ();
+ if (failed)
+ abort ();
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_structs.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_structs.c
new file mode 100644
index 000000000..8daa676e7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_structs.c
@@ -0,0 +1,65 @@
+#include "avx512f-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+struct m512_struct
+{
+ __m512 x;
+};
+
+struct m512_2_struct
+{
+ __m512 x1, x2;
+};
+
+/* Check that the struct is passed as the individual members in fregs. */
+void
+check_struct_passing1 (struct m512_struct ms1 ATTRIBUTE_UNUSED,
+ struct m512_struct ms2 ATTRIBUTE_UNUSED,
+ struct m512_struct ms3 ATTRIBUTE_UNUSED,
+ struct m512_struct ms4 ATTRIBUTE_UNUSED,
+ struct m512_struct ms5 ATTRIBUTE_UNUSED,
+ struct m512_struct ms6 ATTRIBUTE_UNUSED,
+ struct m512_struct ms7 ATTRIBUTE_UNUSED,
+ struct m512_struct ms8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_struct_passing2 (struct m512_2_struct ms 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)&ms.x1 == rsp+8);
+ assert ((unsigned long)&ms.x2 == rsp+72);
+}
+
+static void
+avx512f_test (void)
+{
+ struct m512_struct m512s [8];
+ struct m512_2_struct m512_2s = {
+ { 48.394, 39.3, -397.9, 3484.9, -8.394, -93.3, 7.9, 84.94,
+ 48.3941, 39.31, -397.91, 3484.91, -8.3941, -93.31, 7.91, 84.941 },
+ { -8.394, -3.3, -39.9, 34.9, 7.9, 84.94, -48.394, 39.3,
+ -8.3942, -3.32, -39.92, 34.92, 7.92, 84.942, -48.3942, 39.32 }
+ };
+ int i;
+
+ for (i = 0; i < 8; i++)
+ m512s[i].x = (__m512){32+i, 0, i, 0, -i, 0, i - 12, i + 8,
+ 32+i, 0, i, 0, -i, 0, i - 12, i + 8};
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.zmm0)[i]._m512[0] = m512s[i].x;
+ num_fregs = 8;
+ WRAP_CALL (check_struct_passing1)(m512s[0], m512s[1], m512s[2], m512s[3],
+ m512s[4], m512s[5], m512s[6], m512s[7]);
+ WRAP_CALL (check_struct_passing2)(m512_2s);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_unions.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_unions.c
new file mode 100644
index 000000000..370d15b62
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/avx512f/test_passing_unions.c
@@ -0,0 +1,180 @@
+#include "avx512f-check.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+union un1
+{
+ __m512 x;
+ float f;
+};
+
+union un2
+{
+ __m512 x;
+ double d;
+};
+
+union un3
+{
+ __m512 x;
+ __m128 v;
+};
+
+union un4
+{
+ __m512 x;
+ long double ld;
+};
+
+union un5
+{
+ __m512 x;
+ int i;
+};
+
+union un6
+{
+ __m512 x;
+ __m256 v;
+};
+
+
+void
+check_union_passing1(union un1 u1 ATTRIBUTE_UNUSED,
+ union un1 u2 ATTRIBUTE_UNUSED,
+ union un1 u3 ATTRIBUTE_UNUSED,
+ union un1 u4 ATTRIBUTE_UNUSED,
+ union un1 u5 ATTRIBUTE_UNUSED,
+ union un1 u6 ATTRIBUTE_UNUSED,
+ union un1 u7 ATTRIBUTE_UNUSED,
+ union un1 u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing2(union un2 u1 ATTRIBUTE_UNUSED,
+ union un2 u2 ATTRIBUTE_UNUSED,
+ union un2 u3 ATTRIBUTE_UNUSED,
+ union un2 u4 ATTRIBUTE_UNUSED,
+ union un2 u5 ATTRIBUTE_UNUSED,
+ union un2 u6 ATTRIBUTE_UNUSED,
+ union un2 u7 ATTRIBUTE_UNUSED,
+ union un2 u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing3(union un3 u1 ATTRIBUTE_UNUSED,
+ union un3 u2 ATTRIBUTE_UNUSED,
+ union un3 u3 ATTRIBUTE_UNUSED,
+ union un3 u4 ATTRIBUTE_UNUSED,
+ union un3 u5 ATTRIBUTE_UNUSED,
+ union un3 u6 ATTRIBUTE_UNUSED,
+ union un3 u7 ATTRIBUTE_UNUSED,
+ union un3 u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+void
+check_union_passing4(union un4 u 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)&u.x == rsp+8);
+ assert ((unsigned long)&u.ld == rsp+8);
+}
+
+void
+check_union_passing5(union un5 u 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)&u.x == rsp+8);
+ assert ((unsigned long)&u.i == rsp+8);
+}
+
+void
+check_union_passing6(union un6 u1 ATTRIBUTE_UNUSED,
+ union un6 u2 ATTRIBUTE_UNUSED,
+ union un6 u3 ATTRIBUTE_UNUSED,
+ union un6 u4 ATTRIBUTE_UNUSED,
+ union un6 u5 ATTRIBUTE_UNUSED,
+ union un6 u6 ATTRIBUTE_UNUSED,
+ union un6 u7 ATTRIBUTE_UNUSED,
+ union un6 u8 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m512_arguments;
+}
+
+#define check_union_passing1 WRAP_CALL(check_union_passing1)
+#define check_union_passing2 WRAP_CALL(check_union_passing2)
+#define check_union_passing3 WRAP_CALL(check_union_passing3)
+#define check_union_passing4 WRAP_CALL(check_union_passing4)
+#define check_union_passing5 WRAP_CALL(check_union_passing5)
+#define check_union_passing6 WRAP_CALL(check_union_passing6)
+
+static void
+avx512f_test (void)
+{
+ union un1 u1[8];
+ union un2 u2[8];
+ union un3 u3[8];
+ union un4 u4;
+ union un5 u5;
+ union un6 u6[8];
+ int i;
+
+ for (i = 0; i < 8; i++)
+ u1[i].x = (__m512){32+i, 0, i, 0, -i, 0, i - 12, i + 8,
+ 32+i, 0, i, 0, -i, 0, i - 12, i + 8};
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ (&fregs.zmm0)[i]._m512[0] = u1[i].x;
+ num_fregs = 8;
+ check_union_passing1(u1[0], u1[1], u1[2], u1[3],
+ u1[4], u1[5], u1[6], u1[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u2[i].x = u1[i].x;
+ (&fregs.zmm0)[i]._m512[0] = u2[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing2(u2[0], u2[1], u2[2], u2[3],
+ u2[4], u2[5], u2[6], u2[7]);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u3[i].x = u1[i].x;
+ (&fregs.zmm0)[i]._m512[0] = u3[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing3(u3[0], u3[1], u3[2], u3[3],
+ u3[4], u3[5], u3[6], u3[7]);
+
+ check_union_passing4(u4);
+ check_union_passing5(u5);
+
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u6[i].x = u1[i].x;
+ (&fregs.zmm0)[i]._m512[0] = u6[i].x;
+ }
+ num_fregs = 8;
+ check_union_passing6(u6[0], u6[1], u6[2], u6[3],
+ u6[4], u6[5], u6[6], u6[7]);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp
new file mode 100644
index 000000000..930942b04
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.exp
@@ -0,0 +1,36 @@
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+if { (![istarget x86_64-*-*] && ![istarget i?86-*-*])
+ || [is-effective-target ilp32] } then {
+ return
+}
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+dg-init
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+dg-finish
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.h b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.h
new file mode 100644
index 000000000..d008ad659
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/callabi.h
@@ -0,0 +1,50 @@
+/* First the default target definition. */
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST
+ typedef __builtin_va_list __gnuc_va_list;
+#endif
+
+#ifndef _VA_LIST_DEFINED
+#define _VA_LIST_DEFINED
+ typedef __gnuc_va_list va_list;
+#endif
+
+#define __va_copy(d,s) __builtin_va_copy(d,s)
+#define __va_start(v,l) __builtin_va_start(v,l)
+#define __va_arg(v,l) __builtin_va_arg(v,l)
+#define __va_end(v) __builtin_va_end(v)
+
+#define __ms_va_copy(d,s) __builtin_ms_va_copy(d,s)
+#define __ms_va_start(v,l) __builtin_ms_va_start(v,l)
+#define __ms_va_arg(v,l) __builtin_va_arg(v,l)
+#define __ms_va_end(v) __builtin_ms_va_end(v)
+
+#define __sysv_va_copy(d,s) __builtin_sysv_va_copy(d,s)
+#define __sysv_va_start(v,l) __builtin_sysv_va_start(v,l)
+#define __sysv_va_arg(v,l) __builtin_va_arg(v,l)
+#define __sysv_va_end(v) __builtin_sysv_va_end(v)
+
+#define CALLABI_NATIVE
+
+#ifdef _WIN64
+#define CALLABI_CROSS __attribute__ ((sysv_abi))
+
+#define CROSS_VA_LIST __builtin_sysv_va_list
+
+#define CROSS_VA_COPY(d,s) __sysv_va_copy(d,s)
+#define CROSS_VA_START(v,l) __sysv_va_start(v,l)
+#define CROSS_VA_ARG(v,l) __sysv_va_arg(v,l)
+#define CROSS_VA_END(v) __sysv_va_end(v)
+
+#else
+
+#define CALLABI_CROSS __attribute__ ((ms_abi))
+
+#define CROSS_VA_LIST __builtin_ms_va_list
+
+#define CROSS_VA_COPY(d,s) __ms_va_copy(d,s)
+#define CROSS_VA_START(v,l) __ms_va_start(v,l)
+#define CROSS_VA_ARG(v,l) __ms_va_arg(v,l)
+#define CROSS_VA_END(v) __ms_va_end(v)
+
+#endif \ No newline at end of file
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c
new file mode 100644
index 000000000..7d0b50636
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-1.c
@@ -0,0 +1,40 @@
+/* Test for cross x86_64<->w64 abi standard calls.
+*/
+/* Origin: Kai Tietz <kai.tietz@onevision.com> */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99 -ffast-math" } */
+#include "callabi.h"
+
+extern void abort (void);
+
+long double
+CALLABI_CROSS func_cross (long double a, double b, float c, long d, int e,
+ char f)
+{
+ long double ret;
+ ret = a + (long double) b + (long double) c;
+ ret *= (long double) (d + (long) e);
+ if (f>0)
+ ret += func_cross (a,b,c,d,e,-f);
+ return ret;
+}
+
+long double
+CALLABI_NATIVE func_native (long double a, double b, float c, long d, int e,
+ char f)
+{
+ long double ret;
+ ret = a + (long double) b + (long double) c;
+ ret *= (long double) (d + (long) e);
+ if (f>0)
+ ret += func_native (a,b,c,d,e,-f);
+ return ret;
+}
+
+int main ()
+{
+ if (func_cross (1.0,2.0,3.0,1,2,3)
+ != func_native (1.0,2.0,3.0,1,2,3))
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2a.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2a.c
new file mode 100644
index 000000000..513f5619a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2a.c
@@ -0,0 +1,27 @@
+/* Test for cross x86_64<->w64 abi standard calls. */
+/* { dg-do run } */
+/* { dg-options "-O2 -mabi=ms -std=gnu99 -ffast-math -fno-builtin" } */
+/* { dg-additional-sources "func-2b.c" } */
+
+extern void __attribute__ ((sysv_abi)) abort (void);
+long double func_cross (long double, double, float, long, int, char);
+
+long double __attribute__ ((sysv_abi))
+func_native (long double a, double b, float c, long d, int e, char f)
+{
+ long double ret;
+ ret = a + (long double) b + (long double) c;
+ ret *= (long double) (d + (long) e);
+ if (f>0)
+ ret += func_native (a,b,c,d,e,-f);
+ return ret;
+}
+
+int __attribute__ ((sysv_abi))
+main ()
+{
+ if (func_cross (1.0,2.0,3.0,1,2,3)
+ != func_native (1.0,2.0,3.0,1,2,3))
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2b.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2b.c
new file mode 100644
index 000000000..fe85dd186
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-2b.c
@@ -0,0 +1,13 @@
+/* Test for cross x86_64<->w64 abi standard calls. */
+/* { dg-options "-mabi=ms -std=gnu99 -ffast-math -fno-builtin" } */
+
+long double func_cross (long double a, double b, float c, long d, int e,
+ char f)
+{
+ long double ret;
+ ret = a + (long double) b + (long double) c;
+ ret *= (long double) (d + (long) e);
+ if (f>0)
+ ret += func_cross (a,b,c,d,e,-f);
+ return ret;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2a.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2a.c
new file mode 100644
index 000000000..e1ff8f833
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2a.c
@@ -0,0 +1,17 @@
+/* Test for cross x86_64<->w64 abi standard calls via variable. */
+/* { dg-do run } */
+/* { dg-options "-O2 -mabi=ms -std=gnu99 -ffast-math -fno-builtin" } */
+/* { dg-additional-sources "func-indirect-2b.c" } */
+
+extern void __attribute__ ((sysv_abi)) abort (void);
+typedef int (*func)(void *, char *, char *, short, long long);
+extern func get_callback (void);
+
+int __attribute__ ((sysv_abi))
+main ()
+{
+ func callme = get_callback ();
+ if (callme (0, 0, 0, 0x1234, 0x1234567890abcdefLL))
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2b.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2b.c
new file mode 100644
index 000000000..1a9fccd97
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect-2b.c
@@ -0,0 +1,24 @@
+/* Test for cross x86_64<->w64 abi standard calls via variable. */
+/* { dg-options "-O2 -mabi=ms -std=gnu99 -ffast-math -fno-builtin" } */
+
+typedef int (*func)(void *, char *, char *, short, long long);
+
+static int
+callback (void *ptr, char *string1, char *string2, short number,
+ long long rand)
+{
+ if (ptr != 0
+ || string1 != 0
+ || string2 != 0
+ || number != 0x1234
+ || rand != 0x1234567890abcdefLL)
+ return 1;
+ else
+ return 0;
+}
+
+func
+get_callback (void)
+{
+ return callback;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c
new file mode 100644
index 000000000..0c0cbb271
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/func-indirect.c
@@ -0,0 +1,24 @@
+/* Test for cross x86_64<->w64 abi standard calls via variable.
+*/
+/* Origin: Kai Tietz <kai.tietz@onevision.com> */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99 -ffast-math" } */
+#include "callabi.h"
+
+extern void abort (void);
+
+typedef int (CALLABI_CROSS *func)(void *, char *, char *, short, long long);
+
+int CALLABI_CROSS
+callback(void * ptr, char *string1, char *string2, short number, long long rand)
+{
+ return (rand != 0x1234567890abcdefLL);
+}
+
+int main()
+{
+ volatile func callme = callback;
+ if(callme(0, 0, 0, 0, 0x1234567890abcdefLL))
+ abort();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-1.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-1.c
new file mode 100644
index 000000000..35f8b53ca
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mabi=sysv" } */
+
+__attribute__ ((ms_abi))
+int foo (void)
+{
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "%rsp" } } */
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-2.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-2.c
new file mode 100644
index 000000000..2a54bc89c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/leaf-2.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mabi=sysv" } */
+
+extern int glb1, gbl2, gbl3;
+
+__attribute__ ((ms_abi))
+int foo (void)
+{
+ int r = 1;
+ int i, j, k;
+ for (i = 0; i < glb1; i++)
+ {
+ r *= (i + 1);
+ for (j = gbl2; j > 0; --j)
+ {
+ for (k = 0; k < gbl3; k++)
+ r += (i + k * j);
+ }
+ }
+
+ return r;
+}
+
+/* { dg-final { scan-assembler-not "%rsp" } } */
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c
new file mode 100644
index 000000000..d31b8c377
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/pr38891.c
@@ -0,0 +1,10 @@
+/* Test for cross x86_64<->w64 abi standard calls.
+*/
+/* { dg-do compile } */
+/* { dg-options "-mno-sse" } */
+#include "callabi.h"
+
+long double
+CALLABI_CROSS func_cross ()
+{
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c
new file mode 100644
index 000000000..a6d8463ed
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-1.c
@@ -0,0 +1,47 @@
+/* Test for cross x86_64<->w64 abi va_list calls.
+*/
+/* Origin: Kai Tietz <kai.tietz@onevision.com> */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+#include "callabi.h"
+
+extern __SIZE_TYPE__ strlen (const char *);
+extern int sprintf (char *,const char *, ...);
+extern void abort (void);
+
+static
+void CALLABI_CROSS vdo_cpy (char *s, CROSS_VA_LIST argp)
+{
+ __SIZE_TYPE__ len;
+ char *r = s;
+ char *e;
+ *r = 0;
+ for (;;) {
+ e = CROSS_VA_ARG (argp,char *);
+ if (*e == 0) break;
+ sprintf (r,"%s", e);
+ r += strlen (r);
+ }
+}
+
+static
+void CALLABI_CROSS do_cpy (char *s, ...)
+{
+ CROSS_VA_LIST argp;
+ CROSS_VA_START (argp, s);
+ vdo_cpy (s, argp);
+ CROSS_VA_END (argp);
+}
+
+int main ()
+{
+ char s[256];
+
+ do_cpy (s, "1","2","3","4", "5", "6", "7", "");
+
+ if (s[0] != '1' || s[1] !='2' || s[2] != '3' || s[3] != '4'
+ || s[4] != '5' || s[5] != '6' || s[6] != '7' || s[7] != 0)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c
new file mode 100644
index 000000000..e281e860f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-2.c
@@ -0,0 +1,47 @@
+/* Test for cross x86_64<->w64 abi va_list calls.
+*/
+/* Origin: Kai Tietz <kai.tietz@onevision.com> */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+#include "callabi.h"
+
+extern void abort (void);
+
+#define SZ_ARGS 1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll
+
+static
+int CALLABI_CROSS fct1 (va_list argp, ...)
+{
+ long long p1,p2;
+ int ret = 1;
+ CROSS_VA_LIST argp_2;
+ CROSS_VA_START (argp_2,argp);
+
+ do {
+ p1 = CROSS_VA_ARG (argp_2, long long);
+ p2 = __va_arg (argp, long long);
+ if (p1 != p2)
+ ret = 0;
+ } while (ret && p1 != 0);
+ CROSS_VA_END (argp_2);
+ return ret;
+}
+
+static
+int fct2 (int dummy, ...)
+{
+ va_list argp;
+ int ret = dummy;
+
+ __va_start (argp, dummy);
+ ret += fct1 (argp, SZ_ARGS);
+ __va_end (argp);
+ return ret;
+}
+
+int main()
+{
+ if (fct2 (-1, SZ_ARGS) != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c
new file mode 100644
index 000000000..7cca7ac87
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-3.c
@@ -0,0 +1,47 @@
+/* Test for cross x86_64<->w64 abi va_list calls.
+*/
+/* Origin: Kai Tietz <kai.tietz@onevision.com> */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+#include "callabi.h"
+
+extern void abort (void);
+
+#define SZ_ARGS 1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll
+
+static
+int fct1 (CROSS_VA_LIST argp, ...)
+{
+ long long p1,p2;
+ int ret = 1;
+ va_list argp_2;
+
+ __va_start (argp_2,argp);
+ do {
+ p1 = __va_arg (argp_2, long long);
+ p2 = CROSS_VA_ARG (argp, long long);
+ if (p1 != p2)
+ ret = 0;
+ } while (ret && p1 != 0);
+ __va_end (argp_2);
+ return ret;
+}
+
+static
+int CALLABI_CROSS fct2 (int dummy, ...)
+{
+ CROSS_VA_LIST argp;
+ int ret = dummy;
+
+ CROSS_VA_START (argp, dummy);
+ ret += fct1 (argp, SZ_ARGS);
+ CROSS_VA_END (argp);
+ return ret;
+}
+
+int main()
+{
+ if (fct2 (-1, SZ_ARGS) != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4a.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4a.c
new file mode 100644
index 000000000..36bd3483f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4a.c
@@ -0,0 +1,24 @@
+/* Test for cross x86_64<->w64 abi va_list calls. */
+/* { dg-do run } */
+/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */
+/* { dg-additional-sources "vaarg-4b.c" } */
+
+extern __SIZE_TYPE__ __attribute__ ((sysv_abi)) strlen (const char *);
+extern int __attribute__ ((sysv_abi)) sprintf (char *,const char *, ...);
+extern void __attribute__ ((sysv_abi)) abort (void);
+
+extern void do_cpy (char *, ...);
+
+int __attribute__ ((sysv_abi))
+main ()
+{
+ char s[256];
+
+ do_cpy (s, "1","2","3","4", "5", "6", "7", "");
+
+ if (s[0] != '1' || s[1] !='2' || s[2] != '3' || s[3] != '4'
+ || s[4] != '5' || s[5] != '6' || s[6] != '7' || s[7] != 0)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4b.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4b.c
new file mode 100644
index 000000000..f33906bd2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-4b.c
@@ -0,0 +1,31 @@
+/* Test for cross x86_64<->w64 abi va_list calls. */
+/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */
+
+#include <stdarg.h>
+
+extern __SIZE_TYPE__ __attribute__ ((sysv_abi)) strlen (const char *);
+extern int __attribute__ ((sysv_abi)) sprintf (char *, const char *, ...);
+
+static void
+vdo_cpy (char *s, va_list argp)
+{
+ __SIZE_TYPE__ len;
+ char *r = s;
+ char *e;
+ *r = 0;
+ for (;;) {
+ e = va_arg (argp, char *);
+ if (*e == 0) break;
+ sprintf (r,"%s", e);
+ r += strlen (r);
+ }
+}
+
+void
+do_cpy (char *s, ...)
+{
+ va_list argp;
+ va_start (argp, s);
+ vdo_cpy (s, argp);
+ va_end (argp);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5a.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5a.c
new file mode 100644
index 000000000..fa8567779
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5a.c
@@ -0,0 +1,17 @@
+/* Test for cross x86_64<->w64 abi va_list calls. */
+/* { dg-do run } */
+/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */
+/* { dg-additional-sources "vaarg-5b.c" } */
+
+extern void __attribute__ ((sysv_abi)) abort (void);
+extern int fct2 (int, ...);
+
+#define SZ_ARGS 1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll
+
+int __attribute__ ((sysv_abi))
+main()
+{
+ if (fct2 (-1, SZ_ARGS) != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5b.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5b.c
new file mode 100644
index 000000000..e5dd4727b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/callabi/vaarg-5b.c
@@ -0,0 +1,37 @@
+/* Test for cross x86_64<->w64 abi va_list calls. */
+/* { dg-options "-O2 -mabi=ms -std=gnu99 -fno-builtin" } */
+
+#include <stdarg.h>
+
+#define SZ_ARGS 1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll
+
+static int __attribute__ ((sysv_abi))
+fct1 (va_list argp, ...)
+{
+ long long p1,p2;
+ int ret = 1;
+ __builtin_sysv_va_list argp_2;
+
+ __builtin_sysv_va_start (argp_2, argp);
+ do {
+ p1 = va_arg (argp_2, long long);
+ p2 = va_arg (argp, long long);
+ if (p1 != p2)
+ ret = 0;
+ } while (ret && p1 != 0);
+ __builtin_sysv_va_end (argp_2);
+
+ return ret;
+}
+
+int
+fct2 (int dummy, ...)
+{
+ va_list argp;
+ int ret = dummy;
+
+ va_start (argp, dummy);
+ ret += fct1 (argp, SZ_ARGS);
+ va_end (argp);
+ return ret;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/defines.h b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/defines.h
new file mode 100644
index 000000000..a32daf694
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/defines.h
@@ -0,0 +1,148 @@
+#ifndef DEFINED_DEFINES_H
+#define DEFINED_DEFINES_H
+
+/* Get __m64 and __m128. */
+#include <xmmintrin.h>
+
+typedef unsigned long ulong;
+typedef long double ldouble;
+
+/* These defines determines what part of the test should be run. When
+ GCC implements these parts, the defines should be uncommented to
+ enable testing. */
+
+/* Scalar type __int128. */
+/* #define CHECK_INT128 */
+
+/* Scalar type long double. */
+#define CHECK_LONG_DOUBLE
+
+/* Scalar type __float128. */
+/* #define CHECK_FLOAT128 */
+
+/* Scalar types __m64 and __m128. */
+#define CHECK_M64_M128
+
+/* Returning of complex type. */
+#define CHECK_COMPLEX
+
+/* Structs with size >= 16. */
+#define CHECK_LARGER_STRUCTS
+
+/* Checks for passing floats and doubles. */
+#define CHECK_FLOAT_DOUBLE_PASSING
+
+/* Union passing with not-extremely-simple unions. */
+#define CHECK_LARGER_UNION_PASSING
+
+/* Variable args. */
+#define CHECK_VARARGS
+
+/* Check argument passing and returning for scalar types with sizeof = 16. */
+/* TODO: Implement these tests. Don't activate them for now. */
+#define CHECK_LARGE_SCALAR_PASSING
+
+/* Defines for sizing and alignment. */
+
+#define TYPE_SIZE_CHAR 1
+#define TYPE_SIZE_SHORT 2
+#define TYPE_SIZE_INT 4
+#define TYPE_SIZE_LONG 8
+#define TYPE_SIZE_LONG_LONG 8
+#define TYPE_SIZE_INT128 16
+#define TYPE_SIZE_FLOAT 4
+#define TYPE_SIZE_DOUBLE 8
+#define TYPE_SIZE_LONG_DOUBLE 16
+#define TYPE_SIZE_FLOAT128 16
+#define TYPE_SIZE_M64 8
+#define TYPE_SIZE_M128 16
+#define TYPE_SIZE_ENUM 4
+#define TYPE_SIZE_POINTER 8
+
+#define TYPE_ALIGN_CHAR 1
+#define TYPE_ALIGN_SHORT 2
+#define TYPE_ALIGN_INT 4
+#define TYPE_ALIGN_LONG 8
+#define TYPE_ALIGN_LONG_LONG 8
+#define TYPE_ALIGN_INT128 16
+#define TYPE_ALIGN_FLOAT 4
+#define TYPE_ALIGN_DOUBLE 8
+#define TYPE_ALIGN_LONG_DOUBLE 16
+#define TYPE_ALIGN_FLOAT128 16
+#define TYPE_ALIGN_M64 8
+#define TYPE_ALIGN_M128 16
+#define TYPE_ALIGN_ENUM 4
+#define TYPE_ALIGN_POINTER 8
+
+/* These defines control the building of the list of types to check. There
+ is a string identifying the type (with a comma after), a size of the type
+ (also with a comma and an integer for adding to the total amount of types)
+ and an alignment of the type (which is currently not really needed since
+ the abi specifies that alignof == sizeof for all scalar types). */
+#ifdef CHECK_INT128
+#define CI128_STR "__int128",
+#define CI128_SIZ TYPE_SIZE_INT128,
+#define CI128_ALI TYPE_ALIGN_INT128,
+#define CI128_RET "???",
+#else
+#define CI128_STR
+#define CI128_SIZ
+#define CI128_ALI
+#define CI128_RET
+#endif
+#ifdef CHECK_LONG_DOUBLE
+#define CLD_STR "long double",
+#define CLD_SIZ TYPE_SIZE_LONG_DOUBLE,
+#define CLD_ALI TYPE_ALIGN_LONG_DOUBLE,
+#define CLD_RET "x87_regs[0]._ldouble",
+#else
+#define CLD_STR
+#define CLD_SIZ
+#define CLD_ALI
+#define CLD_RET
+#endif
+#ifdef CHECK_FLOAT128
+#define CF128_STR "__float128",
+#define CF128_SIZ TYPE_SIZE_FLOAT128,
+#define CF128_ALI TYPE_ALIGN_FLOAT128,
+#define CF128_RET "???",
+#else
+#define CF128_STR
+#define CF128_SIZ
+#define CF128_ALI
+#define CF128_RET
+#endif
+#ifdef CHECK_M64_M128
+#define CMM_STR "__m64", "__m128",
+#define CMM_SIZ TYPE_SIZE_M64, TYPE_SIZE_M128,
+#define CMM_ALI TYPE_ALIGN_M64, TYPE_ALIGN_M128,
+#define CMM_RET "???", "???",
+#else
+#define CMM_STR
+#define CMM_SIZ
+#define CMM_ALI
+#define CMM_RET
+#endif
+
+/* Used in size and alignment tests. */
+enum dummytype { enumtype };
+
+extern void abort (void);
+
+/* Assertion macro. */
+#define assert(test) if (!(test)) abort()
+
+#ifdef __GNUC__
+#define ATTRIBUTE_UNUSED __attribute__((__unused__))
+#else
+#define ATTRIBUTE_UNUSED
+#endif
+
+#ifdef __GNUC__
+#define PACKED __attribute__((__packed__))
+#else
+#warning Some tests will fail due to missing __packed__ support
+#define PACKED
+#endif
+
+#endif /* DEFINED_DEFINES_H */
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/macros.h b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/macros.h
new file mode 100644
index 000000000..98fbc660f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/macros.h
@@ -0,0 +1,53 @@
+#ifndef MACROS_H
+
+#define check_size(_t, _size) assert(sizeof(_t) == (_size))
+
+#define check_align(_t, _align) assert(__alignof__(_t) == (_align))
+
+#define check_align_lv(_t, _align) assert(__alignof__(_t) == (_align) \
+ && (((unsigned long)&(_t)) & ((_align) - 1) ) == 0)
+
+#define check_basic_struct_size_and_align(_type, _size, _align) { \
+ struct _str { _type dummy; } _t; \
+ check_size(_t, _size); \
+ check_align_lv(_t, _align); \
+}
+
+#define check_array_size_and_align(_type, _size, _align) { \
+ _type _a[1]; _type _b[2]; _type _c[16]; \
+ struct _str { _type _a[1]; } _s; \
+ check_align_lv(_a[0], _align); \
+ check_size(_a, _size); \
+ check_size(_b, (_size*2)); \
+ check_size(_c, (_size*16)); \
+ check_size(_s, _size); \
+ check_align_lv(_s._a[0], _align); \
+}
+
+#define check_basic_union_size_and_align(_type, _size, _align) { \
+ union _union { _type dummy; } _u; \
+ check_size(_u, _size); \
+ check_align_lv(_u, _align); \
+}
+
+#define run_signed_tests2(_function, _arg1, _arg2) \
+ _function(_arg1, _arg2); \
+ _function(signed _arg1, _arg2); \
+ _function(unsigned _arg1, _arg2);
+
+#define run_signed_tests3(_function, _arg1, _arg2, _arg3) \
+ _function(_arg1, _arg2, _arg3); \
+ _function(signed _arg1, _arg2, _arg3); \
+ _function(unsigned _arg1, _arg2, _arg3);
+
+/* Check size of a struct and a union of three types. */
+
+#define check_struct_and_union3(type1, type2, type3, struct_size, align_size) \
+{ \
+ struct _str { type1 t1; type2 t2; type3 t3; } _t; \
+ union _uni { type1 t1; type2 t2; type3 t3; } _u; \
+ check_size(_t, struct_size); \
+ check_size(_u, align_size); \
+}
+
+#endif // MACROS_H
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_3_element_struct_and_unions.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_3_element_struct_and_unions.c
new file mode 100644
index 000000000..5227c6087
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_3_element_struct_and_unions.c
@@ -0,0 +1,523 @@
+/* This is an autogenerated file. Do not edit. */
+
+#include "defines.h"
+#include "macros.h"
+
+/* Check structs and unions of all permutations of 3 basic types. */
+int
+main (void)
+{
+ check_struct_and_union3(char, char, char, 3, 1);
+ check_struct_and_union3(char, char, short, 4, 2);
+ check_struct_and_union3(char, char, int, 8, 4);
+ check_struct_and_union3(char, char, long, 16, 8);
+ check_struct_and_union3(char, char, long long, 16, 8);
+ check_struct_and_union3(char, char, float, 8, 4);
+ check_struct_and_union3(char, char, double, 16, 8);
+ check_struct_and_union3(char, char, long double, 32, 16);
+ check_struct_and_union3(char, short, char, 6, 2);
+ check_struct_and_union3(char, short, short, 6, 2);
+ check_struct_and_union3(char, short, int, 8, 4);
+ check_struct_and_union3(char, short, long, 16, 8);
+ check_struct_and_union3(char, short, long long, 16, 8);
+ check_struct_and_union3(char, short, float, 8, 4);
+ check_struct_and_union3(char, short, double, 16, 8);
+ check_struct_and_union3(char, short, long double, 32, 16);
+ check_struct_and_union3(char, int, char, 12, 4);
+ check_struct_and_union3(char, int, short, 12, 4);
+ check_struct_and_union3(char, int, int, 12, 4);
+ check_struct_and_union3(char, int, long, 16, 8);
+ check_struct_and_union3(char, int, long long, 16, 8);
+ check_struct_and_union3(char, int, float, 12, 4);
+ check_struct_and_union3(char, int, double, 16, 8);
+ check_struct_and_union3(char, int, long double, 32, 16);
+ check_struct_and_union3(char, long, char, 24, 8);
+ check_struct_and_union3(char, long, short, 24, 8);
+ check_struct_and_union3(char, long, int, 24, 8);
+ check_struct_and_union3(char, long, long, 24, 8);
+ check_struct_and_union3(char, long, long long, 24, 8);
+ check_struct_and_union3(char, long, float, 24, 8);
+ check_struct_and_union3(char, long, double, 24, 8);
+ check_struct_and_union3(char, long, long double, 32, 16);
+ check_struct_and_union3(char, long long, char, 24, 8);
+ check_struct_and_union3(char, long long, short, 24, 8);
+ check_struct_and_union3(char, long long, int, 24, 8);
+ check_struct_and_union3(char, long long, long, 24, 8);
+ check_struct_and_union3(char, long long, long long, 24, 8);
+ check_struct_and_union3(char, long long, float, 24, 8);
+ check_struct_and_union3(char, long long, double, 24, 8);
+ check_struct_and_union3(char, long long, long double, 32, 16);
+ check_struct_and_union3(char, float, char, 12, 4);
+ check_struct_and_union3(char, float, short, 12, 4);
+ check_struct_and_union3(char, float, int, 12, 4);
+ check_struct_and_union3(char, float, long, 16, 8);
+ check_struct_and_union3(char, float, long long, 16, 8);
+ check_struct_and_union3(char, float, float, 12, 4);
+ check_struct_and_union3(char, float, double, 16, 8);
+ check_struct_and_union3(char, float, long double, 32, 16);
+ check_struct_and_union3(char, double, char, 24, 8);
+ check_struct_and_union3(char, double, short, 24, 8);
+ check_struct_and_union3(char, double, int, 24, 8);
+ check_struct_and_union3(char, double, long, 24, 8);
+ check_struct_and_union3(char, double, long long, 24, 8);
+ check_struct_and_union3(char, double, float, 24, 8);
+ check_struct_and_union3(char, double, double, 24, 8);
+ check_struct_and_union3(char, double, long double, 32, 16);
+ check_struct_and_union3(char, long double, char, 48, 16);
+ check_struct_and_union3(char, long double, short, 48, 16);
+ check_struct_and_union3(char, long double, int, 48, 16);
+ check_struct_and_union3(char, long double, long, 48, 16);
+ check_struct_and_union3(char, long double, long long, 48, 16);
+ check_struct_and_union3(char, long double, float, 48, 16);
+ check_struct_and_union3(char, long double, double, 48, 16);
+ check_struct_and_union3(char, long double, long double, 48, 16);
+ check_struct_and_union3(short, char, char, 4, 2);
+ check_struct_and_union3(short, char, short, 6, 2);
+ check_struct_and_union3(short, char, int, 8, 4);
+ check_struct_and_union3(short, char, long, 16, 8);
+ check_struct_and_union3(short, char, long long, 16, 8);
+ check_struct_and_union3(short, char, float, 8, 4);
+ check_struct_and_union3(short, char, double, 16, 8);
+ check_struct_and_union3(short, char, long double, 32, 16);
+ check_struct_and_union3(short, short, char, 6, 2);
+ check_struct_and_union3(short, short, short, 6, 2);
+ check_struct_and_union3(short, short, int, 8, 4);
+ check_struct_and_union3(short, short, long, 16, 8);
+ check_struct_and_union3(short, short, long long, 16, 8);
+ check_struct_and_union3(short, short, float, 8, 4);
+ check_struct_and_union3(short, short, double, 16, 8);
+ check_struct_and_union3(short, short, long double, 32, 16);
+ check_struct_and_union3(short, int, char, 12, 4);
+ check_struct_and_union3(short, int, short, 12, 4);
+ check_struct_and_union3(short, int, int, 12, 4);
+ check_struct_and_union3(short, int, long, 16, 8);
+ check_struct_and_union3(short, int, long long, 16, 8);
+ check_struct_and_union3(short, int, float, 12, 4);
+ check_struct_and_union3(short, int, double, 16, 8);
+ check_struct_and_union3(short, int, long double, 32, 16);
+ check_struct_and_union3(short, long, char, 24, 8);
+ check_struct_and_union3(short, long, short, 24, 8);
+ check_struct_and_union3(short, long, int, 24, 8);
+ check_struct_and_union3(short, long, long, 24, 8);
+ check_struct_and_union3(short, long, long long, 24, 8);
+ check_struct_and_union3(short, long, float, 24, 8);
+ check_struct_and_union3(short, long, double, 24, 8);
+ check_struct_and_union3(short, long, long double, 32, 16);
+ check_struct_and_union3(short, long long, char, 24, 8);
+ check_struct_and_union3(short, long long, short, 24, 8);
+ check_struct_and_union3(short, long long, int, 24, 8);
+ check_struct_and_union3(short, long long, long, 24, 8);
+ check_struct_and_union3(short, long long, long long, 24, 8);
+ check_struct_and_union3(short, long long, float, 24, 8);
+ check_struct_and_union3(short, long long, double, 24, 8);
+ check_struct_and_union3(short, long long, long double, 32, 16);
+ check_struct_and_union3(short, float, char, 12, 4);
+ check_struct_and_union3(short, float, short, 12, 4);
+ check_struct_and_union3(short, float, int, 12, 4);
+ check_struct_and_union3(short, float, long, 16, 8);
+ check_struct_and_union3(short, float, long long, 16, 8);
+ check_struct_and_union3(short, float, float, 12, 4);
+ check_struct_and_union3(short, float, double, 16, 8);
+ check_struct_and_union3(short, float, long double, 32, 16);
+ check_struct_and_union3(short, double, char, 24, 8);
+ check_struct_and_union3(short, double, short, 24, 8);
+ check_struct_and_union3(short, double, int, 24, 8);
+ check_struct_and_union3(short, double, long, 24, 8);
+ check_struct_and_union3(short, double, long long, 24, 8);
+ check_struct_and_union3(short, double, float, 24, 8);
+ check_struct_and_union3(short, double, double, 24, 8);
+ check_struct_and_union3(short, double, long double, 32, 16);
+ check_struct_and_union3(short, long double, char, 48, 16);
+ check_struct_and_union3(short, long double, short, 48, 16);
+ check_struct_and_union3(short, long double, int, 48, 16);
+ check_struct_and_union3(short, long double, long, 48, 16);
+ check_struct_and_union3(short, long double, long long, 48, 16);
+ check_struct_and_union3(short, long double, float, 48, 16);
+ check_struct_and_union3(short, long double, double, 48, 16);
+ check_struct_and_union3(short, long double, long double, 48, 16);
+ check_struct_and_union3(int, char, char, 8, 4);
+ check_struct_and_union3(int, char, short, 8, 4);
+ check_struct_and_union3(int, char, int, 12, 4);
+ check_struct_and_union3(int, char, long, 16, 8);
+ check_struct_and_union3(int, char, long long, 16, 8);
+ check_struct_and_union3(int, char, float, 12, 4);
+ check_struct_and_union3(int, char, double, 16, 8);
+ check_struct_and_union3(int, char, long double, 32, 16);
+ check_struct_and_union3(int, short, char, 8, 4);
+ check_struct_and_union3(int, short, short, 8, 4);
+ check_struct_and_union3(int, short, int, 12, 4);
+ check_struct_and_union3(int, short, long, 16, 8);
+ check_struct_and_union3(int, short, long long, 16, 8);
+ check_struct_and_union3(int, short, float, 12, 4);
+ check_struct_and_union3(int, short, double, 16, 8);
+ check_struct_and_union3(int, short, long double, 32, 16);
+ check_struct_and_union3(int, int, char, 12, 4);
+ check_struct_and_union3(int, int, short, 12, 4);
+ check_struct_and_union3(int, int, int, 12, 4);
+ check_struct_and_union3(int, int, long, 16, 8);
+ check_struct_and_union3(int, int, long long, 16, 8);
+ check_struct_and_union3(int, int, float, 12, 4);
+ check_struct_and_union3(int, int, double, 16, 8);
+ check_struct_and_union3(int, int, long double, 32, 16);
+ check_struct_and_union3(int, long, char, 24, 8);
+ check_struct_and_union3(int, long, short, 24, 8);
+ check_struct_and_union3(int, long, int, 24, 8);
+ check_struct_and_union3(int, long, long, 24, 8);
+ check_struct_and_union3(int, long, long long, 24, 8);
+ check_struct_and_union3(int, long, float, 24, 8);
+ check_struct_and_union3(int, long, double, 24, 8);
+ check_struct_and_union3(int, long, long double, 32, 16);
+ check_struct_and_union3(int, long long, char, 24, 8);
+ check_struct_and_union3(int, long long, short, 24, 8);
+ check_struct_and_union3(int, long long, int, 24, 8);
+ check_struct_and_union3(int, long long, long, 24, 8);
+ check_struct_and_union3(int, long long, long long, 24, 8);
+ check_struct_and_union3(int, long long, float, 24, 8);
+ check_struct_and_union3(int, long long, double, 24, 8);
+ check_struct_and_union3(int, long long, long double, 32, 16);
+ check_struct_and_union3(int, float, char, 12, 4);
+ check_struct_and_union3(int, float, short, 12, 4);
+ check_struct_and_union3(int, float, int, 12, 4);
+ check_struct_and_union3(int, float, long, 16, 8);
+ check_struct_and_union3(int, float, long long, 16, 8);
+ check_struct_and_union3(int, float, float, 12, 4);
+ check_struct_and_union3(int, float, double, 16, 8);
+ check_struct_and_union3(int, float, long double, 32, 16);
+ check_struct_and_union3(int, double, char, 24, 8);
+ check_struct_and_union3(int, double, short, 24, 8);
+ check_struct_and_union3(int, double, int, 24, 8);
+ check_struct_and_union3(int, double, long, 24, 8);
+ check_struct_and_union3(int, double, long long, 24, 8);
+ check_struct_and_union3(int, double, float, 24, 8);
+ check_struct_and_union3(int, double, double, 24, 8);
+ check_struct_and_union3(int, double, long double, 32, 16);
+ check_struct_and_union3(int, long double, char, 48, 16);
+ check_struct_and_union3(int, long double, short, 48, 16);
+ check_struct_and_union3(int, long double, int, 48, 16);
+ check_struct_and_union3(int, long double, long, 48, 16);
+ check_struct_and_union3(int, long double, long long, 48, 16);
+ check_struct_and_union3(int, long double, float, 48, 16);
+ check_struct_and_union3(int, long double, double, 48, 16);
+ check_struct_and_union3(int, long double, long double, 48, 16);
+ check_struct_and_union3(long, char, char, 16, 8);
+ check_struct_and_union3(long, char, short, 16, 8);
+ check_struct_and_union3(long, char, int, 16, 8);
+ check_struct_and_union3(long, char, long, 24, 8);
+ check_struct_and_union3(long, char, long long, 24, 8);
+ check_struct_and_union3(long, char, float, 16, 8);
+ check_struct_and_union3(long, char, double, 24, 8);
+ check_struct_and_union3(long, char, long double, 32, 16);
+ check_struct_and_union3(long, short, char, 16, 8);
+ check_struct_and_union3(long, short, short, 16, 8);
+ check_struct_and_union3(long, short, int, 16, 8);
+ check_struct_and_union3(long, short, long, 24, 8);
+ check_struct_and_union3(long, short, long long, 24, 8);
+ check_struct_and_union3(long, short, float, 16, 8);
+ check_struct_and_union3(long, short, double, 24, 8);
+ check_struct_and_union3(long, short, long double, 32, 16);
+ check_struct_and_union3(long, int, char, 16, 8);
+ check_struct_and_union3(long, int, short, 16, 8);
+ check_struct_and_union3(long, int, int, 16, 8);
+ check_struct_and_union3(long, int, long, 24, 8);
+ check_struct_and_union3(long, int, long long, 24, 8);
+ check_struct_and_union3(long, int, float, 16, 8);
+ check_struct_and_union3(long, int, double, 24, 8);
+ check_struct_and_union3(long, int, long double, 32, 16);
+ check_struct_and_union3(long, long, char, 24, 8);
+ check_struct_and_union3(long, long, short, 24, 8);
+ check_struct_and_union3(long, long, int, 24, 8);
+ check_struct_and_union3(long, long, long, 24, 8);
+ check_struct_and_union3(long, long, long long, 24, 8);
+ check_struct_and_union3(long, long, float, 24, 8);
+ check_struct_and_union3(long, long, double, 24, 8);
+ check_struct_and_union3(long, long, long double, 32, 16);
+ check_struct_and_union3(long, long long, char, 24, 8);
+ check_struct_and_union3(long, long long, short, 24, 8);
+ check_struct_and_union3(long, long long, int, 24, 8);
+ check_struct_and_union3(long, long long, long, 24, 8);
+ check_struct_and_union3(long, long long, long long, 24, 8);
+ check_struct_and_union3(long, long long, float, 24, 8);
+ check_struct_and_union3(long, long long, double, 24, 8);
+ check_struct_and_union3(long, long long, long double, 32, 16);
+ check_struct_and_union3(long, float, char, 16, 8);
+ check_struct_and_union3(long, float, short, 16, 8);
+ check_struct_and_union3(long, float, int, 16, 8);
+ check_struct_and_union3(long, float, long, 24, 8);
+ check_struct_and_union3(long, float, long long, 24, 8);
+ check_struct_and_union3(long, float, float, 16, 8);
+ check_struct_and_union3(long, float, double, 24, 8);
+ check_struct_and_union3(long, float, long double, 32, 16);
+ check_struct_and_union3(long, double, char, 24, 8);
+ check_struct_and_union3(long, double, short, 24, 8);
+ check_struct_and_union3(long, double, int, 24, 8);
+ check_struct_and_union3(long, double, long, 24, 8);
+ check_struct_and_union3(long, double, long long, 24, 8);
+ check_struct_and_union3(long, double, float, 24, 8);
+ check_struct_and_union3(long, double, double, 24, 8);
+ check_struct_and_union3(long, double, long double, 32, 16);
+ check_struct_and_union3(long, long double, char, 48, 16);
+ check_struct_and_union3(long, long double, short, 48, 16);
+ check_struct_and_union3(long, long double, int, 48, 16);
+ check_struct_and_union3(long, long double, long, 48, 16);
+ check_struct_and_union3(long, long double, long long, 48, 16);
+ check_struct_and_union3(long, long double, float, 48, 16);
+ check_struct_and_union3(long, long double, double, 48, 16);
+ check_struct_and_union3(long, long double, long double, 48, 16);
+ check_struct_and_union3(long long, char, char, 16, 8);
+ check_struct_and_union3(long long, char, short, 16, 8);
+ check_struct_and_union3(long long, char, int, 16, 8);
+ check_struct_and_union3(long long, char, long, 24, 8);
+ check_struct_and_union3(long long, char, long long, 24, 8);
+ check_struct_and_union3(long long, char, float, 16, 8);
+ check_struct_and_union3(long long, char, double, 24, 8);
+ check_struct_and_union3(long long, char, long double, 32, 16);
+ check_struct_and_union3(long long, short, char, 16, 8);
+ check_struct_and_union3(long long, short, short, 16, 8);
+ check_struct_and_union3(long long, short, int, 16, 8);
+ check_struct_and_union3(long long, short, long, 24, 8);
+ check_struct_and_union3(long long, short, long long, 24, 8);
+ check_struct_and_union3(long long, short, float, 16, 8);
+ check_struct_and_union3(long long, short, double, 24, 8);
+ check_struct_and_union3(long long, short, long double, 32, 16);
+ check_struct_and_union3(long long, int, char, 16, 8);
+ check_struct_and_union3(long long, int, short, 16, 8);
+ check_struct_and_union3(long long, int, int, 16, 8);
+ check_struct_and_union3(long long, int, long, 24, 8);
+ check_struct_and_union3(long long, int, long long, 24, 8);
+ check_struct_and_union3(long long, int, float, 16, 8);
+ check_struct_and_union3(long long, int, double, 24, 8);
+ check_struct_and_union3(long long, int, long double, 32, 16);
+ check_struct_and_union3(long long, long, char, 24, 8);
+ check_struct_and_union3(long long, long, short, 24, 8);
+ check_struct_and_union3(long long, long, int, 24, 8);
+ check_struct_and_union3(long long, long, long, 24, 8);
+ check_struct_and_union3(long long, long, long long, 24, 8);
+ check_struct_and_union3(long long, long, float, 24, 8);
+ check_struct_and_union3(long long, long, double, 24, 8);
+ check_struct_and_union3(long long, long, long double, 32, 16);
+ check_struct_and_union3(long long, long long, char, 24, 8);
+ check_struct_and_union3(long long, long long, short, 24, 8);
+ check_struct_and_union3(long long, long long, int, 24, 8);
+ check_struct_and_union3(long long, long long, long, 24, 8);
+ check_struct_and_union3(long long, long long, long long, 24, 8);
+ check_struct_and_union3(long long, long long, float, 24, 8);
+ check_struct_and_union3(long long, long long, double, 24, 8);
+ check_struct_and_union3(long long, long long, long double, 32, 16);
+ check_struct_and_union3(long long, float, char, 16, 8);
+ check_struct_and_union3(long long, float, short, 16, 8);
+ check_struct_and_union3(long long, float, int, 16, 8);
+ check_struct_and_union3(long long, float, long, 24, 8);
+ check_struct_and_union3(long long, float, long long, 24, 8);
+ check_struct_and_union3(long long, float, float, 16, 8);
+ check_struct_and_union3(long long, float, double, 24, 8);
+ check_struct_and_union3(long long, float, long double, 32, 16);
+ check_struct_and_union3(long long, double, char, 24, 8);
+ check_struct_and_union3(long long, double, short, 24, 8);
+ check_struct_and_union3(long long, double, int, 24, 8);
+ check_struct_and_union3(long long, double, long, 24, 8);
+ check_struct_and_union3(long long, double, long long, 24, 8);
+ check_struct_and_union3(long long, double, float, 24, 8);
+ check_struct_and_union3(long long, double, double, 24, 8);
+ check_struct_and_union3(long long, double, long double, 32, 16);
+ check_struct_and_union3(long long, long double, char, 48, 16);
+ check_struct_and_union3(long long, long double, short, 48, 16);
+ check_struct_and_union3(long long, long double, int, 48, 16);
+ check_struct_and_union3(long long, long double, long, 48, 16);
+ check_struct_and_union3(long long, long double, long long, 48, 16);
+ check_struct_and_union3(long long, long double, float, 48, 16);
+ check_struct_and_union3(long long, long double, double, 48, 16);
+ check_struct_and_union3(long long, long double, long double, 48, 16);
+ check_struct_and_union3(float, char, char, 8, 4);
+ check_struct_and_union3(float, char, short, 8, 4);
+ check_struct_and_union3(float, char, int, 12, 4);
+ check_struct_and_union3(float, char, long, 16, 8);
+ check_struct_and_union3(float, char, long long, 16, 8);
+ check_struct_and_union3(float, char, float, 12, 4);
+ check_struct_and_union3(float, char, double, 16, 8);
+ check_struct_and_union3(float, char, long double, 32, 16);
+ check_struct_and_union3(float, short, char, 8, 4);
+ check_struct_and_union3(float, short, short, 8, 4);
+ check_struct_and_union3(float, short, int, 12, 4);
+ check_struct_and_union3(float, short, long, 16, 8);
+ check_struct_and_union3(float, short, long long, 16, 8);
+ check_struct_and_union3(float, short, float, 12, 4);
+ check_struct_and_union3(float, short, double, 16, 8);
+ check_struct_and_union3(float, short, long double, 32, 16);
+ check_struct_and_union3(float, int, char, 12, 4);
+ check_struct_and_union3(float, int, short, 12, 4);
+ check_struct_and_union3(float, int, int, 12, 4);
+ check_struct_and_union3(float, int, long, 16, 8);
+ check_struct_and_union3(float, int, long long, 16, 8);
+ check_struct_and_union3(float, int, float, 12, 4);
+ check_struct_and_union3(float, int, double, 16, 8);
+ check_struct_and_union3(float, int, long double, 32, 16);
+ check_struct_and_union3(float, long, char, 24, 8);
+ check_struct_and_union3(float, long, short, 24, 8);
+ check_struct_and_union3(float, long, int, 24, 8);
+ check_struct_and_union3(float, long, long, 24, 8);
+ check_struct_and_union3(float, long, long long, 24, 8);
+ check_struct_and_union3(float, long, float, 24, 8);
+ check_struct_and_union3(float, long, double, 24, 8);
+ check_struct_and_union3(float, long, long double, 32, 16);
+ check_struct_and_union3(float, long long, char, 24, 8);
+ check_struct_and_union3(float, long long, short, 24, 8);
+ check_struct_and_union3(float, long long, int, 24, 8);
+ check_struct_and_union3(float, long long, long, 24, 8);
+ check_struct_and_union3(float, long long, long long, 24, 8);
+ check_struct_and_union3(float, long long, float, 24, 8);
+ check_struct_and_union3(float, long long, double, 24, 8);
+ check_struct_and_union3(float, long long, long double, 32, 16);
+ check_struct_and_union3(float, float, char, 12, 4);
+ check_struct_and_union3(float, float, short, 12, 4);
+ check_struct_and_union3(float, float, int, 12, 4);
+ check_struct_and_union3(float, float, long, 16, 8);
+ check_struct_and_union3(float, float, long long, 16, 8);
+ check_struct_and_union3(float, float, float, 12, 4);
+ check_struct_and_union3(float, float, double, 16, 8);
+ check_struct_and_union3(float, float, long double, 32, 16);
+ check_struct_and_union3(float, double, char, 24, 8);
+ check_struct_and_union3(float, double, short, 24, 8);
+ check_struct_and_union3(float, double, int, 24, 8);
+ check_struct_and_union3(float, double, long, 24, 8);
+ check_struct_and_union3(float, double, long long, 24, 8);
+ check_struct_and_union3(float, double, float, 24, 8);
+ check_struct_and_union3(float, double, double, 24, 8);
+ check_struct_and_union3(float, double, long double, 32, 16);
+ check_struct_and_union3(float, long double, char, 48, 16);
+ check_struct_and_union3(float, long double, short, 48, 16);
+ check_struct_and_union3(float, long double, int, 48, 16);
+ check_struct_and_union3(float, long double, long, 48, 16);
+ check_struct_and_union3(float, long double, long long, 48, 16);
+ check_struct_and_union3(float, long double, float, 48, 16);
+ check_struct_and_union3(float, long double, double, 48, 16);
+ check_struct_and_union3(float, long double, long double, 48, 16);
+ check_struct_and_union3(double, char, char, 16, 8);
+ check_struct_and_union3(double, char, short, 16, 8);
+ check_struct_and_union3(double, char, int, 16, 8);
+ check_struct_and_union3(double, char, long, 24, 8);
+ check_struct_and_union3(double, char, long long, 24, 8);
+ check_struct_and_union3(double, char, float, 16, 8);
+ check_struct_and_union3(double, char, double, 24, 8);
+ check_struct_and_union3(double, char, long double, 32, 16);
+ check_struct_and_union3(double, short, char, 16, 8);
+ check_struct_and_union3(double, short, short, 16, 8);
+ check_struct_and_union3(double, short, int, 16, 8);
+ check_struct_and_union3(double, short, long, 24, 8);
+ check_struct_and_union3(double, short, long long, 24, 8);
+ check_struct_and_union3(double, short, float, 16, 8);
+ check_struct_and_union3(double, short, double, 24, 8);
+ check_struct_and_union3(double, short, long double, 32, 16);
+ check_struct_and_union3(double, int, char, 16, 8);
+ check_struct_and_union3(double, int, short, 16, 8);
+ check_struct_and_union3(double, int, int, 16, 8);
+ check_struct_and_union3(double, int, long, 24, 8);
+ check_struct_and_union3(double, int, long long, 24, 8);
+ check_struct_and_union3(double, int, float, 16, 8);
+ check_struct_and_union3(double, int, double, 24, 8);
+ check_struct_and_union3(double, int, long double, 32, 16);
+ check_struct_and_union3(double, long, char, 24, 8);
+ check_struct_and_union3(double, long, short, 24, 8);
+ check_struct_and_union3(double, long, int, 24, 8);
+ check_struct_and_union3(double, long, long, 24, 8);
+ check_struct_and_union3(double, long, long long, 24, 8);
+ check_struct_and_union3(double, long, float, 24, 8);
+ check_struct_and_union3(double, long, double, 24, 8);
+ check_struct_and_union3(double, long, long double, 32, 16);
+ check_struct_and_union3(double, long long, char, 24, 8);
+ check_struct_and_union3(double, long long, short, 24, 8);
+ check_struct_and_union3(double, long long, int, 24, 8);
+ check_struct_and_union3(double, long long, long, 24, 8);
+ check_struct_and_union3(double, long long, long long, 24, 8);
+ check_struct_and_union3(double, long long, float, 24, 8);
+ check_struct_and_union3(double, long long, double, 24, 8);
+ check_struct_and_union3(double, long long, long double, 32, 16);
+ check_struct_and_union3(double, float, char, 16, 8);
+ check_struct_and_union3(double, float, short, 16, 8);
+ check_struct_and_union3(double, float, int, 16, 8);
+ check_struct_and_union3(double, float, long, 24, 8);
+ check_struct_and_union3(double, float, long long, 24, 8);
+ check_struct_and_union3(double, float, float, 16, 8);
+ check_struct_and_union3(double, float, double, 24, 8);
+ check_struct_and_union3(double, float, long double, 32, 16);
+ check_struct_and_union3(double, double, char, 24, 8);
+ check_struct_and_union3(double, double, short, 24, 8);
+ check_struct_and_union3(double, double, int, 24, 8);
+ check_struct_and_union3(double, double, long, 24, 8);
+ check_struct_and_union3(double, double, long long, 24, 8);
+ check_struct_and_union3(double, double, float, 24, 8);
+ check_struct_and_union3(double, double, double, 24, 8);
+ check_struct_and_union3(double, double, long double, 32, 16);
+ check_struct_and_union3(double, long double, char, 48, 16);
+ check_struct_and_union3(double, long double, short, 48, 16);
+ check_struct_and_union3(double, long double, int, 48, 16);
+ check_struct_and_union3(double, long double, long, 48, 16);
+ check_struct_and_union3(double, long double, long long, 48, 16);
+ check_struct_and_union3(double, long double, float, 48, 16);
+ check_struct_and_union3(double, long double, double, 48, 16);
+ check_struct_and_union3(double, long double, long double, 48, 16);
+ check_struct_and_union3(long double, char, char, 32, 16);
+ check_struct_and_union3(long double, char, short, 32, 16);
+ check_struct_and_union3(long double, char, int, 32, 16);
+ check_struct_and_union3(long double, char, long, 32, 16);
+ check_struct_and_union3(long double, char, long long, 32, 16);
+ check_struct_and_union3(long double, char, float, 32, 16);
+ check_struct_and_union3(long double, char, double, 32, 16);
+ check_struct_and_union3(long double, char, long double, 48, 16);
+ check_struct_and_union3(long double, short, char, 32, 16);
+ check_struct_and_union3(long double, short, short, 32, 16);
+ check_struct_and_union3(long double, short, int, 32, 16);
+ check_struct_and_union3(long double, short, long, 32, 16);
+ check_struct_and_union3(long double, short, long long, 32, 16);
+ check_struct_and_union3(long double, short, float, 32, 16);
+ check_struct_and_union3(long double, short, double, 32, 16);
+ check_struct_and_union3(long double, short, long double, 48, 16);
+ check_struct_and_union3(long double, int, char, 32, 16);
+ check_struct_and_union3(long double, int, short, 32, 16);
+ check_struct_and_union3(long double, int, int, 32, 16);
+ check_struct_and_union3(long double, int, long, 32, 16);
+ check_struct_and_union3(long double, int, long long, 32, 16);
+ check_struct_and_union3(long double, int, float, 32, 16);
+ check_struct_and_union3(long double, int, double, 32, 16);
+ check_struct_and_union3(long double, int, long double, 48, 16);
+ check_struct_and_union3(long double, long, char, 32, 16);
+ check_struct_and_union3(long double, long, short, 32, 16);
+ check_struct_and_union3(long double, long, int, 32, 16);
+ check_struct_and_union3(long double, long, long, 32, 16);
+ check_struct_and_union3(long double, long, long long, 32, 16);
+ check_struct_and_union3(long double, long, float, 32, 16);
+ check_struct_and_union3(long double, long, double, 32, 16);
+ check_struct_and_union3(long double, long, long double, 48, 16);
+ check_struct_and_union3(long double, long long, char, 32, 16);
+ check_struct_and_union3(long double, long long, short, 32, 16);
+ check_struct_and_union3(long double, long long, int, 32, 16);
+ check_struct_and_union3(long double, long long, long, 32, 16);
+ check_struct_and_union3(long double, long long, long long, 32, 16);
+ check_struct_and_union3(long double, long long, float, 32, 16);
+ check_struct_and_union3(long double, long long, double, 32, 16);
+ check_struct_and_union3(long double, long long, long double, 48, 16);
+ check_struct_and_union3(long double, float, char, 32, 16);
+ check_struct_and_union3(long double, float, short, 32, 16);
+ check_struct_and_union3(long double, float, int, 32, 16);
+ check_struct_and_union3(long double, float, long, 32, 16);
+ check_struct_and_union3(long double, float, long long, 32, 16);
+ check_struct_and_union3(long double, float, float, 32, 16);
+ check_struct_and_union3(long double, float, double, 32, 16);
+ check_struct_and_union3(long double, float, long double, 48, 16);
+ check_struct_and_union3(long double, double, char, 32, 16);
+ check_struct_and_union3(long double, double, short, 32, 16);
+ check_struct_and_union3(long double, double, int, 32, 16);
+ check_struct_and_union3(long double, double, long, 32, 16);
+ check_struct_and_union3(long double, double, long long, 32, 16);
+ check_struct_and_union3(long double, double, float, 32, 16);
+ check_struct_and_union3(long double, double, double, 32, 16);
+ check_struct_and_union3(long double, double, long double, 48, 16);
+ check_struct_and_union3(long double, long double, char, 48, 16);
+ check_struct_and_union3(long double, long double, short, 48, 16);
+ check_struct_and_union3(long double, long double, int, 48, 16);
+ check_struct_and_union3(long double, long double, long, 48, 16);
+ check_struct_and_union3(long double, long double, long long, 48, 16);
+ check_struct_and_union3(long double, long double, float, 48, 16);
+ check_struct_and_union3(long double, long double, double, 48, 16);
+ check_struct_and_union3(long double, long double, long double, 48, 16);
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_alignment.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_alignment.c
new file mode 100644
index 000000000..d3d57d788
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_alignment.c
@@ -0,0 +1,42 @@
+/* This checks alignment of basic types. */
+
+#include "defines.h"
+#include "macros.h"
+
+
+int
+main (void)
+{
+ /* Integral types. */
+ run_signed_tests2(check_align, char, TYPE_ALIGN_CHAR);
+ run_signed_tests2(check_align, short, TYPE_ALIGN_SHORT);
+ run_signed_tests2(check_align, int, TYPE_ALIGN_INT);
+ run_signed_tests2(check_align, long, TYPE_ALIGN_LONG);
+ run_signed_tests2(check_align, long long, TYPE_ALIGN_LONG_LONG);
+#ifdef CHECK_INT128
+ run_signed_tests2(check_align, __int128, TYPE_ALIGN_INT128);
+#endif
+ check_align(enumtype, TYPE_ALIGN_ENUM);
+
+ /* Floating point types. */
+ check_align(float, TYPE_ALIGN_FLOAT);
+ check_align(double, TYPE_ALIGN_DOUBLE);
+#ifdef CHECK_LONG_DOUBLE
+ check_align(long double, TYPE_ALIGN_LONG_DOUBLE);
+#endif
+#ifdef CHECK_FLOAT128
+ check_align(__float128, TYPE_ALIGN_FLOAT128);
+#endif
+
+ /* Packed types - MMX, 3DNow!, SSE and SSE2. */
+#ifdef CHECK_M64_M128
+ check_align(__m64, TYPE_ALIGN_M64);
+ check_align(__m128, TYPE_ALIGN_M128);
+#endif
+
+ /* Pointer types. */
+ check_align(void *, TYPE_ALIGN_POINTER);
+ check_align(void (*)(), TYPE_ALIGN_POINTER);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_array_size_and_align.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_array_size_and_align.c
new file mode 100644
index 000000000..09c737f05
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_array_size_and_align.c
@@ -0,0 +1,41 @@
+/* This checks . */
+
+#include "defines.h"
+#include "macros.h"
+
+
+int
+main (void)
+{
+ /* Integral types. */
+ run_signed_tests3(check_array_size_and_align, char, TYPE_SIZE_CHAR, TYPE_ALIGN_CHAR);
+ run_signed_tests3(check_array_size_and_align, short, TYPE_SIZE_SHORT, TYPE_ALIGN_SHORT);
+ run_signed_tests3(check_array_size_and_align, int, TYPE_SIZE_INT, TYPE_ALIGN_INT);
+ run_signed_tests3(check_array_size_and_align, long, TYPE_SIZE_LONG, TYPE_ALIGN_LONG);
+ run_signed_tests3(check_array_size_and_align, long long, TYPE_SIZE_LONG_LONG, TYPE_ALIGN_LONG_LONG);
+#ifdef CHECK_INT128
+ run_signed_tests3(check_array_size_and_align, __int128, TYPE_SIZE_INT128, TYPE_ALIGN_INT128);
+#endif
+ check_array_size_and_align(enum dummytype, TYPE_SIZE_ENUM, TYPE_ALIGN_ENUM);
+
+ /* Floating point types. */
+ check_array_size_and_align(float, TYPE_SIZE_FLOAT, TYPE_ALIGN_FLOAT);
+ check_array_size_and_align(double, TYPE_SIZE_DOUBLE, TYPE_ALIGN_DOUBLE);
+#ifdef CHECK_LONG_DOUBLE
+ check_array_size_and_align(long double, TYPE_SIZE_LONG_DOUBLE, TYPE_ALIGN_LONG_DOUBLE);
+#endif
+#ifdef CHECK_FLOAT128
+ check_array_size_and_align(__float128, TYPE_SIZE_FLOAT128, TYPE_ALIGN_FLOAT128);
+#endif
+
+ /* Packed types - MMX, 3DNow!, SSE and SSE2. */
+#ifdef CHECK_M64_M128
+ check_array_size_and_align(__m64, TYPE_SIZE_M64, TYPE_ALIGN_M64);
+ check_array_size_and_align(__m128, TYPE_SIZE_M128, TYPE_ALIGN_M128);
+#endif
+
+ /* Pointer types. The function pointer doesn't work with these macros. */
+ check_array_size_and_align(void *, TYPE_SIZE_POINTER, TYPE_ALIGN_POINTER);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_returning.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_returning.c
new file mode 100644
index 000000000..92c906fc8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_returning.c
@@ -0,0 +1,78 @@
+/* This is an autogenerated file. Do not edit. */
+
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+char
+fun_test_returning_char (void)
+{
+ volatile_var++;
+ return 64;
+}
+
+short
+fun_test_returning_short (void)
+{
+ volatile_var++;
+ return 65;
+}
+
+int
+fun_test_returning_int (void)
+{
+ volatile_var++;
+ return 66;
+}
+
+long
+fun_test_returning_long (void)
+{
+ volatile_var++;
+ return 67;
+}
+
+long long
+fun_test_returning_long_long (void)
+{
+ volatile_var++;
+ return 68;
+}
+
+float
+fun_test_returning_float (void)
+{
+ volatile_var++;
+ return 69;
+}
+
+double
+fun_test_returning_double (void)
+{
+ volatile_var++;
+ return 70;
+}
+
+long double
+fun_test_returning_long_double (void)
+{
+ volatile_var++;
+ return 71;
+}
+
+#define def_test_returning_type_xmm(fun, type, ret, reg) \
+ { type var = WRAP_RET (fun) (); \
+ assert (ret == (type) reg && ret == var); }
+int
+main (void)
+{
+ def_test_returning_type_xmm(fun_test_returning_char, char, 64, rax);
+ def_test_returning_type_xmm(fun_test_returning_short, short, 65, rax);
+ def_test_returning_type_xmm(fun_test_returning_int, int, 66, rax);
+ def_test_returning_type_xmm(fun_test_returning_long, long, 67, rax);
+ def_test_returning_type_xmm(fun_test_returning_long_long, long long, 68, rax);
+ def_test_returning_type_xmm(fun_test_returning_float, float, 69, xmm_regs[0]._float[0]);
+ def_test_returning_type_xmm(fun_test_returning_double, double, 70, xmm_regs[0]._double[0]);
+ def_test_returning_type_xmm(fun_test_returning_long_double, long double, 71, x87_regs[0]._ldouble);
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_sizes.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_sizes.c
new file mode 100644
index 000000000..74427c694
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_sizes.c
@@ -0,0 +1,42 @@
+/* This checks sizes of basic types. */
+
+#include "defines.h"
+#include "macros.h"
+
+
+int
+main (void)
+{
+ /* Integral types. */
+ run_signed_tests2(check_size, char, TYPE_SIZE_CHAR);
+ run_signed_tests2(check_size, short, TYPE_SIZE_SHORT);
+ run_signed_tests2(check_size, int, TYPE_SIZE_INT);
+ run_signed_tests2(check_size, long, TYPE_SIZE_LONG);
+ run_signed_tests2(check_size, long long, TYPE_SIZE_LONG_LONG);
+#ifdef CHECK_INT128
+ run_signed_tests2(check_size, __int128, TYPE_SIZE_INT128);
+#endif
+ check_size(enumtype, TYPE_SIZE_ENUM);
+
+ /* Floating point types. */
+ check_size(float, TYPE_SIZE_FLOAT);
+ check_size(double, TYPE_SIZE_DOUBLE);
+#ifdef CHECK_LONG_DOUBLE
+ check_size(long double, TYPE_SIZE_LONG_DOUBLE);
+#endif
+#ifdef CHECK_FLOAT128
+ check_size(__float128, TYPE_SIZE_FLOAT128);
+#endif
+
+ /* Packed types - MMX, 3DNow!, SSE and SSE2. */
+#ifdef CHECK_M64_M128
+ check_size(__m64, TYPE_SIZE_M64);
+ check_size(__m128, TYPE_SIZE_M128);
+#endif
+
+ /* Pointer types. */
+ check_size(void *, TYPE_SIZE_POINTER);
+ check_size(void (*)(), TYPE_SIZE_POINTER);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_struct_size_and_align.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_struct_size_and_align.c
new file mode 100644
index 000000000..783da6ff5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_struct_size_and_align.c
@@ -0,0 +1,42 @@
+/* This checks size and alignment of structs with a single basic type
+ element. All basic types are checked. */
+
+#include "defines.h"
+#include "macros.h"
+
+
+int
+main (void)
+{
+ /* Integral types. */
+ run_signed_tests3(check_basic_struct_size_and_align, char, TYPE_SIZE_CHAR, TYPE_ALIGN_CHAR);
+ run_signed_tests3(check_basic_struct_size_and_align, short, TYPE_SIZE_SHORT, TYPE_ALIGN_SHORT);
+ run_signed_tests3(check_basic_struct_size_and_align, int, TYPE_SIZE_INT, TYPE_ALIGN_INT);
+ run_signed_tests3(check_basic_struct_size_and_align, long, TYPE_SIZE_LONG, TYPE_ALIGN_LONG);
+ run_signed_tests3(check_basic_struct_size_and_align, long long, TYPE_SIZE_LONG_LONG, TYPE_ALIGN_LONG_LONG);
+#ifdef CHECK_INT128
+ run_signed_tests3(check_basic_struct_size_and_align, __int128, TYPE_SIZE_INT128, TYPE_ALIGN_INT128);
+#endif
+ check_basic_struct_size_and_align(enum dummytype, TYPE_SIZE_ENUM, TYPE_ALIGN_ENUM);
+
+ /* Floating point types. */
+ check_basic_struct_size_and_align(float, TYPE_SIZE_FLOAT, TYPE_ALIGN_FLOAT);
+ check_basic_struct_size_and_align(double, TYPE_SIZE_DOUBLE, TYPE_ALIGN_DOUBLE);
+#ifdef CHECK_LONG_DOUBLE
+ check_basic_struct_size_and_align(long double, TYPE_SIZE_LONG_DOUBLE, TYPE_ALIGN_LONG_DOUBLE);
+#endif
+#ifdef CHECK_FLOAT128
+ check_basic_struct_size_and_align(__float128, TYPE_SIZE_FLOAT128, TYPE_ALIGN_FLOAT128);
+#endif
+
+ /* Packed types - MMX, 3DNow!, SSE and SSE2. */
+#ifdef CHECK_M64_M128
+ check_basic_struct_size_and_align(__m64, TYPE_SIZE_M64, TYPE_ALIGN_M64);
+ check_basic_struct_size_and_align(__m128, TYPE_SIZE_M128, TYPE_ALIGN_M128);
+#endif
+
+ /* Pointer types. The function pointer doesn't work with these macros. */
+ check_basic_struct_size_and_align(void *, TYPE_SIZE_POINTER, TYPE_ALIGN_POINTER);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_union_size_and_align.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_union_size_and_align.c
new file mode 100644
index 000000000..a5a51f290
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_basic_union_size_and_align.c
@@ -0,0 +1,41 @@
+/* Test of simple unions, size and alignment. */
+
+#include "defines.h"
+#include "macros.h"
+
+
+int
+main (void)
+{
+ /* Integral types. */
+ run_signed_tests3(check_basic_union_size_and_align, char, TYPE_SIZE_CHAR, TYPE_ALIGN_CHAR);
+ run_signed_tests3(check_basic_union_size_and_align, short, TYPE_SIZE_SHORT, TYPE_ALIGN_SHORT);
+ run_signed_tests3(check_basic_union_size_and_align, int, TYPE_SIZE_INT, TYPE_ALIGN_INT);
+ run_signed_tests3(check_basic_union_size_and_align, long, TYPE_SIZE_LONG, TYPE_ALIGN_LONG);
+ run_signed_tests3(check_basic_union_size_and_align, long long, TYPE_SIZE_LONG_LONG, TYPE_ALIGN_LONG_LONG);
+#ifdef CHECK_INT128
+ run_signed_tests3(check_basic_union_size_and_align, __int128, TYPE_SIZE_INT128, TYPE_ALIGN_INT128);
+#endif
+ check_basic_union_size_and_align(enum dummytype, TYPE_SIZE_ENUM, TYPE_ALIGN_ENUM);
+
+ /* Floating point types. */
+ check_basic_union_size_and_align(float, TYPE_SIZE_FLOAT, TYPE_ALIGN_FLOAT);
+ check_basic_union_size_and_align(double, TYPE_SIZE_DOUBLE, TYPE_ALIGN_DOUBLE);
+#ifdef CHECK_LONG_DOUBLE
+ check_basic_union_size_and_align(long double, TYPE_SIZE_LONG_DOUBLE, TYPE_ALIGN_LONG_DOUBLE);
+#endif
+#ifdef CHECK_FLOAT128
+ check_basic_union_size_and_align(__float128, TYPE_SIZE_FLOAT128, TYPE_ALIGN_FLOAT128);
+#endif
+
+ /* Packed types - MMX, 3DNow!, SSE and SSE2. */
+#ifdef CHECK_M64_M128
+ check_basic_union_size_and_align(__m64, TYPE_SIZE_M64, TYPE_ALIGN_M64);
+ check_basic_union_size_and_align(__m128, TYPE_SIZE_M128, TYPE_ALIGN_M128);
+#endif
+
+ /* Pointer types. The function pointer doesn't work with these macros. */
+ check_basic_union_size_and_align(void *, TYPE_SIZE_POINTER, TYPE_ALIGN_POINTER);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_bitfields.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_bitfields.c
new file mode 100644
index 000000000..27ab1c6aa
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_bitfields.c
@@ -0,0 +1,162 @@
+/* This is a small test to see if bitfields are working. It is only a
+ few structs and a union and a test to see if they have the correct
+ size, if values can be read and written and a couple of argument
+ passing tests. No alignment testing is done. */
+
+#include "defines.h"
+#include "macros.h"
+
+
+/* These five bitfields are taken from the System V ABI, Intel 386
+ architecture supplement. */
+
+/* Word aligned, sizeof is 4. */
+struct RightToLeft
+{
+ int j:5;
+ int k:6;
+ int m:7;
+};
+
+/* Word aligned, sizeof is 12. */
+struct BoundaryAlignment
+{
+ short s:9;
+ int j:9;
+ char c;
+ short t:9;
+ short u:9;
+ char d;
+};
+
+/* Halfword aligned, sizeof is 2. */
+struct StorageUnitSharing
+{
+ char c;
+ short s:8;
+};
+
+/* Halfword aligned, sizeof is 2. */
+union Allocation
+{
+ char c;
+ short s:8;
+};
+
+/* Byte aligned, sizeof is 9. */
+struct Unnamed
+{
+ char c;
+ int :0;
+ char d;
+ short :9;
+ char e;
+ char :0;
+};
+
+/* Extra struct testing bitfields in larger types.
+ Doubleword aligned, sizeof is 8. */
+struct LargerTypes
+{
+ long long l:33;
+ int i:31;
+};
+
+
+void
+passing1 (struct RightToLeft str, int j, int k, int m)
+{
+ assert (str.j == j);
+ assert (str.k == k);
+ assert (str.m == m);
+}
+
+void
+passing2 (struct BoundaryAlignment str, short s, int j, char c, short t,
+ short u, char d)
+{
+ assert (str.s == s);
+ assert (str.j == j);
+ assert (str.c == c);
+ assert (str.t == t);
+ assert (str.u == u);
+ assert (str.d == d);
+}
+
+void
+passing3 (struct StorageUnitSharing str, char c, short s)
+{
+ assert (str.c == c);
+ assert (str.s == s);
+}
+
+void
+passing4 (struct Unnamed str, char c, char d, char e)
+{
+ assert (str.c == c);
+ assert (str.d == d);
+ assert (str.e == e);
+}
+
+void
+passing5 (struct LargerTypes str, long long l, int i)
+{
+ assert (str.l == l);
+ assert (str.i == i);
+}
+
+
+void
+passingU (union Allocation u, char c)
+{
+ assert (u.c == c);
+ assert (u.s == c);
+}
+
+
+int
+main (void)
+{
+ struct RightToLeft str1;
+ struct BoundaryAlignment str2;
+ struct StorageUnitSharing str3;
+ struct Unnamed str4;
+ struct LargerTypes str5;
+ union Allocation u;
+
+ /* Check sizeof's. */
+ check_size(str1, 4);
+ check_size(str2, 12);
+ check_size(str3, 2);
+ check_size(str4, 9);
+ check_size(str5, 8);
+ check_size(u, 2);
+
+ /* Check alignof's. */
+ check_align_lv(str1, 4);
+ check_align_lv(str2, 4);
+ check_align_lv(str3, 2);
+ check_align_lv(str4, 1);
+ check_align_lv(str5, 8);
+ check_align_lv(u, 2);
+
+ /* Check passing. */
+ str1.j = str2.s = str3.c = str4.c = str5.l = 4;
+ str1.k = str2.j = str3.s = str4.d = str5.i = 5;
+ str1.m = str2.c = str4.e = 6;
+ str2.t = 7;
+ str2.u = 8;
+ str2.d = 9;
+ passing1 (str1, 4, 5, 6);
+ passing2 (str2, 4, 5, 6, 7, 8, 9);
+ passing3 (str3, 4, 5);
+ passing4 (str4, 4, 5, 6);
+ passing5 (str5, 4, 5);
+
+ u.c = 5;
+ passingU (u, 5);
+ u.s = 6;
+ passingU (u, 6);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_complex_returning.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_complex_returning.c
new file mode 100644
index 000000000..9e9678d7b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_complex_returning.c
@@ -0,0 +1,83 @@
+/* This is a small test case for returning a complex number. Written by
+ Andreas Jaeger. */
+
+#include "defines.h"
+
+
+#define BUILD_F_COMPLEX(real, imag) \
+ ({ __complex__ float __retval; \
+ __real__ __retval = (real); \
+ __imag__ __retval = (imag); \
+ __retval; })
+
+#define BUILD_D_COMPLEX(real, imag) \
+ ({ __complex__ double __retval; \
+ __real__ __retval = (real); \
+ __imag__ __retval = (imag); \
+ __retval; })
+
+#define BUILD_LD_COMPLEX(real, imag) \
+ ({ __complex__ long double __retval; \
+ __real__ __retval = (real); \
+ __imag__ __retval = (imag); \
+ __retval; })
+
+__complex__ float
+aj_f_times2 (__complex__ float x)
+{
+ __complex__ float res;
+
+ __real__ res = (2.0 * __real__ x);
+ __imag__ res = (2.0 * __imag__ x);
+
+ return res;
+}
+
+__complex__ double
+aj_d_times2 (__complex__ double x)
+{
+ __complex__ double res;
+
+ __real__ res = (2.0 * __real__ x);
+ __imag__ res = (2.0 * __imag__ x);
+
+ return res;
+}
+
+__complex__ long double
+aj_ld_times2 (__complex__ long double x)
+{
+ __complex__ long double res;
+
+ __real__ res = (2.0 * __real__ x);
+ __imag__ res = (2.0 * __imag__ x);
+
+ return res;
+}
+
+int
+main (void)
+{
+#ifdef CHECK_COMPLEX
+ _Complex float fc, fd;
+ _Complex double dc, dd;
+ _Complex long double ldc, ldd;
+
+ fc = BUILD_LD_COMPLEX (2.0f, 3.0f);
+ fd = aj_f_times2 (fc);
+
+ assert (__real__ fd == 4.0f && __imag__ fd == 6.0f);
+
+ dc = BUILD_LD_COMPLEX (2.0, 3.0);
+ dd = aj_ld_times2 (dc);
+
+ assert (__real__ dd == 4.0 && __imag__ dd == 6.0);
+
+ ldc = BUILD_LD_COMPLEX (2.0L, 3.0L);
+ ldd = aj_ld_times2 (ldc);
+
+ assert (__real__ ldd == 4.0L && __imag__ ldd == 6.0L);
+#endif
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_m64m128_returning.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_m64m128_returning.c
new file mode 100644
index 000000000..cde034693
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_m64m128_returning.c
@@ -0,0 +1,54 @@
+#include <stdio.h>
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+__m64
+fun_test_returning___m64 (void)
+{
+ volatile_var++;
+ return (__m64){72,0};
+}
+
+__m128
+fun_test_returning___m128 (void)
+{
+ volatile_var++;
+ return (__m128){73,0,0,0};
+}
+
+__m64 test_64;
+__m128 test_128;
+
+int
+main (void)
+{
+ unsigned failed = 0;
+ XMM_T xmmt1, xmmt2;
+
+ /* We jump through hoops to compare the results as gcc 3.3 does throw
+ an ICE when trying to generate a compare for a == b, when a and b
+ are of __m64 or __m128 type :-( */
+ clear_struct_registers;
+ test_64 = (__m64){72,0};
+ xmmt1._m64[0] = test_64;
+ xmmt2._m64[0] = WRAP_RET (fun_test_returning___m64)();
+ if (xmmt1._long[0] != xmmt2._long[0]
+ || xmmt1._long[0] != xmm_regs[0]._long[0])
+ printf ("fail m64\n"), failed++;
+
+ clear_struct_registers;
+ test_128 = (__m128){73,0};
+ xmmt1._m128[0] = test_128;
+ xmmt2._m128[0] = WRAP_RET (fun_test_returning___m128)();
+ if (xmmt1._long[0] != xmmt2._long[0]
+ || xmmt1._long[0] != xmm_regs[0]._long[0])
+ printf ("fail m128\n"), failed++;
+ if (failed)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_floats.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_floats.c
new file mode 100644
index 000000000..42fff97b0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_floats.c
@@ -0,0 +1,502 @@
+/* This is an autogenerated file. Do not edit. */
+
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23;
+} values_float;
+
+struct
+{
+ double f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23;
+} values_double;
+
+struct
+{
+ ldouble f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23;
+} values_ldouble;
+
+void
+fun_check_float_passing_float8_values (float f0 ATTRIBUTE_UNUSED, float f1 ATTRIBUTE_UNUSED, float f2 ATTRIBUTE_UNUSED, float f3 ATTRIBUTE_UNUSED, float f4 ATTRIBUTE_UNUSED, float f5 ATTRIBUTE_UNUSED, float f6 ATTRIBUTE_UNUSED, float f7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_float.f0 == f0);
+ assert (values_float.f1 == f1);
+ assert (values_float.f2 == f2);
+ assert (values_float.f3 == f3);
+ assert (values_float.f4 == f4);
+ assert (values_float.f5 == f5);
+ assert (values_float.f6 == f6);
+ assert (values_float.f7 == f7);
+
+}
+
+void
+fun_check_float_passing_float8_regs (float f0 ATTRIBUTE_UNUSED, float f1 ATTRIBUTE_UNUSED, float f2 ATTRIBUTE_UNUSED, float f3 ATTRIBUTE_UNUSED, float f4 ATTRIBUTE_UNUSED, float f5 ATTRIBUTE_UNUSED, float f6 ATTRIBUTE_UNUSED, float f7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_float_arguments;
+}
+
+void
+fun_check_float_passing_float16_values (float f0 ATTRIBUTE_UNUSED, float f1 ATTRIBUTE_UNUSED, float f2 ATTRIBUTE_UNUSED, float f3 ATTRIBUTE_UNUSED, float f4 ATTRIBUTE_UNUSED, float f5 ATTRIBUTE_UNUSED, float f6 ATTRIBUTE_UNUSED, float f7 ATTRIBUTE_UNUSED, float f8 ATTRIBUTE_UNUSED, float f9 ATTRIBUTE_UNUSED, float f10 ATTRIBUTE_UNUSED, float f11 ATTRIBUTE_UNUSED, float f12 ATTRIBUTE_UNUSED, float f13 ATTRIBUTE_UNUSED, float f14 ATTRIBUTE_UNUSED, float f15 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_float.f0 == f0);
+ assert (values_float.f1 == f1);
+ assert (values_float.f2 == f2);
+ assert (values_float.f3 == f3);
+ assert (values_float.f4 == f4);
+ assert (values_float.f5 == f5);
+ assert (values_float.f6 == f6);
+ assert (values_float.f7 == f7);
+ assert (values_float.f8 == f8);
+ assert (values_float.f9 == f9);
+ assert (values_float.f10 == f10);
+ assert (values_float.f11 == f11);
+ assert (values_float.f12 == f12);
+ assert (values_float.f13 == f13);
+ assert (values_float.f14 == f14);
+ assert (values_float.f15 == f15);
+
+}
+
+void
+fun_check_float_passing_float16_regs (float f0 ATTRIBUTE_UNUSED, float f1 ATTRIBUTE_UNUSED, float f2 ATTRIBUTE_UNUSED, float f3 ATTRIBUTE_UNUSED, float f4 ATTRIBUTE_UNUSED, float f5 ATTRIBUTE_UNUSED, float f6 ATTRIBUTE_UNUSED, float f7 ATTRIBUTE_UNUSED, float f8 ATTRIBUTE_UNUSED, float f9 ATTRIBUTE_UNUSED, float f10 ATTRIBUTE_UNUSED, float f11 ATTRIBUTE_UNUSED, float f12 ATTRIBUTE_UNUSED, float f13 ATTRIBUTE_UNUSED, float f14 ATTRIBUTE_UNUSED, float f15 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_float_arguments;
+}
+
+void
+fun_check_float_passing_float20_values (float f0 ATTRIBUTE_UNUSED, float f1 ATTRIBUTE_UNUSED, float f2 ATTRIBUTE_UNUSED, float f3 ATTRIBUTE_UNUSED, float f4 ATTRIBUTE_UNUSED, float f5 ATTRIBUTE_UNUSED, float f6 ATTRIBUTE_UNUSED, float f7 ATTRIBUTE_UNUSED, float f8 ATTRIBUTE_UNUSED, float f9 ATTRIBUTE_UNUSED, float f10 ATTRIBUTE_UNUSED, float f11 ATTRIBUTE_UNUSED, float f12 ATTRIBUTE_UNUSED, float f13 ATTRIBUTE_UNUSED, float f14 ATTRIBUTE_UNUSED, float f15 ATTRIBUTE_UNUSED, float f16 ATTRIBUTE_UNUSED, float f17 ATTRIBUTE_UNUSED, float f18 ATTRIBUTE_UNUSED, float f19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_float.f0 == f0);
+ assert (values_float.f1 == f1);
+ assert (values_float.f2 == f2);
+ assert (values_float.f3 == f3);
+ assert (values_float.f4 == f4);
+ assert (values_float.f5 == f5);
+ assert (values_float.f6 == f6);
+ assert (values_float.f7 == f7);
+ assert (values_float.f8 == f8);
+ assert (values_float.f9 == f9);
+ assert (values_float.f10 == f10);
+ assert (values_float.f11 == f11);
+ assert (values_float.f12 == f12);
+ assert (values_float.f13 == f13);
+ assert (values_float.f14 == f14);
+ assert (values_float.f15 == f15);
+ assert (values_float.f16 == f16);
+ assert (values_float.f17 == f17);
+ assert (values_float.f18 == f18);
+ assert (values_float.f19 == f19);
+
+}
+
+void
+fun_check_float_passing_float20_regs (float f0 ATTRIBUTE_UNUSED, float f1 ATTRIBUTE_UNUSED, float f2 ATTRIBUTE_UNUSED, float f3 ATTRIBUTE_UNUSED, float f4 ATTRIBUTE_UNUSED, float f5 ATTRIBUTE_UNUSED, float f6 ATTRIBUTE_UNUSED, float f7 ATTRIBUTE_UNUSED, float f8 ATTRIBUTE_UNUSED, float f9 ATTRIBUTE_UNUSED, float f10 ATTRIBUTE_UNUSED, float f11 ATTRIBUTE_UNUSED, float f12 ATTRIBUTE_UNUSED, float f13 ATTRIBUTE_UNUSED, float f14 ATTRIBUTE_UNUSED, float f15 ATTRIBUTE_UNUSED, float f16 ATTRIBUTE_UNUSED, float f17 ATTRIBUTE_UNUSED, float f18 ATTRIBUTE_UNUSED, float f19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_float_arguments;
+}
+
+void
+fun_check_float_passing_double8_values (double f0 ATTRIBUTE_UNUSED, double f1 ATTRIBUTE_UNUSED, double f2 ATTRIBUTE_UNUSED, double f3 ATTRIBUTE_UNUSED, double f4 ATTRIBUTE_UNUSED, double f5 ATTRIBUTE_UNUSED, double f6 ATTRIBUTE_UNUSED, double f7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_double.f0 == f0);
+ assert (values_double.f1 == f1);
+ assert (values_double.f2 == f2);
+ assert (values_double.f3 == f3);
+ assert (values_double.f4 == f4);
+ assert (values_double.f5 == f5);
+ assert (values_double.f6 == f6);
+ assert (values_double.f7 == f7);
+
+}
+
+void
+fun_check_float_passing_double8_regs (double f0 ATTRIBUTE_UNUSED, double f1 ATTRIBUTE_UNUSED, double f2 ATTRIBUTE_UNUSED, double f3 ATTRIBUTE_UNUSED, double f4 ATTRIBUTE_UNUSED, double f5 ATTRIBUTE_UNUSED, double f6 ATTRIBUTE_UNUSED, double f7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_double_arguments;
+}
+
+void
+fun_check_float_passing_double16_values (double f0 ATTRIBUTE_UNUSED, double f1 ATTRIBUTE_UNUSED, double f2 ATTRIBUTE_UNUSED, double f3 ATTRIBUTE_UNUSED, double f4 ATTRIBUTE_UNUSED, double f5 ATTRIBUTE_UNUSED, double f6 ATTRIBUTE_UNUSED, double f7 ATTRIBUTE_UNUSED, double f8 ATTRIBUTE_UNUSED, double f9 ATTRIBUTE_UNUSED, double f10 ATTRIBUTE_UNUSED, double f11 ATTRIBUTE_UNUSED, double f12 ATTRIBUTE_UNUSED, double f13 ATTRIBUTE_UNUSED, double f14 ATTRIBUTE_UNUSED, double f15 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_double.f0 == f0);
+ assert (values_double.f1 == f1);
+ assert (values_double.f2 == f2);
+ assert (values_double.f3 == f3);
+ assert (values_double.f4 == f4);
+ assert (values_double.f5 == f5);
+ assert (values_double.f6 == f6);
+ assert (values_double.f7 == f7);
+ assert (values_double.f8 == f8);
+ assert (values_double.f9 == f9);
+ assert (values_double.f10 == f10);
+ assert (values_double.f11 == f11);
+ assert (values_double.f12 == f12);
+ assert (values_double.f13 == f13);
+ assert (values_double.f14 == f14);
+ assert (values_double.f15 == f15);
+
+}
+
+void
+fun_check_float_passing_double16_regs (double f0 ATTRIBUTE_UNUSED, double f1 ATTRIBUTE_UNUSED, double f2 ATTRIBUTE_UNUSED, double f3 ATTRIBUTE_UNUSED, double f4 ATTRIBUTE_UNUSED, double f5 ATTRIBUTE_UNUSED, double f6 ATTRIBUTE_UNUSED, double f7 ATTRIBUTE_UNUSED, double f8 ATTRIBUTE_UNUSED, double f9 ATTRIBUTE_UNUSED, double f10 ATTRIBUTE_UNUSED, double f11 ATTRIBUTE_UNUSED, double f12 ATTRIBUTE_UNUSED, double f13 ATTRIBUTE_UNUSED, double f14 ATTRIBUTE_UNUSED, double f15 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_double_arguments;
+}
+
+void
+fun_check_float_passing_double20_values (double f0 ATTRIBUTE_UNUSED, double f1 ATTRIBUTE_UNUSED, double f2 ATTRIBUTE_UNUSED, double f3 ATTRIBUTE_UNUSED, double f4 ATTRIBUTE_UNUSED, double f5 ATTRIBUTE_UNUSED, double f6 ATTRIBUTE_UNUSED, double f7 ATTRIBUTE_UNUSED, double f8 ATTRIBUTE_UNUSED, double f9 ATTRIBUTE_UNUSED, double f10 ATTRIBUTE_UNUSED, double f11 ATTRIBUTE_UNUSED, double f12 ATTRIBUTE_UNUSED, double f13 ATTRIBUTE_UNUSED, double f14 ATTRIBUTE_UNUSED, double f15 ATTRIBUTE_UNUSED, double f16 ATTRIBUTE_UNUSED, double f17 ATTRIBUTE_UNUSED, double f18 ATTRIBUTE_UNUSED, double f19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_double.f0 == f0);
+ assert (values_double.f1 == f1);
+ assert (values_double.f2 == f2);
+ assert (values_double.f3 == f3);
+ assert (values_double.f4 == f4);
+ assert (values_double.f5 == f5);
+ assert (values_double.f6 == f6);
+ assert (values_double.f7 == f7);
+ assert (values_double.f8 == f8);
+ assert (values_double.f9 == f9);
+ assert (values_double.f10 == f10);
+ assert (values_double.f11 == f11);
+ assert (values_double.f12 == f12);
+ assert (values_double.f13 == f13);
+ assert (values_double.f14 == f14);
+ assert (values_double.f15 == f15);
+ assert (values_double.f16 == f16);
+ assert (values_double.f17 == f17);
+ assert (values_double.f18 == f18);
+ assert (values_double.f19 == f19);
+
+}
+
+void
+fun_check_float_passing_double20_regs (double f0 ATTRIBUTE_UNUSED, double f1 ATTRIBUTE_UNUSED, double f2 ATTRIBUTE_UNUSED, double f3 ATTRIBUTE_UNUSED, double f4 ATTRIBUTE_UNUSED, double f5 ATTRIBUTE_UNUSED, double f6 ATTRIBUTE_UNUSED, double f7 ATTRIBUTE_UNUSED, double f8 ATTRIBUTE_UNUSED, double f9 ATTRIBUTE_UNUSED, double f10 ATTRIBUTE_UNUSED, double f11 ATTRIBUTE_UNUSED, double f12 ATTRIBUTE_UNUSED, double f13 ATTRIBUTE_UNUSED, double f14 ATTRIBUTE_UNUSED, double f15 ATTRIBUTE_UNUSED, double f16 ATTRIBUTE_UNUSED, double f17 ATTRIBUTE_UNUSED, double f18 ATTRIBUTE_UNUSED, double f19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_double_arguments;
+}
+
+void
+fun_check_x87_passing_ldouble8_values (ldouble f0 ATTRIBUTE_UNUSED, ldouble f1 ATTRIBUTE_UNUSED, ldouble f2 ATTRIBUTE_UNUSED, ldouble f3 ATTRIBUTE_UNUSED, ldouble f4 ATTRIBUTE_UNUSED, ldouble f5 ATTRIBUTE_UNUSED, ldouble f6 ATTRIBUTE_UNUSED, ldouble f7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_ldouble.f0 == f0);
+ assert (values_ldouble.f1 == f1);
+ assert (values_ldouble.f2 == f2);
+ assert (values_ldouble.f3 == f3);
+ assert (values_ldouble.f4 == f4);
+ assert (values_ldouble.f5 == f5);
+ assert (values_ldouble.f6 == f6);
+ assert (values_ldouble.f7 == f7);
+
+}
+
+void
+fun_check_x87_passing_ldouble8_regs (ldouble f0 ATTRIBUTE_UNUSED, ldouble f1 ATTRIBUTE_UNUSED, ldouble f2 ATTRIBUTE_UNUSED, ldouble f3 ATTRIBUTE_UNUSED, ldouble f4 ATTRIBUTE_UNUSED, ldouble f5 ATTRIBUTE_UNUSED, ldouble f6 ATTRIBUTE_UNUSED, ldouble f7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_ldouble_arguments;
+}
+
+void
+fun_check_x87_passing_ldouble16_values (ldouble f0 ATTRIBUTE_UNUSED, ldouble f1 ATTRIBUTE_UNUSED, ldouble f2 ATTRIBUTE_UNUSED, ldouble f3 ATTRIBUTE_UNUSED, ldouble f4 ATTRIBUTE_UNUSED, ldouble f5 ATTRIBUTE_UNUSED, ldouble f6 ATTRIBUTE_UNUSED, ldouble f7 ATTRIBUTE_UNUSED, ldouble f8 ATTRIBUTE_UNUSED, ldouble f9 ATTRIBUTE_UNUSED, ldouble f10 ATTRIBUTE_UNUSED, ldouble f11 ATTRIBUTE_UNUSED, ldouble f12 ATTRIBUTE_UNUSED, ldouble f13 ATTRIBUTE_UNUSED, ldouble f14 ATTRIBUTE_UNUSED, ldouble f15 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_ldouble.f0 == f0);
+ assert (values_ldouble.f1 == f1);
+ assert (values_ldouble.f2 == f2);
+ assert (values_ldouble.f3 == f3);
+ assert (values_ldouble.f4 == f4);
+ assert (values_ldouble.f5 == f5);
+ assert (values_ldouble.f6 == f6);
+ assert (values_ldouble.f7 == f7);
+ assert (values_ldouble.f8 == f8);
+ assert (values_ldouble.f9 == f9);
+ assert (values_ldouble.f10 == f10);
+ assert (values_ldouble.f11 == f11);
+ assert (values_ldouble.f12 == f12);
+ assert (values_ldouble.f13 == f13);
+ assert (values_ldouble.f14 == f14);
+ assert (values_ldouble.f15 == f15);
+
+}
+
+void
+fun_check_x87_passing_ldouble16_regs (ldouble f0 ATTRIBUTE_UNUSED, ldouble f1 ATTRIBUTE_UNUSED, ldouble f2 ATTRIBUTE_UNUSED, ldouble f3 ATTRIBUTE_UNUSED, ldouble f4 ATTRIBUTE_UNUSED, ldouble f5 ATTRIBUTE_UNUSED, ldouble f6 ATTRIBUTE_UNUSED, ldouble f7 ATTRIBUTE_UNUSED, ldouble f8 ATTRIBUTE_UNUSED, ldouble f9 ATTRIBUTE_UNUSED, ldouble f10 ATTRIBUTE_UNUSED, ldouble f11 ATTRIBUTE_UNUSED, ldouble f12 ATTRIBUTE_UNUSED, ldouble f13 ATTRIBUTE_UNUSED, ldouble f14 ATTRIBUTE_UNUSED, ldouble f15 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_ldouble_arguments;
+}
+
+void
+fun_check_x87_passing_ldouble20_values (ldouble f0 ATTRIBUTE_UNUSED, ldouble f1 ATTRIBUTE_UNUSED, ldouble f2 ATTRIBUTE_UNUSED, ldouble f3 ATTRIBUTE_UNUSED, ldouble f4 ATTRIBUTE_UNUSED, ldouble f5 ATTRIBUTE_UNUSED, ldouble f6 ATTRIBUTE_UNUSED, ldouble f7 ATTRIBUTE_UNUSED, ldouble f8 ATTRIBUTE_UNUSED, ldouble f9 ATTRIBUTE_UNUSED, ldouble f10 ATTRIBUTE_UNUSED, ldouble f11 ATTRIBUTE_UNUSED, ldouble f12 ATTRIBUTE_UNUSED, ldouble f13 ATTRIBUTE_UNUSED, ldouble f14 ATTRIBUTE_UNUSED, ldouble f15 ATTRIBUTE_UNUSED, ldouble f16 ATTRIBUTE_UNUSED, ldouble f17 ATTRIBUTE_UNUSED, ldouble f18 ATTRIBUTE_UNUSED, ldouble f19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_ldouble.f0 == f0);
+ assert (values_ldouble.f1 == f1);
+ assert (values_ldouble.f2 == f2);
+ assert (values_ldouble.f3 == f3);
+ assert (values_ldouble.f4 == f4);
+ assert (values_ldouble.f5 == f5);
+ assert (values_ldouble.f6 == f6);
+ assert (values_ldouble.f7 == f7);
+ assert (values_ldouble.f8 == f8);
+ assert (values_ldouble.f9 == f9);
+ assert (values_ldouble.f10 == f10);
+ assert (values_ldouble.f11 == f11);
+ assert (values_ldouble.f12 == f12);
+ assert (values_ldouble.f13 == f13);
+ assert (values_ldouble.f14 == f14);
+ assert (values_ldouble.f15 == f15);
+ assert (values_ldouble.f16 == f16);
+ assert (values_ldouble.f17 == f17);
+ assert (values_ldouble.f18 == f18);
+ assert (values_ldouble.f19 == f19);
+
+}
+
+void
+fun_check_x87_passing_ldouble20_regs (ldouble f0 ATTRIBUTE_UNUSED, ldouble f1 ATTRIBUTE_UNUSED, ldouble f2 ATTRIBUTE_UNUSED, ldouble f3 ATTRIBUTE_UNUSED, ldouble f4 ATTRIBUTE_UNUSED, ldouble f5 ATTRIBUTE_UNUSED, ldouble f6 ATTRIBUTE_UNUSED, ldouble f7 ATTRIBUTE_UNUSED, ldouble f8 ATTRIBUTE_UNUSED, ldouble f9 ATTRIBUTE_UNUSED, ldouble f10 ATTRIBUTE_UNUSED, ldouble f11 ATTRIBUTE_UNUSED, ldouble f12 ATTRIBUTE_UNUSED, ldouble f13 ATTRIBUTE_UNUSED, ldouble f14 ATTRIBUTE_UNUSED, ldouble f15 ATTRIBUTE_UNUSED, ldouble f16 ATTRIBUTE_UNUSED, ldouble f17 ATTRIBUTE_UNUSED, ldouble f18 ATTRIBUTE_UNUSED, ldouble f19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_ldouble_arguments;
+}
+
+#define def_check_float_passing8(_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7); \
+ \
+ clear_float_registers; \
+ fregs.F0._ ## TYPE [0] = _f0; \
+ fregs.F1._ ## TYPE [0] = _f1; \
+ fregs.F2._ ## TYPE [0] = _f2; \
+ fregs.F3._ ## TYPE [0] = _f3; \
+ fregs.F4._ ## TYPE [0] = _f4; \
+ fregs.F5._ ## TYPE [0] = _f5; \
+ fregs.F6._ ## TYPE [0] = _f6; \
+ fregs.F7._ ## TYPE [0] = _f7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7);
+
+#define def_check_float_passing16(_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ values_ ## TYPE .f8 = _f8; \
+ values_ ## TYPE .f9 = _f9; \
+ values_ ## TYPE .f10 = _f10; \
+ values_ ## TYPE .f11 = _f11; \
+ values_ ## TYPE .f12 = _f12; \
+ values_ ## TYPE .f13 = _f13; \
+ values_ ## TYPE .f14 = _f14; \
+ values_ ## TYPE .f15 = _f15; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15); \
+ \
+ clear_float_registers; \
+ fregs.F0._ ## TYPE [0] = _f0; \
+ fregs.F1._ ## TYPE [0] = _f1; \
+ fregs.F2._ ## TYPE [0] = _f2; \
+ fregs.F3._ ## TYPE [0] = _f3; \
+ fregs.F4._ ## TYPE [0] = _f4; \
+ fregs.F5._ ## TYPE [0] = _f5; \
+ fregs.F6._ ## TYPE [0] = _f6; \
+ fregs.F7._ ## TYPE [0] = _f7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15);
+
+#define def_check_float_passing20(_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ values_ ## TYPE .f8 = _f8; \
+ values_ ## TYPE .f9 = _f9; \
+ values_ ## TYPE .f10 = _f10; \
+ values_ ## TYPE .f11 = _f11; \
+ values_ ## TYPE .f12 = _f12; \
+ values_ ## TYPE .f13 = _f13; \
+ values_ ## TYPE .f14 = _f14; \
+ values_ ## TYPE .f15 = _f15; \
+ values_ ## TYPE .f16 = _f16; \
+ values_ ## TYPE .f17 = _f17; \
+ values_ ## TYPE .f18 = _f18; \
+ values_ ## TYPE .f19 = _f19; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19); \
+ \
+ clear_float_registers; \
+ fregs.F0._ ## TYPE [0] = _f0; \
+ fregs.F1._ ## TYPE [0] = _f1; \
+ fregs.F2._ ## TYPE [0] = _f2; \
+ fregs.F3._ ## TYPE [0] = _f3; \
+ fregs.F4._ ## TYPE [0] = _f4; \
+ fregs.F5._ ## TYPE [0] = _f5; \
+ fregs.F6._ ## TYPE [0] = _f6; \
+ fregs.F7._ ## TYPE [0] = _f7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19);
+
+#define def_check_x87_passing8(_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7); \
+ \
+ clear_x87_registers; \
+ num_fregs = 0; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7);
+
+#define def_check_x87_passing16(_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ values_ ## TYPE .f8 = _f8; \
+ values_ ## TYPE .f9 = _f9; \
+ values_ ## TYPE .f10 = _f10; \
+ values_ ## TYPE .f11 = _f11; \
+ values_ ## TYPE .f12 = _f12; \
+ values_ ## TYPE .f13 = _f13; \
+ values_ ## TYPE .f14 = _f14; \
+ values_ ## TYPE .f15 = _f15; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15); \
+ \
+ clear_x87_registers; \
+ num_fregs = 0; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15);
+
+#define def_check_x87_passing20(_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19, _func1, _func2, TYPE) \
+ values_ ## TYPE .f0 = _f0; \
+ values_ ## TYPE .f1 = _f1; \
+ values_ ## TYPE .f2 = _f2; \
+ values_ ## TYPE .f3 = _f3; \
+ values_ ## TYPE .f4 = _f4; \
+ values_ ## TYPE .f5 = _f5; \
+ values_ ## TYPE .f6 = _f6; \
+ values_ ## TYPE .f7 = _f7; \
+ values_ ## TYPE .f8 = _f8; \
+ values_ ## TYPE .f9 = _f9; \
+ values_ ## TYPE .f10 = _f10; \
+ values_ ## TYPE .f11 = _f11; \
+ values_ ## TYPE .f12 = _f12; \
+ values_ ## TYPE .f13 = _f13; \
+ values_ ## TYPE .f14 = _f14; \
+ values_ ## TYPE .f15 = _f15; \
+ values_ ## TYPE .f16 = _f16; \
+ values_ ## TYPE .f17 = _f17; \
+ values_ ## TYPE .f18 = _f18; \
+ values_ ## TYPE .f19 = _f19; \
+ WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19); \
+ \
+ clear_x87_registers; \
+ num_fregs = 0; \
+ WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, _f18, _f19);
+
+void
+test_floats_on_stack ()
+{
+ def_check_float_passing8(32, 33, 34, 35, 36, 37, 38, 39, fun_check_float_passing_float8_values, fun_check_float_passing_float8_regs, float);
+
+ def_check_float_passing16(32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, fun_check_float_passing_float16_values, fun_check_float_passing_float16_regs, float);
+}
+
+void
+test_too_many_floats ()
+{
+ def_check_float_passing20(32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, fun_check_float_passing_float20_values, fun_check_float_passing_float20_regs, float);
+}
+
+void
+test_doubles_on_stack ()
+{
+ def_check_float_passing8(32, 33, 34, 35, 36, 37, 38, 39, fun_check_float_passing_double8_values, fun_check_float_passing_double8_regs, double);
+
+ def_check_float_passing16(32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, fun_check_float_passing_double16_values, fun_check_float_passing_double16_regs, double);
+}
+
+void
+test_too_many_doubles ()
+{
+ def_check_float_passing20(32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, fun_check_float_passing_double20_values, fun_check_float_passing_double20_regs, double);
+}
+
+void
+test_long_doubles_on_stack ()
+{
+ def_check_x87_passing8(32, 33, 34, 35, 36, 37, 38, 39, fun_check_x87_passing_ldouble8_values, fun_check_x87_passing_ldouble8_regs, ldouble);
+}
+
+void
+test_too_many_long_doubles ()
+{
+ def_check_x87_passing20(32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, fun_check_x87_passing_ldouble20_values, fun_check_x87_passing_ldouble20_regs, ldouble);
+}
+
+void
+test_float128s_on_stack ()
+{
+}
+
+void
+test_too_many_float128s ()
+{
+}
+
+
+int
+main (void)
+{
+ test_floats_on_stack ();
+ test_too_many_floats ();
+ test_doubles_on_stack ();
+ test_too_many_doubles ();
+ test_long_doubles_on_stack ();
+ test_too_many_long_doubles ();
+ test_float128s_on_stack ();
+ test_too_many_float128s ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_integers.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_integers.c
new file mode 100644
index 000000000..d0d0f1fd2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_integers.c
@@ -0,0 +1,203 @@
+/* This is an autogenerated file. Do not edit. */
+
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23;
+} values_int;
+
+struct
+{
+ long i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23;
+} values_long;
+
+void
+fun_check_int_passing_int6_values (int i0 ATTRIBUTE_UNUSED, int i1 ATTRIBUTE_UNUSED, int i2 ATTRIBUTE_UNUSED, int i3 ATTRIBUTE_UNUSED, int i4 ATTRIBUTE_UNUSED, int i5 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_int.i0 == i0);
+ assert (values_int.i1 == i1);
+ assert (values_int.i2 == i2);
+ assert (values_int.i3 == i3);
+ assert (values_int.i4 == i4);
+ assert (values_int.i5 == i5);
+
+}
+
+void
+fun_check_int_passing_int6_regs (int i0 ATTRIBUTE_UNUSED, int i1 ATTRIBUTE_UNUSED, int i2 ATTRIBUTE_UNUSED, int i3 ATTRIBUTE_UNUSED, int i4 ATTRIBUTE_UNUSED, int i5 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_int_arguments;
+}
+
+void
+fun_check_int_passing_int12_values (int i0 ATTRIBUTE_UNUSED, int i1 ATTRIBUTE_UNUSED, int i2 ATTRIBUTE_UNUSED, int i3 ATTRIBUTE_UNUSED, int i4 ATTRIBUTE_UNUSED, int i5 ATTRIBUTE_UNUSED, int i6 ATTRIBUTE_UNUSED, int i7 ATTRIBUTE_UNUSED, int i8 ATTRIBUTE_UNUSED, int i9 ATTRIBUTE_UNUSED, int i10 ATTRIBUTE_UNUSED, int i11 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_int.i0 == i0);
+ assert (values_int.i1 == i1);
+ assert (values_int.i2 == i2);
+ assert (values_int.i3 == i3);
+ assert (values_int.i4 == i4);
+ assert (values_int.i5 == i5);
+ assert (values_int.i6 == i6);
+ assert (values_int.i7 == i7);
+ assert (values_int.i8 == i8);
+ assert (values_int.i9 == i9);
+ assert (values_int.i10 == i10);
+ assert (values_int.i11 == i11);
+
+}
+
+void
+fun_check_int_passing_int12_regs (int i0 ATTRIBUTE_UNUSED, int i1 ATTRIBUTE_UNUSED, int i2 ATTRIBUTE_UNUSED, int i3 ATTRIBUTE_UNUSED, int i4 ATTRIBUTE_UNUSED, int i5 ATTRIBUTE_UNUSED, int i6 ATTRIBUTE_UNUSED, int i7 ATTRIBUTE_UNUSED, int i8 ATTRIBUTE_UNUSED, int i9 ATTRIBUTE_UNUSED, int i10 ATTRIBUTE_UNUSED, int i11 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_int_arguments;
+}
+
+void
+fun_check_int_passing_long6_values (long i0 ATTRIBUTE_UNUSED, long i1 ATTRIBUTE_UNUSED, long i2 ATTRIBUTE_UNUSED, long i3 ATTRIBUTE_UNUSED, long i4 ATTRIBUTE_UNUSED, long i5 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_long.i0 == i0);
+ assert (values_long.i1 == i1);
+ assert (values_long.i2 == i2);
+ assert (values_long.i3 == i3);
+ assert (values_long.i4 == i4);
+ assert (values_long.i5 == i5);
+
+}
+
+void
+fun_check_int_passing_long6_regs (long i0 ATTRIBUTE_UNUSED, long i1 ATTRIBUTE_UNUSED, long i2 ATTRIBUTE_UNUSED, long i3 ATTRIBUTE_UNUSED, long i4 ATTRIBUTE_UNUSED, long i5 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_long_arguments;
+}
+
+void
+fun_check_int_passing_long12_values (long i0 ATTRIBUTE_UNUSED, long i1 ATTRIBUTE_UNUSED, long i2 ATTRIBUTE_UNUSED, long i3 ATTRIBUTE_UNUSED, long i4 ATTRIBUTE_UNUSED, long i5 ATTRIBUTE_UNUSED, long i6 ATTRIBUTE_UNUSED, long i7 ATTRIBUTE_UNUSED, long i8 ATTRIBUTE_UNUSED, long i9 ATTRIBUTE_UNUSED, long i10 ATTRIBUTE_UNUSED, long i11 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ assert (values_long.i0 == i0);
+ assert (values_long.i1 == i1);
+ assert (values_long.i2 == i2);
+ assert (values_long.i3 == i3);
+ assert (values_long.i4 == i4);
+ assert (values_long.i5 == i5);
+ assert (values_long.i6 == i6);
+ assert (values_long.i7 == i7);
+ assert (values_long.i8 == i8);
+ assert (values_long.i9 == i9);
+ assert (values_long.i10 == i10);
+ assert (values_long.i11 == i11);
+
+}
+
+void
+fun_check_int_passing_long12_regs (long i0 ATTRIBUTE_UNUSED, long i1 ATTRIBUTE_UNUSED, long i2 ATTRIBUTE_UNUSED, long i3 ATTRIBUTE_UNUSED, long i4 ATTRIBUTE_UNUSED, long i5 ATTRIBUTE_UNUSED, long i6 ATTRIBUTE_UNUSED, long i7 ATTRIBUTE_UNUSED, long i8 ATTRIBUTE_UNUSED, long i9 ATTRIBUTE_UNUSED, long i10 ATTRIBUTE_UNUSED, long i11 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_long_arguments;
+}
+
+#define def_check_int_passing6(_i0, _i1, _i2, _i3, _i4, _i5, _func1, _func2, TYPE) \
+ values_ ## TYPE .i0 = _i0; \
+ values_ ## TYPE .i1 = _i1; \
+ values_ ## TYPE .i2 = _i2; \
+ values_ ## TYPE .i3 = _i3; \
+ values_ ## TYPE .i4 = _i4; \
+ values_ ## TYPE .i5 = _i5; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5); \
+ \
+ clear_int_registers; \
+ iregs.I0 = _i0; \
+ iregs.I1 = _i1; \
+ iregs.I2 = _i2; \
+ iregs.I3 = _i3; \
+ iregs.I4 = _i4; \
+ iregs.I5 = _i5; \
+ num_iregs = 6; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5);
+
+#define def_check_int_passing12(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11, _func1, _func2, TYPE) \
+ values_ ## TYPE .i0 = _i0; \
+ values_ ## TYPE .i1 = _i1; \
+ values_ ## TYPE .i2 = _i2; \
+ values_ ## TYPE .i3 = _i3; \
+ values_ ## TYPE .i4 = _i4; \
+ values_ ## TYPE .i5 = _i5; \
+ values_ ## TYPE .i6 = _i6; \
+ values_ ## TYPE .i7 = _i7; \
+ values_ ## TYPE .i8 = _i8; \
+ values_ ## TYPE .i9 = _i9; \
+ values_ ## TYPE .i10 = _i10; \
+ values_ ## TYPE .i11 = _i11; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11); \
+ \
+ clear_int_registers; \
+ iregs.I0 = _i0; \
+ iregs.I1 = _i1; \
+ iregs.I2 = _i2; \
+ iregs.I3 = _i3; \
+ iregs.I4 = _i4; \
+ iregs.I5 = _i5; \
+ num_iregs = 6; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11);
+
+void
+test_ints_on_stack ()
+{
+ def_check_int_passing6(32, 33, 34, 35, 36, 37, fun_check_int_passing_int6_values, fun_check_int_passing_int6_regs, int);
+}
+
+void
+test_too_many_ints ()
+{
+ def_check_int_passing12(32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, fun_check_int_passing_int12_values, fun_check_int_passing_int12_regs, int);
+}
+
+void
+test_longs_on_stack ()
+{
+ def_check_int_passing6(32, 33, 34, 35, 36, 37, fun_check_int_passing_long6_values, fun_check_int_passing_long6_regs, long);
+}
+
+void
+test_too_many_longs ()
+{
+ def_check_int_passing12(32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, fun_check_int_passing_long12_values, fun_check_int_passing_long12_regs, long);
+}
+
+void
+test_int128s_on_stack ()
+{
+}
+
+void
+test_too_many_int128s ()
+{
+}
+
+
+int
+main (void)
+{
+ test_ints_on_stack ();
+ test_too_many_ints ();
+ test_longs_on_stack ();
+ test_too_many_longs ();
+ test_int128s_on_stack ();
+ test_too_many_int128s ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_m64m128.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_m64m128.c
new file mode 100644
index 000000000..237435c4e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_m64m128.c
@@ -0,0 +1,249 @@
+#include <stdio.h>
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+/* This struct holds values for argument checking. */
+struct
+{
+ XMM_T i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23;
+} values;
+
+char *pass;
+int failed = 0;
+
+#undef assert
+#define assert(c) do { \
+ if (!(c)) {failed++; printf ("failed %s\n", pass); } \
+} while (0)
+
+#define compare(X1,X2,T) do { \
+ assert (memcmp (&X1, &X2, sizeof (T)) == 0); \
+} while (0)
+
+void
+fun_check_passing_m64_8_values (__m64 i0 ATTRIBUTE_UNUSED, __m64 i1 ATTRIBUTE_UNUSED, __m64 i2 ATTRIBUTE_UNUSED, __m64 i3 ATTRIBUTE_UNUSED, __m64 i4 ATTRIBUTE_UNUSED, __m64 i5 ATTRIBUTE_UNUSED, __m64 i6 ATTRIBUTE_UNUSED, __m64 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m64);
+ compare (values.i1, i1, __m64);
+ compare (values.i2, i2, __m64);
+ compare (values.i3, i3, __m64);
+ compare (values.i4, i4, __m64);
+ compare (values.i5, i5, __m64);
+ compare (values.i6, i6, __m64);
+ compare (values.i7, i7, __m64);
+}
+
+void
+fun_check_passing_m64_8_regs (__m64 i0 ATTRIBUTE_UNUSED, __m64 i1 ATTRIBUTE_UNUSED, __m64 i2 ATTRIBUTE_UNUSED, __m64 i3 ATTRIBUTE_UNUSED, __m64 i4 ATTRIBUTE_UNUSED, __m64 i5 ATTRIBUTE_UNUSED, __m64 i6 ATTRIBUTE_UNUSED, __m64 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m64_arguments;
+}
+
+void
+fun_check_passing_m64_20_values (__m64 i0 ATTRIBUTE_UNUSED, __m64 i1 ATTRIBUTE_UNUSED, __m64 i2 ATTRIBUTE_UNUSED, __m64 i3 ATTRIBUTE_UNUSED, __m64 i4 ATTRIBUTE_UNUSED, __m64 i5 ATTRIBUTE_UNUSED, __m64 i6 ATTRIBUTE_UNUSED, __m64 i7 ATTRIBUTE_UNUSED, __m64 i8 ATTRIBUTE_UNUSED, __m64 i9 ATTRIBUTE_UNUSED, __m64 i10 ATTRIBUTE_UNUSED, __m64 i11 ATTRIBUTE_UNUSED, __m64 i12 ATTRIBUTE_UNUSED, __m64 i13 ATTRIBUTE_UNUSED, __m64 i14 ATTRIBUTE_UNUSED, __m64 i15 ATTRIBUTE_UNUSED, __m64 i16 ATTRIBUTE_UNUSED, __m64 i17 ATTRIBUTE_UNUSED, __m64 i18 ATTRIBUTE_UNUSED, __m64 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0 , i0, __m64);
+ compare (values.i1 , i1, __m64);
+ compare (values.i2 , i2, __m64);
+ compare (values.i3 , i3, __m64);
+ compare (values.i4 , i4, __m64);
+ compare (values.i5 , i5, __m64);
+ compare (values.i6 , i6, __m64);
+ compare (values.i7 , i7, __m64);
+ compare (values.i8 , i8, __m64);
+ compare (values.i9 , i9, __m64);
+ compare (values.i10 , i10, __m64);
+ compare (values.i11 , i11, __m64);
+ compare (values.i12 , i12, __m64);
+ compare (values.i13 , i13, __m64);
+ compare (values.i14 , i14, __m64);
+ compare (values.i15 , i15, __m64);
+ compare (values.i16 , i16, __m64);
+ compare (values.i17 , i17, __m64);
+ compare (values.i18 , i18, __m64);
+ compare (values.i19 , i19, __m64);
+}
+
+void
+fun_check_passing_m64_20_regs (__m64 i0 ATTRIBUTE_UNUSED, __m64 i1 ATTRIBUTE_UNUSED, __m64 i2 ATTRIBUTE_UNUSED, __m64 i3 ATTRIBUTE_UNUSED, __m64 i4 ATTRIBUTE_UNUSED, __m64 i5 ATTRIBUTE_UNUSED, __m64 i6 ATTRIBUTE_UNUSED, __m64 i7 ATTRIBUTE_UNUSED, __m64 i8 ATTRIBUTE_UNUSED, __m64 i9 ATTRIBUTE_UNUSED, __m64 i10 ATTRIBUTE_UNUSED, __m64 i11 ATTRIBUTE_UNUSED, __m64 i12 ATTRIBUTE_UNUSED, __m64 i13 ATTRIBUTE_UNUSED, __m64 i14 ATTRIBUTE_UNUSED, __m64 i15 ATTRIBUTE_UNUSED, __m64 i16 ATTRIBUTE_UNUSED, __m64 i17 ATTRIBUTE_UNUSED, __m64 i18 ATTRIBUTE_UNUSED, __m64 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m64_arguments;
+}
+
+void
+fun_check_passing_m128_8_values (__m128 i0 ATTRIBUTE_UNUSED, __m128 i1 ATTRIBUTE_UNUSED, __m128 i2 ATTRIBUTE_UNUSED, __m128 i3 ATTRIBUTE_UNUSED, __m128 i4 ATTRIBUTE_UNUSED, __m128 i5 ATTRIBUTE_UNUSED, __m128 i6 ATTRIBUTE_UNUSED, __m128 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0, i0, __m128);
+ compare (values.i1, i1, __m128);
+ compare (values.i2, i2, __m128);
+ compare (values.i3, i3, __m128);
+ compare (values.i4, i4, __m128);
+ compare (values.i5, i5, __m128);
+ compare (values.i6, i6, __m128);
+ compare (values.i7, i7, __m128);
+}
+
+void
+fun_check_passing_m128_8_regs (__m128 i0 ATTRIBUTE_UNUSED, __m128 i1 ATTRIBUTE_UNUSED, __m128 i2 ATTRIBUTE_UNUSED, __m128 i3 ATTRIBUTE_UNUSED, __m128 i4 ATTRIBUTE_UNUSED, __m128 i5 ATTRIBUTE_UNUSED, __m128 i6 ATTRIBUTE_UNUSED, __m128 i7 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m128_arguments;
+}
+
+void
+fun_check_passing_m128_20_values (__m128 i0 ATTRIBUTE_UNUSED, __m128 i1 ATTRIBUTE_UNUSED, __m128 i2 ATTRIBUTE_UNUSED, __m128 i3 ATTRIBUTE_UNUSED, __m128 i4 ATTRIBUTE_UNUSED, __m128 i5 ATTRIBUTE_UNUSED, __m128 i6 ATTRIBUTE_UNUSED, __m128 i7 ATTRIBUTE_UNUSED, __m128 i8 ATTRIBUTE_UNUSED, __m128 i9 ATTRIBUTE_UNUSED, __m128 i10 ATTRIBUTE_UNUSED, __m128 i11 ATTRIBUTE_UNUSED, __m128 i12 ATTRIBUTE_UNUSED, __m128 i13 ATTRIBUTE_UNUSED, __m128 i14 ATTRIBUTE_UNUSED, __m128 i15 ATTRIBUTE_UNUSED, __m128 i16 ATTRIBUTE_UNUSED, __m128 i17 ATTRIBUTE_UNUSED, __m128 i18 ATTRIBUTE_UNUSED, __m128 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check argument values. */
+ compare (values.i0 , i0, __m128);
+ compare (values.i1 , i1, __m128);
+ compare (values.i2 , i2, __m128);
+ compare (values.i3 , i3, __m128);
+ compare (values.i4 , i4, __m128);
+ compare (values.i5 , i5, __m128);
+ compare (values.i6 , i6, __m128);
+ compare (values.i7 , i7, __m128);
+ compare (values.i8 , i8, __m128);
+ compare (values.i9 , i9, __m128);
+ compare (values.i10 , i10, __m128);
+ compare (values.i11 , i11, __m128);
+ compare (values.i12 , i12, __m128);
+ compare (values.i13 , i13, __m128);
+ compare (values.i14 , i14, __m128);
+ compare (values.i15 , i15, __m128);
+ compare (values.i16 , i16, __m128);
+ compare (values.i17 , i17, __m128);
+ compare (values.i18 , i18, __m128);
+ compare (values.i19 , i19, __m128);
+}
+
+void
+fun_check_passing_m128_20_regs (__m128 i0 ATTRIBUTE_UNUSED, __m128 i1 ATTRIBUTE_UNUSED, __m128 i2 ATTRIBUTE_UNUSED, __m128 i3 ATTRIBUTE_UNUSED, __m128 i4 ATTRIBUTE_UNUSED, __m128 i5 ATTRIBUTE_UNUSED, __m128 i6 ATTRIBUTE_UNUSED, __m128 i7 ATTRIBUTE_UNUSED, __m128 i8 ATTRIBUTE_UNUSED, __m128 i9 ATTRIBUTE_UNUSED, __m128 i10 ATTRIBUTE_UNUSED, __m128 i11 ATTRIBUTE_UNUSED, __m128 i12 ATTRIBUTE_UNUSED, __m128 i13 ATTRIBUTE_UNUSED, __m128 i14 ATTRIBUTE_UNUSED, __m128 i15 ATTRIBUTE_UNUSED, __m128 i16 ATTRIBUTE_UNUSED, __m128 i17 ATTRIBUTE_UNUSED, __m128 i18 ATTRIBUTE_UNUSED, __m128 i19 ATTRIBUTE_UNUSED)
+{
+ /* Check register contents. */
+ check_m128_arguments;
+}
+
+
+#define def_check_int_passing8(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7); \
+ \
+ clear_float_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7);
+
+#define def_check_int_passing20(_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, _i18, _i19, _func1, _func2, TYPE) \
+ values.i0.TYPE[0] = _i0; \
+ values.i1.TYPE[0] = _i1; \
+ values.i2.TYPE[0] = _i2; \
+ values.i3.TYPE[0] = _i3; \
+ values.i4.TYPE[0] = _i4; \
+ values.i5.TYPE[0] = _i5; \
+ values.i6.TYPE[0] = _i6; \
+ values.i7.TYPE[0] = _i7; \
+ values.i8.TYPE[0] = _i8; \
+ values.i9.TYPE[0] = _i9; \
+ values.i10.TYPE[0] = _i10; \
+ values.i11.TYPE[0] = _i11; \
+ values.i12.TYPE[0] = _i12; \
+ values.i13.TYPE[0] = _i13; \
+ values.i14.TYPE[0] = _i14; \
+ values.i15.TYPE[0] = _i15; \
+ values.i16.TYPE[0] = _i16; \
+ values.i17.TYPE[0] = _i17; \
+ values.i18.TYPE[0] = _i18; \
+ values.i19.TYPE[0] = _i19; \
+ WRAP_CALL(_func1) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, _i18, _i19); \
+ \
+ clear_float_registers; \
+ fregs.F0.TYPE[0] = _i0; \
+ fregs.F1.TYPE[0] = _i1; \
+ fregs.F2.TYPE[0] = _i2; \
+ fregs.F3.TYPE[0] = _i3; \
+ fregs.F4.TYPE[0] = _i4; \
+ fregs.F5.TYPE[0] = _i5; \
+ fregs.F6.TYPE[0] = _i6; \
+ fregs.F7.TYPE[0] = _i7; \
+ num_fregs = 8; \
+ WRAP_CALL(_func2) (_i0, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9, _i10, _i11, _i12, _i13, _i14, _i15, _i16, _i17, _i18, _i19);
+
+void
+test_m64_on_stack ()
+{
+ __m64 x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m64){32+i, 0};
+ pass = "m64-8";
+ def_check_int_passing8(x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], fun_check_passing_m64_8_values, fun_check_passing_m64_8_regs, _m64);
+}
+
+void
+test_too_many_m64 ()
+{
+ __m64 x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m64){32+i, 0};
+ pass = "m64-20";
+ def_check_int_passing20(x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16], x[17], x[18], x[19], fun_check_passing_m64_20_values, fun_check_passing_m64_20_regs, _m64);
+}
+
+void
+test_m128_on_stack ()
+{
+ __m128 x[8];
+ int i;
+ for (i = 0; i < 8; i++)
+ x[i] = (__m128){32+i, 0, 0, 0};
+ pass = "m128-8";
+ def_check_int_passing8(x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], fun_check_passing_m128_8_values, fun_check_passing_m128_8_regs, _m128);
+}
+
+void
+test_too_many_m128 ()
+{
+ __m128 x[20];
+ int i;
+ for (i = 0; i < 20; i++)
+ x[i] = (__m128){32+i, 0, 0, 0};
+ pass = "m128-20";
+ def_check_int_passing20(x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16], x[17], x[18], x[19], fun_check_passing_m128_20_values, fun_check_passing_m128_20_regs, _m128);
+}
+
+int
+main (void)
+{
+ test_m64_on_stack ();
+ test_too_many_m64 ();
+ test_m128_on_stack ();
+ test_too_many_m128 ();
+ if (failed)
+ abort ();
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_structs.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_structs.c
new file mode 100644
index 000000000..ad6d835ba
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_structs.c
@@ -0,0 +1,261 @@
+/* This tests passing of structs. */
+
+#include "defines.h"
+#include "args.h"
+#include <complex.h>
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+struct int_struct
+{
+ int i;
+};
+
+struct long_struct
+{
+ long l;
+};
+
+struct long2_struct
+{
+ long l1, l2;
+};
+
+struct long3_struct
+{
+ long l1, l2, l3;
+};
+
+
+/* Check that the struct is passed as the individual members in iregs. */
+void
+check_struct_passing1 (struct int_struct is ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_struct_passing2 (struct long_struct ls ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_struct_passing3 (struct long2_struct ls ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_struct_passing4 (struct long3_struct ls 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)&ls.l1 == rsp+8);
+ assert ((unsigned long)&ls.l2 == rsp+16);
+ assert ((unsigned long)&ls.l3 == rsp+24);
+}
+
+#ifdef CHECK_M64_M128
+struct m128_struct
+{
+ __m128 x;
+};
+
+struct m128_2_struct
+{
+ __m128 x1, x2;
+};
+
+/* Check that the struct is passed as the individual members in fregs. */
+void
+check_struct_passing5 (struct m128_struct ms1 ATTRIBUTE_UNUSED,
+ struct m128_struct ms2 ATTRIBUTE_UNUSED,
+ struct m128_struct ms3 ATTRIBUTE_UNUSED,
+ struct m128_struct ms4 ATTRIBUTE_UNUSED,
+ struct m128_struct ms5 ATTRIBUTE_UNUSED,
+ struct m128_struct ms6 ATTRIBUTE_UNUSED,
+ struct m128_struct ms7 ATTRIBUTE_UNUSED,
+ struct m128_struct ms8 ATTRIBUTE_UNUSED)
+{
+ check_m128_arguments;
+}
+
+void
+check_struct_passing6 (struct m128_2_struct ms 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)&ms.x1 == rsp+8);
+ assert ((unsigned long)&ms.x2 == rsp+24);
+}
+#endif
+
+struct flex1_struct
+{
+ long i;
+ long flex[];
+};
+
+struct flex2_struct
+{
+ long i;
+ long flex[0];
+};
+
+void
+check_struct_passing7 (struct flex1_struct is ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_struct_passing8 (struct flex2_struct is ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+struct complex1_struct
+{
+ int c;
+ __complex__ float x;
+};
+
+struct complex1a_struct
+{
+ long l;
+ float f;
+};
+
+struct complex2_struct
+{
+ int c;
+ __complex__ float x;
+ float y;
+};
+
+struct complex2a_struct
+{
+ long l;
+ double d;
+};
+
+void
+check_struct_passing9 (struct complex1_struct is ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+ check_float_arguments;
+}
+
+void
+check_struct_passing10 (struct complex2_struct is ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+ check_double_arguments;
+}
+
+static struct flex1_struct f1s = { 60, { } };
+static struct flex2_struct f2s = { 61, { } };
+
+int
+main (void)
+{
+ struct int_struct is = { 48 };
+ struct long_struct ls = { 49 };
+#ifdef CHECK_LARGER_STRUCTS
+ struct long2_struct l2s = { 50, 51 };
+ struct long3_struct l3s = { 52, 53, 54 };
+#endif
+#ifdef CHECK_M64_M128
+ struct m128_struct m128s[8];
+ struct m128_2_struct m128_2s = {
+ { 48.394, 39.3, -397.9, 3484.9 },
+ { -8.394, -93.3, 7.9, 84.94 }
+ };
+ int i;
+#endif
+ struct complex1_struct c1s = { 4, ( -13.4 + 3.5*I ) };
+ union
+ {
+ struct complex1_struct c;
+ struct complex1a_struct u;
+ } c1u;
+ struct complex2_struct c2s = { 4, ( -13.4 + 3.5*I ), -34.5 };
+ union
+ {
+ struct complex2_struct c;
+ struct complex2a_struct u;
+ } c2u;
+
+ clear_struct_registers;
+ iregs.I0 = is.i;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ WRAP_CALL (check_struct_passing1)(is);
+
+ clear_struct_registers;
+ iregs.I0 = ls.l;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ WRAP_CALL (check_struct_passing2)(ls);
+
+#ifdef CHECK_LARGER_STRUCTS
+ clear_struct_registers;
+ iregs.I0 = l2s.l1;
+ iregs.I1 = l2s.l2;
+ num_iregs = 2;
+ clear_int_hardware_registers;
+ WRAP_CALL (check_struct_passing3)(l2s);
+ WRAP_CALL (check_struct_passing4)(l3s);
+#endif
+
+#ifdef CHECK_M64_M128
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ m128s[i].x = (__m128){32+i, 0, i, 0};
+ (&fregs.xmm0)[i]._m128[0] = m128s[i].x;
+ }
+ num_fregs = 8;
+ clear_float_hardware_registers;
+ WRAP_CALL (check_struct_passing5)(m128s[0], m128s[1], m128s[2], m128s[3],
+ m128s[4], m128s[5], m128s[6], m128s[7]);
+ WRAP_CALL (check_struct_passing6)(m128_2s);
+#endif
+
+ clear_struct_registers;
+ iregs.I0 = f1s.i;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ WRAP_CALL (check_struct_passing7)(f1s);
+
+ clear_struct_registers;
+ iregs.I0 = f2s.i;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ WRAP_CALL (check_struct_passing8)(f2s);
+
+ clear_struct_registers;
+ c1u.c = c1s;
+ iregs.I0 = c1u.u.l;
+ num_iregs = 1;
+ fregs.xmm0._float [0] = c1u.u.f;
+ num_fregs = 1;
+ clear_int_hardware_registers;
+ clear_float_hardware_registers;
+ WRAP_CALL (check_struct_passing9)(c1s);
+
+ clear_struct_registers;
+ c2u.c = c2s;
+ iregs.I0 = c2u.u.l;
+ num_iregs = 1;
+ fregs.xmm0._double[0] = c2u.u.d;
+ num_fregs = 1;
+ clear_int_hardware_registers;
+ clear_float_hardware_registers;
+ WRAP_CALL (check_struct_passing10)(c2s);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_structs_and_unions.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_structs_and_unions.c
new file mode 100644
index 000000000..5b40196d4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_structs_and_unions.c
@@ -0,0 +1,95 @@
+/* This tests passing of structs. Only integers are tested. */
+
+#include "defines.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+struct int_struct
+{
+ int i;
+};
+
+struct long_struct
+{
+ long l;
+};
+
+struct long2_struct
+{
+ long l1, l2;
+};
+
+struct long3_struct
+{
+ long l1, l2, l3;
+};
+
+union un1
+{
+ char c;
+ int i;
+};
+
+union un2
+{
+ char c1;
+ long l;
+ char c2;
+};
+
+union un3
+{
+ struct int_struct is;
+ struct long_struct ls;
+ union un1 un;
+};
+
+
+void
+check_mixed_passing1 (char c1 ATTRIBUTE_UNUSED, struct int_struct is ATTRIBUTE_UNUSED, char c2 ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_mixed_passing2 (char c1 ATTRIBUTE_UNUSED, struct long3_struct ls ATTRIBUTE_UNUSED, char c2 ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+
+ /* Check the passing on the stack by comparing the address of the
+ stack elements to the expected place on the stack. */
+ assert ((unsigned long)&ls.l1 == rsp+8);
+ assert ((unsigned long)&ls.l2 == rsp+16);
+ assert ((unsigned long)&ls.l3 == rsp+24);
+}
+
+int
+main (void)
+{
+ struct int_struct is = { 64 };
+#ifdef CHECK_LARGER_STRUCTS
+ struct long3_struct l3s = { 65, 66, 67 };
+#endif
+
+ clear_struct_registers;
+ iregs.I0 = 8;
+ iregs.I1 = 64;
+ iregs.I2 = 9;
+ num_iregs = 3;
+ clear_int_hardware_registers;
+ WRAP_CALL (check_mixed_passing1)(8, is, 9);
+
+#ifdef CHECK_LARGER_STRUCTS
+ clear_struct_registers;
+ iregs.I0 = 10;
+ iregs.I1 = 11;
+ num_iregs = 2;
+ clear_int_hardware_registers;
+ WRAP_CALL (check_mixed_passing2)(10, l3s, 11);
+#endif
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_unions.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_unions.c
new file mode 100644
index 000000000..cff244abb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_passing_unions.c
@@ -0,0 +1,229 @@
+/* This tests passing of structs. */
+
+#include "defines.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+struct int_struct
+{
+ int i;
+};
+
+struct long_struct
+{
+ long l;
+};
+
+union un1
+{
+ char c;
+ int i;
+};
+
+union un2
+{
+ char c1;
+ long l;
+ char c2;
+};
+
+union un3
+{
+ struct int_struct is;
+ struct long_struct ls;
+ union un1 un;
+};
+
+
+void
+check_union_passing1(union un1 u ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_union_passing2(union un2 u1 ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+void
+check_union_passing3(union un3 u ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+}
+
+#define check_union_passing1 WRAP_CALL(check_union_passing1)
+#define check_union_passing2 WRAP_CALL(check_union_passing2)
+#define check_union_passing3 WRAP_CALL(check_union_passing3)
+
+#ifdef CHECK_M64_M128
+union un4
+{
+ __m128 x;
+ float f;
+};
+
+union un5
+{
+ __m128 x;
+ long i;
+};
+
+void
+check_union_passing4(union un4 u1 ATTRIBUTE_UNUSED,
+ union un4 u2 ATTRIBUTE_UNUSED,
+ union un4 u3 ATTRIBUTE_UNUSED,
+ union un4 u4 ATTRIBUTE_UNUSED,
+ union un4 u5 ATTRIBUTE_UNUSED,
+ union un4 u6 ATTRIBUTE_UNUSED,
+ union un4 u7 ATTRIBUTE_UNUSED,
+ union un4 u8 ATTRIBUTE_UNUSED)
+{
+ check_m128_arguments;
+}
+
+void
+check_union_passing5(union un5 u ATTRIBUTE_UNUSED)
+{
+ check_int_arguments;
+ check_vector_arguments(m128, 8);
+}
+
+#define check_union_passing4 WRAP_CALL(check_union_passing4)
+#define check_union_passing5 WRAP_CALL(check_union_passing5)
+#endif
+
+union un6
+{
+ long double ld;
+ int i;
+};
+
+
+void
+check_union_passing6(union un6 u 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)&u.ld == rsp+8);
+ assert ((unsigned long)&u.i == rsp+8);
+}
+
+#define check_union_passing6 WRAP_CALL(check_union_passing6)
+
+int
+main (void)
+{
+ union un1 u1;
+#ifdef CHECK_LARGER_UNION_PASSING
+ union un2 u2;
+ union un3 u3;
+ struct int_struct is;
+ struct long_struct ls;
+#endif /* CHECK_LARGER_UNION_PASSING */
+#ifdef CHECK_M64_M128
+ union un4 u4[8];
+ union un5 u5 = { { 48.394, 39.3, -397.9, 3484.9 } };
+ int i;
+#endif
+ union un6 u6;
+
+ /* Check a union with char, int. */
+ clear_struct_registers;
+ u1.i = 0; /* clear the struct to not have high bits left */
+ u1.c = 32;
+ iregs.I0 = 32;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing1(u1);
+ u1.i = 0; /* clear the struct to not have high bits left */
+ u1.i = 33;
+ iregs.I0 = 33;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing1(u1);
+
+ /* Check a union with char, long, char. */
+#ifdef CHECK_LARGER_UNION_PASSING
+ clear_struct_registers;
+ u2.l = 0; /* clear the struct to not have high bits left */
+ u2.c1 = 34;
+ iregs.I0 = 34;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing2(u2);
+ u2.l = 0; /* clear the struct to not have high bits left */
+ u2.l = 35;
+ iregs.I0 = 35;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing2(u2);
+ u2.l = 0; /* clear the struct to not have high bits left */
+ u2.c2 = 36;
+ iregs.I0 = 36;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing2(u2);
+
+ /* check a union containing two structs and a union. */
+ clear_struct_registers;
+ is.i = 37;
+ u3.ls.l = 0; /* clear the struct to not have high bits left */
+ u3.is = is;
+ iregs.I0 = 37;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing3(u3);
+ ls.l = 38;
+ u3.ls.l = 0; /* clear the struct to not have high bits left */
+ u3.ls = ls;
+ iregs.I0 = 38;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing3(u3);
+ u1.c = 39;
+ u3.ls.l = 0; /* clear the struct to not have high bits left */
+ u3.un = u1;
+ iregs.I0 = 39;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing3(u3);
+ u1.i = 40;
+ u3.ls.l = 0; /* clear the struct to not have high bits left */
+ u3.un = u1;
+ iregs.I0 = 40;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing3(u3);
+#endif /* CHECK_LARGER_UNION_PASSING */
+
+#ifdef CHECK_M64_M128
+ clear_struct_registers;
+ for (i = 0; i < 8; i++)
+ {
+ u4[i].x = (__m128){32+i, 0, i, 0};
+ (&fregs.xmm0)[i]._m128[0] = u4[i].x;
+ }
+ num_fregs = 8;
+ clear_float_hardware_registers;
+ check_union_passing4(u4[0], u4[1], u4[2], u4[3],
+ u4[4], u4[5], u4[6], u4[7]);
+
+ clear_struct_registers;
+ fregs.xmm0._m128[0] = u5.x;
+ num_fregs = 1;
+ num_iregs = 1;
+ iregs.I0 = u5.i;
+ clear_float_hardware_registers;
+ check_union_passing5(u5);
+#endif
+
+ u6.i = 2;
+ check_union_passing6(u6);
+
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_struct_returning.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_struct_returning.c
new file mode 100644
index 000000000..2881f8ec8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_struct_returning.c
@@ -0,0 +1,230 @@
+/* This tests returning of structures. */
+
+#include <stdio.h>
+#include "defines.h"
+#include "macros.h"
+#include "args.h"
+
+struct IntegerRegisters iregs;
+struct FloatRegisters fregs;
+unsigned int num_iregs, num_fregs;
+
+int current_test;
+int num_failed = 0;
+
+#undef assert
+#define assert(test) do { if (!(test)) {fprintf (stderr, "failed in test %d\n", current_test); num_failed++; } } while (0)
+
+#define xmm0f xmm_regs[0]._float
+#define xmm0d xmm_regs[0]._double
+#define xmm1f xmm_regs[1]._float
+#define xmm1d xmm_regs[1]._double
+
+typedef enum {
+ INT = 0,
+ SSE_F,
+ SSE_D,
+ X87,
+ MEM,
+ INT_SSE,
+ SSE_INT,
+ SSE_F_V
+} Type;
+
+/* Structures which should be returned in INTEGER. */
+#define D(I,MEMBERS,B) struct S_ ## I { MEMBERS ; }; Type class_ ## I = INT; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s; memset (&s, 0, sizeof(s)); B; return s; }
+
+D(1,char m1, s.m1=42)
+D(2,short m1, s.m1=42)
+D(3,int m1, s.m1=42)
+D(4,long m1, s.m1=42)
+D(5,long long m1, s.m1=42)
+D(6,char m1;short s, s.m1=42)
+D(7,char m1;int i, s.m1=42)
+D(8,char m1; long l, s.m1=42)
+D(9,char m1; long long l, s.m1=42)
+D(10,char m1[16], s.m1[0]=42)
+D(11,short m1[8], s.m1[0]=42)
+D(12,int m1[4], s.m1[0]=42)
+D(13,long m1[2], s.m1[0]=42)
+D(14,long long m1[2], s.m1[0]=42)
+
+#undef D
+
+/* Structures which should be returned in SSE. */
+#define D(I,MEMBERS,C,B) struct S_ ## I { MEMBERS ; }; Type class_ ## I = C; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s; memset (&s, 0, sizeof(s)); B; return s; }
+
+D(100,float f,SSE_F, s.f=42)
+D(101,double d,SSE_D, s.d=42)
+D(102,float f;float f2,SSE_F, s.f=42)
+D(103,float f;double d,SSE_F, s.f=42)
+D(104,double d; float f,SSE_D, s.d=42)
+D(105,double d; double d2,SSE_D, s.d=42)
+D(106,float f[2],SSE_F, s.f[0]=42)
+D(107,float f[3],SSE_F, s.f[0]=42)
+D(108,float f[4],SSE_F, s.f[0]=42)
+D(109,double d[2],SSE_D, s.d[0]=42)
+D(110,float f[2]; double d,SSE_F, s.f[0]=42)
+D(111,double d;float f[2],SSE_D, s.d=42)
+
+#undef D
+
+/* Structures which should be returned on x87 stack. */
+#define D(I,MEMBERS) struct S_ ## I { MEMBERS ; }; Type class_ ## I = X87; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s = { 42 }; return s; }
+
+/* The only struct containing a long double, which is returned in
+ registers at all, is the singleton struct. All others are too large.
+ This includes a struct containing complex long double, which is passed
+ in memory, although a complex long double type itself is returned in
+ two registers. */
+D(200,long double ld)
+
+#undef D
+
+/* Structures which should be returned in INT (low) and SSE (high). */
+#define D(I,MEMBERS) struct S_ ## I { MEMBERS ; }; Type class_ ## I = INT_SSE; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s = { 42,43 }; return s; }
+
+D(300,char m1; float m2)
+D(301,char m1; double m2)
+D(302,short m1; float m2)
+D(303,short m1; double m2)
+D(304,int m1; float m2)
+D(305,int m1; double m2)
+D(306,long m1; float m2)
+D(307,long m1; double m2)
+
+#undef D
+
+void check_300 (void)
+{
+ XMM_T x;
+ x._ulong[0] = rax;
+ switch (current_test) {
+ case 300: assert ((rax & 0xff) == 42 && x._float[1] == 43); break;
+ case 301: assert ((rax & 0xff) == 42 && xmm0d[0] == 43); break;
+ case 302: assert ((rax & 0xffff) == 42 && x._float[1] == 43); break;
+ case 303: assert ((rax & 0xffff) == 42 && xmm0d[0] == 43); break;
+ case 304: assert ((rax & 0xffffffff) == 42 && x._float[1] == 43); break;
+ case 305: assert ((rax & 0xffffffff) == 42 && xmm0d[0] == 43); break;
+ case 306: assert (rax == 42 && xmm0f[0] == 43); break;
+ case 307: assert (rax == 42 && xmm0d[0] == 43); break;
+ default: assert (0); break;
+ }
+}
+
+/* Structures which should be returned in SSE (low) and INT (high). */
+#define D(I,MEMBERS,B) struct S_ ## I { MEMBERS ; }; Type class_ ## I = SSE_INT; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s; memset (&s, 0, sizeof(s)); B; return s; }
+
+D(400,float f[2];char c, s.f[0]=42; s.c=43)
+D(401,double d;char c, s.d=42; s.c=43)
+
+#undef D
+
+void check_400 (void)
+{
+ switch (current_test) {
+ case 400: assert (xmm0f[0] == 42 && (rax & 0xff) == 43); break;
+ case 401: assert (xmm0d[0] == 42 && (rax & 0xff) == 43); break;
+ default: assert (0); break;
+ }
+}
+
+/* Structures which should be returned in MEM. */
+void *struct_addr;
+#define D(I,MEMBERS) struct S_ ## I { MEMBERS ; }; Type class_ ## I = MEM; \
+struct S_ ## I f_ ## I (void) { union {unsigned char c; struct S_ ## I s;} u; memset (&u.s, 0, sizeof(u.s)); u.c = 42; return u.s; }
+
+/* Too large. */
+D(500,char m1[17])
+D(501,short m1[9])
+D(502,int m1[5])
+D(503,long m1[3])
+D(504,short m1[8];char c)
+D(505,char m1[1];int i[4])
+D(506,float m1[5])
+D(507,double m1[3])
+D(508,char m1[1];float f[4])
+D(509,char m1[1];double d[2])
+D(510,__complex long double m1[1])
+
+/* Too large due to padding. */
+D(520,char m1[1];int i;char c2; int i2; char c3)
+
+/* Unnaturally aligned members. */
+D(530,short m1[1];int i PACKED)
+
+#undef D
+
+
+/* Special tests. */
+#define D(I,MEMBERS,C,B) struct S_ ## I { MEMBERS ; }; Type class_ ## I = C; \
+struct S_ ## I f_ ## I (void) { struct S_ ## I s; B; return s; }
+D(600,float f[4], SSE_F_V, s.f[0] = s.f[1] = s.f[2] = s.f[3] = 42)
+#undef D
+
+void clear_all (void)
+{
+ clear_int_registers;
+ clear_float_registers;
+ clear_x87_registers;
+}
+
+void check_all (Type class, unsigned long size)
+{
+ switch (class) {
+ case INT: if (size < 8) rax &= ~0UL >> (64-8*size); assert (rax == 42); break;
+ case SSE_F: assert (xmm0f[0] == 42); break;
+ case SSE_D: assert (xmm0d[0] == 42); break;
+ case SSE_F_V: assert (xmm0f[0] == 42 && xmm0f[1]==42 && xmm1f[0] == 42 && xmm1f[1] == 42); break;
+ case X87: assert (x87_regs[0]._ldouble == 42); break;
+ case INT_SSE: check_300(); break;
+ case SSE_INT: check_400(); break;
+ /* Ideally we would like to check that rax == struct_addr.
+ Unfortunately the address of the target struct escapes (for setting
+ struct_addr), so the return struct is a temporary one whose address
+ is given to the f_* functions, otherwise a conforming program
+ could notice the struct changing already before the function returns.
+ This temporary struct could be anywhere. For GCC it will be on
+ stack, but no one is forbidding that it could be a static variable
+ if there's no threading or proper locking. Nobody in his right mind
+ will not use the stack for that. */
+ case MEM: assert (*(unsigned char*)struct_addr == 42 && rdi == rax); break;
+ }
+}
+
+#define D(I) { struct S_ ## I s; current_test = I; struct_addr = (void*)&s; \
+ clear_all(); \
+ s = WRAP_RET(f_ ## I) (); \
+ check_all(class_ ## I, sizeof(s)); \
+}
+
+int
+main (void)
+{
+ D(1) D(2) D(3) D(4) D(5) D(6) D(7) D(8) D(9) D(10) D(11) D(12) D(13) D(14)
+
+ D(100) D(101) D(102) D(103) D(104) D(105) D(106) D(107) D(108) D(109) D(110)
+ D(111)
+
+ D(200)
+
+ D(300) D(301) D(302) D(303) D(304) D(305) D(306) D(307)
+
+ D(400) D(401)
+
+ D(500) D(501) D(502) D(503) D(504) D(505) D(506) D(507) D(508) D(509)
+ D(520)
+ D(530)
+
+ D(600)
+ if (num_failed)
+ abort ();
+
+ return 0;
+}
+#undef D
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_varargs.c b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_varargs.c
new file mode 100644
index 000000000..e6d99461d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/x86_64/abi/test_varargs.c
@@ -0,0 +1,97 @@
+/* Test variable number of arguments passed to functions. For now this is
+ just a simple test to see if it's working. */
+
+#include <stdarg.h>
+#include "defines.h"
+
+
+#define ARG_INT 1
+#define ARG_DOUBLE 2
+#define ARG_POINTER 3
+
+union types
+{
+ int ivalue;
+ double dvalue;
+ void *pvalue;
+};
+
+struct arg
+{
+ int type;
+ union types value;
+};
+
+struct arg *arglist;
+
+/* This tests the argumentlist to see if it matches the format string which
+ is printf-like. Nothing will be printed of course. It can handle ints,
+ doubles and void pointers. The given value will be tested against the
+ values given in arglist.
+ This test only assures that the variable argument passing is working.
+ No attempt is made to see if argument passing is done the right way.
+ Since the ABI doesn't say how it's done, checking this is not really
+ relevant. */
+void
+my_noprintf (char *format, ...)
+{
+ va_list va_arglist;
+ char *c;
+
+ int ivalue;
+ double dvalue;
+ void *pvalue;
+ struct arg *argp = arglist;
+
+ va_start (va_arglist, format);
+ for (c = format; *c; c++)
+ if (*c == '%')
+ {
+ switch (*++c)
+ {
+ case 'd':
+ assert (argp->type == ARG_INT);
+ ivalue = va_arg (va_arglist, int);
+ assert (argp->value.ivalue == ivalue);
+ break;
+ case 'f':
+ assert (argp->type == ARG_DOUBLE);
+ dvalue = va_arg (va_arglist, double);
+ assert (argp->value.dvalue == dvalue);
+ break;
+ case 'p':
+ assert (argp->type == ARG_POINTER);
+ pvalue = va_arg (va_arglist, void *);
+ assert (argp->value.pvalue == pvalue);
+ break;
+ default:
+ abort ();
+ }
+
+ argp++;
+ }
+}
+
+int
+main (void)
+{
+#ifdef CHECK_VARARGS
+ struct arg al[5];
+
+ al[0].type = ARG_INT;
+ al[0].value.ivalue = 256;
+ al[1].type = ARG_DOUBLE;
+ al[1].value.dvalue = 257.0;
+ al[2].type = ARG_POINTER;
+ al[2].value.pvalue = al;
+ al[3].type = ARG_DOUBLE;
+ al[3].value.dvalue = 258.0;
+ al[4].type = ARG_INT;
+ al[4].value.ivalue = 259;
+
+ arglist = al;
+ my_noprintf("%d%f%p%f%d", 256, 257.0, al, 258.0, 259);
+#endif
+
+ return 0;
+}