aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2004-01-06 11:49:58 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2004-01-06 10:49:58 +0000
commitbcf1755434c6301327ff7262fb829d7c5c98b20f (patch)
tree44c40b0ca5f7a6b93d77529cf33792064e5ab5e7
parenta67e295f56b5ff1e981af1b2581dec3a55c827b9 (diff)
downloadgcc-bcf1755434c6301327ff7262fb829d7c5c98b20f.zip
gcc-bcf1755434c6301327ff7262fb829d7c5c98b20f.tar.gz
gcc-bcf1755434c6301327ff7262fb829d7c5c98b20f.tar.bz2
i386-sse-5.c: New test
* gcc.dg/i386-sse-5.c: New test * g++.dg/eh/simd-1.c: Add -w argument for i386. * i386.c (init_cumulative_args): Add handling of MMX_REGPARM. (function_arg_advance): Do not pass aggregates in SSE; deal handling of MMX_REGPARM. (function_arg): Add new warnings about ABI changes; fix SSE_REGPARM; add MMX_REGPARM. * i386.h (ix86_args): Add mmx_words/mmx_regs/mmx_regno fields. (SSE_REGPARM_MAX): Default to 3 on i386 -msse ABI. (MMX_REGPARM_MAX): Similarly for -mmmx. From-SVN: r75467
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/config/i386/i386.c56
-rw-r--r--gcc/config/i386/i386.h7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/eh/simd-1.C1
-rw-r--r--gcc/testsuite/gcc.dg/i386-sse-5.c8
6 files changed, 82 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d273342..109b0d6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2004-01-06 Jan Hubicka <jh@suse.cz>
+
+ * i386.c (init_cumulative_args): Add handling of MMX_REGPARM.
+ (function_arg_advance): Do not pass aggregates in SSE; deal handling
+ of MMX_REGPARM.
+ (function_arg): Add new warnings about ABI changes; fix SSE_REGPARM;
+ add MMX_REGPARM.
+ * i386.h (ix86_args): Add mmx_words/mmx_regs/mmx_regno fields.
+ (SSE_REGPARM_MAX): Default to 3 on i386 -msse ABI.
+ (MMX_REGPARM_MAX): Similarly for -mmmx.
+
2004-01-05 Kazu Hirata <kazu@cs.umass.edu>
* config/sh/linux.h: Fix comment formatting.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 842a29c..be4e542 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1832,6 +1832,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, /* Argument info to initialize */
else
cum->nregs = ix86_regparm;
cum->sse_nregs = SSE_REGPARM_MAX;
+ cum->mmx_nregs = MMX_REGPARM_MAX;
cum->maybe_vaarg = false;
/* Use ecx and edx registers if function has fastcall attribute */
@@ -2430,8 +2431,8 @@ function_arg_advance (CUMULATIVE_ARGS *cum, /* current arg information */
if (TARGET_DEBUG_ARG)
fprintf (stderr,
- "function_adv (sz=%d, wds=%2d, nregs=%d, mode=%s, named=%d)\n\n",
- words, cum->words, cum->nregs, GET_MODE_NAME (mode), named);
+ "function_adv (sz=%d, wds=%2d, nregs=%d, ssenregs=%d, mode=%s, named=%d)\n\n",
+ words, cum->words, cum->nregs, cum->sse_nregs, GET_MODE_NAME (mode), named);
if (TARGET_64BIT)
{
int int_nregs, sse_nregs;
@@ -2449,7 +2450,8 @@ function_arg_advance (CUMULATIVE_ARGS *cum, /* current arg information */
}
else
{
- if (TARGET_SSE && mode == TImode)
+ if (TARGET_SSE && SSE_REG_MODE_P (mode)
+ && (!type || !AGGREGATE_TYPE_P (type)))
{
cum->sse_words += words;
cum->sse_nregs -= 1;
@@ -2460,6 +2462,18 @@ function_arg_advance (CUMULATIVE_ARGS *cum, /* current arg information */
cum->sse_regno = 0;
}
}
+ else if (TARGET_MMX && MMX_REG_MODE_P (mode)
+ && (!type || !AGGREGATE_TYPE_P (type)))
+ {
+ cum->mmx_words += words;
+ cum->mmx_nregs -= 1;
+ cum->mmx_regno += 1;
+ if (cum->mmx_nregs <= 0)
+ {
+ cum->mmx_nregs = 0;
+ cum->mmx_regno = 0;
+ }
+ }
else
{
cum->words += words;
@@ -2499,6 +2513,7 @@ function_arg (CUMULATIVE_ARGS *cum, /* current arg information */
int bytes =
(mode == BLKmode) ? int_size_in_bytes (type) : (int) GET_MODE_SIZE (mode);
int words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
+ static bool warnedsse, warnedmmx;
/* Handle a hidden AL argument containing number of registers for varargs
x86-64 functions. For i386 ABI just return constm1_rtx to avoid
@@ -2552,8 +2567,39 @@ function_arg (CUMULATIVE_ARGS *cum, /* current arg information */
}
break;
case TImode:
- if (cum->sse_nregs)
- ret = gen_rtx_REG (mode, cum->sse_regno);
+ case V16QImode:
+ case V8HImode:
+ case V4SImode:
+ case V2DImode:
+ case V4SFmode:
+ case V2DFmode:
+ if (!type || !AGGREGATE_TYPE_P (type))
+ {
+ if (!TARGET_SSE && !warnedmmx)
+ {
+ warnedsse = true;
+ warning ("SSE vector argument without SSE enabled "
+ "changes the ABI");
+ }
+ if (cum->sse_nregs)
+ ret = gen_rtx_REG (mode, cum->sse_regno + FIRST_SSE_REG);
+ }
+ break;
+ case V8QImode:
+ case V4HImode:
+ case V2SImode:
+ case V2SFmode:
+ if (!type || !AGGREGATE_TYPE_P (type))
+ {
+ if (!TARGET_MMX && !warnedmmx)
+ {
+ warnedmmx = true;
+ warning ("MMX vector argument without MMX enabled "
+ "changes the ABI");
+ }
+ if (cum->mmx_nregs)
+ ret = gen_rtx_REG (mode, cum->mmx_regno + FIRST_MMX_REG);
+ }
break;
}
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 148726a..791c5ce 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1744,6 +1744,9 @@ typedef struct ix86_args {
int sse_words; /* # sse words passed so far */
int sse_nregs; /* # sse registers available for passing */
int sse_regno; /* next available sse register number */
+ int mmx_words; /* # mmx words passed so far */
+ int mmx_nregs; /* # mmx registers available for passing */
+ int mmx_regno; /* next available mmx register number */
int maybe_vaarg; /* true for calls to possibly vardic fncts. */
} CUMULATIVE_ARGS;
@@ -2531,7 +2534,9 @@ enum ix86_builtins
#define REGPARM_MAX (TARGET_64BIT ? 6 : 3)
-#define SSE_REGPARM_MAX (TARGET_64BIT ? 8 : 0)
+#define SSE_REGPARM_MAX (TARGET_64BIT ? 8 : (TARGET_SSE ? 3 : 0))
+
+#define MMX_REGPARM_MAX (TARGET_64BIT ? 0 : (TARGET_MMX ? 3 : 0))
/* Specify the machine mode that this machine uses
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d9c5108..ca55ce9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-06 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/i386-sse-5.c: New test
+ * g++.dg/eh/simd-1.c: Add -w argument for i386.
+
2004-01-05 Mark Mitchell <mark@codesourcery.com>
PR c++/12815
diff --git a/gcc/testsuite/g++.dg/eh/simd-1.C b/gcc/testsuite/g++.dg/eh/simd-1.C
index 9cad5ad..2be5e63 100644
--- a/gcc/testsuite/g++.dg/eh/simd-1.C
+++ b/gcc/testsuite/g++.dg/eh/simd-1.C
@@ -1,6 +1,7 @@
// Test EH when V2SI SIMD registers are involved.
// Contributed by Aldy Hernandez (aldy@quesejoda.com).
// { dg-options "-O" }
+// { dg-options "-O -w" { target i?86-*-* } }
// { dg-do run }
// { dg-error "" "PR target/12916" { target sparc*-*-* } 10 }
diff --git a/gcc/testsuite/gcc.dg/i386-sse-5.c b/gcc/testsuite/gcc.dg/i386-sse-5.c
new file mode 100644
index 0000000..edb4fb4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/i386-sse-5.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-Winline -O2 -march=i386" } */
+typedef int v2df __attribute__ ((mode(V2DF)));
+v2df p;
+q(v2df t)
+{ /* { dg-warning "SSE" "" } */
+ p=t;
+}