re PR target/11044 ([x86] out of range loop instructions for FP code on K6)
authorEric Botcazou <ebotcazou@libertysurf.fr>
Sun, 1 Jun 2003 16:10:09 +0000 (18:10 +0200)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sun, 1 Jun 2003 16:10:09 +0000 (16:10 +0000)
PR target/11044
* config/i386/i386.md (length attribute): Set length to 4
for instructions of type "fcmp".

From-SVN: r67300

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/i386-loop-3.c [new file with mode: 0644]

index 4c40d1ab4c63f269375fa7e01624416a75aedbab..21fe87ecd1e6d8a64dc6ca425859a1f081f574cc 100644 (file)
@@ -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.
index eb03cf2b8d55237ada91726b02dbd954b2b622f3..181cf7e56aa190e565523d048d7b05669e95d965 100644 (file)
 (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")
index 56bf4584037896318429529e9f6559081193a987..7b6632c8a4c60fa0075a92d1b7b78655a432a1ec 100644 (file)
@@ -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 (file)
index 0000000..c1b4bce
--- /dev/null
@@ -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;
+}