Jakub Jelinek 0332e1
--- valgrind/VEX/priv/guest_amd64_toIR.c.jj	2009-10-09 12:52:07.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/VEX/priv/guest_amd64_toIR.c	2009-10-21 22:46:40.000000000 +0200
Jakub Jelinek 0332e1
@@ -14011,17 +14011,19 @@ DisResult disInstr_AMD64_WRK ( 
Jakub Jelinek 0332e1
    case 0xE1: /* LOOPE  disp8: decrement count, jump if count != 0 && ZF==1 */
Jakub Jelinek 0332e1
    case 0xE2: /* LOOP   disp8: decrement count, jump if count != 0 */
Jakub Jelinek 0332e1
     { /* The docs say this uses rCX as a count depending on the
Jakub Jelinek 0332e1
-         address size override, not the operand one.  Since we don't
Jakub Jelinek 0332e1
-         handle address size overrides, I guess that means RCX. */
Jakub Jelinek 0332e1
+         address size override, not the operand one.  */
Jakub Jelinek 0332e1
       IRExpr* zbit  = NULL;
Jakub Jelinek 0332e1
       IRExpr* count = NULL;
Jakub Jelinek 0332e1
       IRExpr* cond  = NULL;
Jakub Jelinek 0332e1
       HChar*  xtra  = NULL;
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
-      if (have66orF2orF3(pfx) || haveASO(pfx)) goto decode_failure;
Jakub Jelinek 0332e1
+      if (have66orF2orF3(pfx)) goto decode_failure;
Jakub Jelinek 0332e1
       d64 = guest_RIP_bbstart+delta+1 + getSDisp8(delta);
Jakub Jelinek 0332e1
       delta++;
Jakub Jelinek 0332e1
-      putIReg64(R_RCX, binop(Iop_Sub64, getIReg64(R_RCX), mkU64(1)));
Jakub Jelinek 0332e1
+      if (haveASO (pfx))
Jakub Jelinek 0332e1
+         putIReg32(R_RCX, binop(Iop_Sub32, getIReg32(R_RCX), mkU32(1)));
Jakub Jelinek 0332e1
+      else
Jakub Jelinek 0332e1
+         putIReg64(R_RCX, binop(Iop_Sub64, getIReg64(R_RCX), mkU64(1)));
Jakub Jelinek 0332e1
 
Jakub Jelinek 0332e1
       count = getIReg64(R_RCX);
Jakub Jelinek 0332e1
       cond = binop(Iop_CmpNE64, count, mkU64(0));
Jakub Jelinek 0332e1
--- valgrind/none/tests/amd64/loopnel.c.jj	2009-10-22 09:42:36.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/none/tests/amd64/loopnel.c	2009-10-22 09:43:07.000000000 +0200
Jakub Jelinek 0332e1
@@ -0,0 +1,11 @@
Jakub Jelinek 0332e1
+#include <stdio.h>
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+int
Jakub Jelinek 0332e1
+main (void)
Jakub Jelinek 0332e1
+{
Jakub Jelinek 0332e1
+  long rcx = 0x200000005UL;
Jakub Jelinek 0332e1
+  long rax = 5UL;
Jakub Jelinek 0332e1
+  asm volatile ("1: addq $1, %0; loopnel 1b" : "+a" (rax), "+c" (rcx) : : "cc");
Jakub Jelinek 0332e1
+  printf ("%ld %ld\n", rax, rcx);
Jakub Jelinek 0332e1
+  return 0;
Jakub Jelinek 0332e1
+}
Jakub Jelinek 0332e1
--- valgrind/none/tests/amd64/loopnel.vgtest.jj	2009-10-22 09:43:54.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/none/tests/amd64/loopnel.vgtest	2009-10-22 09:43:59.000000000 +0200
Jakub Jelinek 0332e1
@@ -0,0 +1 @@
Jakub Jelinek 0332e1
+prog: loopnel
Jakub Jelinek 0332e1
--- valgrind/none/tests/amd64/loopnel.stdout.exp.jj	2009-10-22 09:43:28.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/none/tests/amd64/loopnel.stdout.exp	2009-10-22 09:43:24.000000000 +0200
Jakub Jelinek 0332e1
@@ -0,0 +1 @@
Jakub Jelinek 0332e1
+10 0
Jakub Jelinek 0332e1
--- valgrind/none/tests/amd64/loopnel.stderr.exp.jj	2009-10-22 09:43:40.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/none/tests/amd64/loopnel.stderr.exp	2009-08-19 15:37:15.000000000 +0200
Jakub Jelinek 0332e1
@@ -0,0 +1,2 @@
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
+
Jakub Jelinek 0332e1
--- valgrind/none/tests/amd64/Makefile.am.jj	2009-08-19 15:37:15.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/none/tests/amd64/Makefile.am	2009-10-22 09:44:53.000000000 +0200
Jakub Jelinek 0332e1
@@ -37,6 +37,7 @@ EXTRA_DIST = \
Jakub Jelinek 0332e1
 	insn_ssse3.stdout.exp insn_ssse3.stderr.exp insn_ssse3.vgtest \
Jakub Jelinek 0332e1
 	jrcxz.stderr.exp jrcxz.stdout.exp jrcxz.vgtest \
Jakub Jelinek 0332e1
 	looper.stderr.exp looper.stdout.exp looper.vgtest \
Jakub Jelinek 0332e1
+	loopnel.stderr.exp loopnel.stdout.exp loopnel.vgtest \
Jakub Jelinek 0332e1
 	nibz_bennee_mmap.stderr.exp nibz_bennee_mmap.stdout.exp \
Jakub Jelinek 0332e1
 	nibz_bennee_mmap.vgtest \
Jakub Jelinek 0332e1
 	rcl-amd64.vgtest rcl-amd64.stdout.exp rcl-amd64.stderr.exp \
Jakub Jelinek 0332e1
@@ -72,6 +73,7 @@ if ! VGCONF_OS_IS_DARWIN
Jakub Jelinek 0332e1
 	fcmovnu \
Jakub Jelinek 0332e1
 	fxtract \
Jakub Jelinek 0332e1
 	looper \
Jakub Jelinek 0332e1
+	loopnel \
Jakub Jelinek 0332e1
 	jrcxz \
Jakub Jelinek 0332e1
 	shrld \
Jakub Jelinek 0332e1
 	slahf-amd64
Jakub Jelinek 0332e1
--- valgrind/none/tests/amd64/Makefile.in.jj	2009-08-19 15:43:22.000000000 +0200
Jakub Jelinek 0332e1
+++ valgrind/none/tests/amd64/Makefile.in	2009-10-22 09:46:44.000000000 +0200
Jakub Jelinek 0332e1
@@ -65,6 +65,7 @@ check_PROGRAMS = amd64locked$(EXEEXT) bu
Jakub Jelinek 0332e1
 @VGCONF_OS_IS_DARWIN_FALSE@	fcmovnu \
Jakub Jelinek 0332e1
 @VGCONF_OS_IS_DARWIN_FALSE@	fxtract \
Jakub Jelinek 0332e1
 @VGCONF_OS_IS_DARWIN_FALSE@	looper \
Jakub Jelinek 0332e1
+@VGCONF_OS_IS_DARWIN_FALSE@	loopnel \
Jakub Jelinek 0332e1
 @VGCONF_OS_IS_DARWIN_FALSE@	jrcxz \
Jakub Jelinek 0332e1
 @VGCONF_OS_IS_DARWIN_FALSE@	shrld \
Jakub Jelinek 0332e1
 @VGCONF_OS_IS_DARWIN_FALSE@	slahf-amd64
Jakub Jelinek 0332e1
@@ -87,8 +88,9 @@ am__EXEEXT_3 = insn_basic$(EXEEXT) insn_
Jakub Jelinek 0332e1
 @VGCONF_OS_IS_DARWIN_FALSE@	bug156404-amd64$(EXEEXT) \
Jakub Jelinek 0332e1
 @VGCONF_OS_IS_DARWIN_FALSE@	faultstatus$(EXEEXT) \
Jakub Jelinek 0332e1
 @VGCONF_OS_IS_DARWIN_FALSE@	fcmovnu$(EXEEXT) fxtract$(EXEEXT) \
Jakub Jelinek 0332e1
-@VGCONF_OS_IS_DARWIN_FALSE@	looper$(EXEEXT) jrcxz$(EXEEXT) \
Jakub Jelinek 0332e1
-@VGCONF_OS_IS_DARWIN_FALSE@	shrld$(EXEEXT) slahf-amd64$(EXEEXT)
Jakub Jelinek 0332e1
+@VGCONF_OS_IS_DARWIN_FALSE@	looper$(EXEEXT) loopnel$(EXEEXT) \
Jakub Jelinek 0332e1
+@VGCONF_OS_IS_DARWIN_FALSE@	jrcxz$(EXEEXT) shrld$(EXEEXT) \
Jakub Jelinek 0332e1
+@VGCONF_OS_IS_DARWIN_FALSE@	slahf-amd64$(EXEEXT)
Jakub Jelinek 0332e1
 amd64locked_SOURCES = amd64locked.c
Jakub Jelinek 0332e1
 amd64locked_OBJECTS = amd64locked-amd64locked.$(OBJEXT)
Jakub Jelinek 0332e1
 amd64locked_LDADD = $(LDADD)
Jakub Jelinek 0332e1
@@ -146,6 +148,9 @@ jrcxz_LDADD = $(LDADD)
Jakub Jelinek 0332e1
 looper_SOURCES = looper.c
Jakub Jelinek 0332e1
 looper_OBJECTS = looper.$(OBJEXT)
Jakub Jelinek 0332e1
 looper_LDADD = $(LDADD)
Jakub Jelinek 0332e1
+loopnel = loopnel.c
Jakub Jelinek 0332e1
+loopnel_OBJECTS = loopnel.$(OBJEXT)
Jakub Jelinek 0332e1
+loopnel_LDADD = $(LDADD)
Jakub Jelinek 0332e1
 nibz_bennee_mmap_SOURCES = nibz_bennee_mmap.c
Jakub Jelinek 0332e1
 nibz_bennee_mmap_OBJECTS = nibz_bennee_mmap.$(OBJEXT)
Jakub Jelinek 0332e1
 nibz_bennee_mmap_LDADD = $(LDADD)
Jakub Jelinek 0332e1
@@ -180,16 +185,16 @@ SOURCES = amd64locked.c bug127521-64.c b
Jakub Jelinek 0332e1
 	fcmovnu.c fxtract.c $(insn_basic_SOURCES) $(insn_fpu_SOURCES) \
Jakub Jelinek 0332e1
 	$(insn_mmx_SOURCES) $(insn_sse_SOURCES) $(insn_sse2_SOURCES) \
Jakub Jelinek 0332e1
 	$(insn_sse3_SOURCES) $(insn_ssse3_SOURCES) jrcxz.c looper.c \
Jakub Jelinek 0332e1
-	nibz_bennee_mmap.c rcl-amd64.c redundantRexW.c shrld.c \
Jakub Jelinek 0332e1
-	slahf-amd64.c smc1.c ssse3_misaligned.c
Jakub Jelinek 0332e1
+	loopnel.c nibz_bennee_mmap.c rcl-amd64.c redundantRexW.c \
Jakub Jelinek 0332e1
+	shrld.c slahf-amd64.c smc1.c ssse3_misaligned.c
Jakub Jelinek 0332e1
 DIST_SOURCES = amd64locked.c bug127521-64.c bug132813-amd64.c \
Jakub Jelinek 0332e1
 	bug132918.c bug137714-amd64.c bug156404-amd64.c clc.c \
Jakub Jelinek 0332e1
 	faultstatus.c fcmovnu.c fxtract.c $(insn_basic_SOURCES) \
Jakub Jelinek 0332e1
 	$(insn_fpu_SOURCES) $(insn_mmx_SOURCES) $(insn_sse_SOURCES) \
Jakub Jelinek 0332e1
 	$(insn_sse2_SOURCES) $(insn_sse3_SOURCES) \
Jakub Jelinek 0332e1
-	$(insn_ssse3_SOURCES) jrcxz.c looper.c nibz_bennee_mmap.c \
Jakub Jelinek 0332e1
-	rcl-amd64.c redundantRexW.c shrld.c slahf-amd64.c smc1.c \
Jakub Jelinek 0332e1
-	ssse3_misaligned.c
Jakub Jelinek 0332e1
+	$(insn_ssse3_SOURCES) jrcxz.c looper.c loopnel.c \
Jakub Jelinek 0332e1
+	nibz_bennee_mmap.c rcl-amd64.c redundantRexW.c shrld.c \
Jakub Jelinek 0332e1
+	slahf-amd64.c smc1.c ssse3_misaligned.c
Jakub Jelinek 0332e1
 ETAGS = etags
Jakub Jelinek 0332e1
 CTAGS = ctags
Jakub Jelinek 0332e1
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
Jakub Jelinek 0332e1
@@ -536,6 +541,7 @@ EXTRA_DIST = \
Jakub Jelinek 0332e1
 	insn_ssse3.stdout.exp insn_ssse3.stderr.exp insn_ssse3.vgtest \
Jakub Jelinek 0332e1
 	jrcxz.stderr.exp jrcxz.stdout.exp jrcxz.vgtest \
Jakub Jelinek 0332e1
 	looper.stderr.exp looper.stdout.exp looper.vgtest \
Jakub Jelinek 0332e1
+	loopnel.stderr.exp loopnel.stdout.exp loopnel.vgtest \
Jakub Jelinek 0332e1
 	nibz_bennee_mmap.stderr.exp nibz_bennee_mmap.stdout.exp \
Jakub Jelinek 0332e1
 	nibz_bennee_mmap.vgtest \
Jakub Jelinek 0332e1
 	rcl-amd64.vgtest rcl-amd64.stdout.exp rcl-amd64.stderr.exp \
Jakub Jelinek 0332e1
@@ -661,6 +667,9 @@ jrcxz$(EXEEXT): $(jrcxz_OBJECTS) $(jrcxz
Jakub Jelinek 0332e1
 looper$(EXEEXT): $(looper_OBJECTS) $(looper_DEPENDENCIES) 
Jakub Jelinek 0332e1
 	@rm -f looper$(EXEEXT)
Jakub Jelinek 0332e1
 	$(LINK) $(looper_LDFLAGS) $(looper_OBJECTS) $(looper_LDADD) $(LIBS)
Jakub Jelinek 0332e1
+loopnel$(EXEEXT): $(loopnel_OBJECTS) $(loopnel_DEPENDENCIES) 
Jakub Jelinek 0332e1
+	@rm -f loopnel$(EXEEXT)
Jakub Jelinek 0332e1
+	$(LINK) $(loopnel_LDFLAGS) $(loopnel_OBJECTS) $(loopnel_LDADD) $(LIBS)
Jakub Jelinek 0332e1
 nibz_bennee_mmap$(EXEEXT): $(nibz_bennee_mmap_OBJECTS) $(nibz_bennee_mmap_DEPENDENCIES) 
Jakub Jelinek 0332e1
 	@rm -f nibz_bennee_mmap$(EXEEXT)
Jakub Jelinek 0332e1
 	$(LINK) $(nibz_bennee_mmap_LDFLAGS) $(nibz_bennee_mmap_OBJECTS) $(nibz_bennee_mmap_LDADD) $(LIBS)
Jakub Jelinek 0332e1
@@ -708,6 +717,7 @@ distclean-compile:
Jakub Jelinek 0332e1
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/insn_ssse3.Po@am__quote@
Jakub Jelinek 0332e1
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jrcxz.Po@am__quote@
Jakub Jelinek 0332e1
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/looper.Po@am__quote@
Jakub Jelinek 0332e1
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loopnel.Po@am__quote@
Jakub Jelinek 0332e1
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nibz_bennee_mmap.Po@am__quote@
Jakub Jelinek 0332e1
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rcl-amd64.Po@am__quote@
Jakub Jelinek 0332e1
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/redundantRexW.Po@am__quote@