Skip to contentSkip to conversation

[5667] target-alpha: fix cmpbge instruction

Qemu-devel Aurelien Jarno 1 participant 1 message Nov 10, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5667

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5667
Author:   aurel32
Date:     2008-11-10 11:10:14 +0000 (Mon, 10 Nov 2008)

Log Message:
-----------
target-alpha: fix cmpbge instruction

The cmpbge instruction should compare all 8 bytes of one 64-bit value with another. However, we were looping with a < 7 condition which was skipping the top byte. So if we were doing a compare where the top byte was important, we could get the wrong result (this notably breaks the strlen() function with certain sized strings).

(Vince Weaver)

Modified Paths:
--------------
trunk/target-alpha/op_helper.c

Modified: trunk/target-alpha/op_helper.c
===================================================================

target-alpha/op_helper.c +1 -1
@@ -330,7 +330,7 @@
     int i;
 
     res = 0;
-    for (i = 0; i < 7; i++) {
+    for (i = 0; i < 8; i++) {
         opa = op1 >> (i * 8);
         opb = op2 >> (i * 8);
         if (opa >= opb)