aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@libertysurf.fr>2003-06-01 18:10:09 +0200
committerEric Botcazou <ebotcazou@gcc.gnu.org>2003-06-01 16:10:09 +0000
commita3033f34cfe544f69cf769ce74a1a6f59b2dd95a (patch)
treefad4202f9522d15d00aaf5595bb88251dfffe1a3
parente25a75e6da62acd97a31b7a190e28dee53d93b49 (diff)
downloadgcc-a3033f34cfe544f69cf769ce74a1a6f59b2dd95a.zip
gcc-a3033f34cfe544f69cf769ce74a1a6f59b2dd95a.tar.gz
gcc-a3033f34cfe544f69cf769ce74a1a6f59b2dd95a.tar.bz2
re PR target/11044 ([x86] out of range loop instructions for FP code on K6)
PR target/11044 * config/i386/i386.md (length attribute): Set length to 4 for instructions of type "fcmp". From-SVN: r67300
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/i386.md2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/i386-loop-3.c76
4 files changed, 88 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4c40d1a..21fe87e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2003-06-01 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ PR target/11044
+ * config/i386/i386.md (length attribute): Set length to 4
+ for instructions of type "fcmp".
+
2003-06-01 Andreas Jaeger <aj@suse.de>
* toplev.c: Use ISO C90 prototypes.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index eb03cf2..181cf7e 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -283,6 +283,8 @@
(define_attr "length" ""
(cond [(eq_attr "type" "other,multi,fistp")
(const_int 16)
+ (eq_attr "type" "fcmp")
+ (const_int 4)
(eq_attr "unit" "i387")
(plus (const_int 2)
(plus (attr "prefix_data16")
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 56bf458..7b6632c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2003-06-01 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * gcc.dg/i386-loop-3.c: New test.
+
2003-05-31 Toon Moene <toon@moene.indiv.nluug.nl>
* g77.dg/ffree-form-2.f: XFAIL removed, because fixed.
diff --git a/gcc/testsuite/gcc.dg/i386-loop-3.c b/gcc/testsuite/gcc.dg/i386-loop-3.c
new file mode 100644
index 0000000..c1b4bce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/i386-loop-3.c
@@ -0,0 +1,76 @@
+/* PR target/11044 */
+/* Originator: Tim McGrath <misty-@charter.net> */
+/* Testcase contributed by Eric Botcazou <ebotcazou@libertysurf.fr> */
+/* { dg-do run { target i?86-*-* } } */
+/* { dg-options "-mtune=k6 -O3 -ffast-math -funroll-loops" } */
+
+typedef struct
+{
+ unsigned char colormod;
+} entity_state_t;
+
+typedef struct
+{
+ int num_entities;
+ entity_state_t *entities;
+} packet_entities_t;
+
+typedef struct
+{
+ double senttime;
+ float ping_time;
+ packet_entities_t entities;
+} client_frame_t;
+
+typedef enum
+{
+ cs_free,
+ cs_server,
+ cs_zombie,
+ cs_connected,
+ cs_spawned
+} sv_client_state_t;
+
+typedef struct client_s
+{
+ sv_client_state_t state;
+ int ping;
+ client_frame_t frames[64];
+} client_t;
+
+int CalcPing (client_t *cl)
+{
+ float ping;
+ int count, i;
+ register client_frame_t *frame;
+
+ if (cl->state == cs_server)
+ return cl->ping;
+ ping = 0;
+ count = 0;
+ for (frame = cl->frames, i = 0; i < 64; i++, frame++) {
+ if (frame->ping_time > 0) {
+ ping += frame->ping_time;
+ count++;
+ }
+ }
+ if (!count)
+ return 9999;
+ ping /= count;
+
+ return ping * 1000;
+}
+
+int main(void)
+{
+ client_t cl;
+
+ memset(&cl, 0, sizeof(cl));
+
+ cl.frames[0].ping_time = 1.0f;
+
+ if (CalcPing(&cl) != 1000)
+ abort();
+
+ return 0;
+}