$(addsuffix .stderr.exp,$(INSN_TESTS)) \
$(addsuffix .stdout.exp,$(INSN_TESTS)) \
$(addsuffix .vgtest,$(INSN_TESTS)) \
+ jcxz.stdout.exp jcxz.stderr.exp jcxz.vgtest \
lahf.stdout.exp lahf.stderr.exp lahf.vgtest \
looper.stderr.exp looper.stdout.exp looper.vgtest \
movx.stderr.exp movx.stdout.exp movx.vgtest \
cmpxchg8b cpuid \
faultstatus fcmovnu fpu_lazy_eflags fxtract \
getseg incdec_alt $(INSN_TESTS) \
+ jcxz \
lahf looper movx int pushpopseg sbbmisc \
seg_override sigcontext smc1 yield
--- /dev/null
+
+#include <stdio.h>
+
+typedef unsigned int UInt;
+
+UInt test_jcxz ( UInt arg )
+{
+ UInt block[2];
+ block[0] = arg;
+ block[1] = 0xdeadbeef;
+ __asm__ __volatile__(
+ "movl %0,%%ecx\n\t"
+ "movl $0,%%eax\n"
+ ".Lxyzzy1:\n\t"
+ "jcxz .Lfoobar1\n\t"
+ "addl $1, %%eax\n\t"
+ "subl $1, %%ecx\n\t"
+ "jmp .Lxyzzy1\n"
+ ".Lfoobar1:\n\t"
+ "movl %%eax, %1"
+ : /*out*/ : /*in*/ "m"(block[0]),
+ "m"(block[1]) : /*trash*/ "eax","ecx","cc","memory"
+ );
+ return block[1];
+}
+
+UInt test_jecxz ( UInt arg )
+{
+ UInt block[2];
+ block[0] = arg;
+ block[1] = 0xdeadbeef;
+ __asm__ __volatile__(
+ "movl %0,%%ecx\n\t"
+ "movl $0,%%eax\n"
+ ".Lxyzzy2:\n\t"
+ "jecxz .Lfoobar2\n\t"
+ "addl $1, %%eax\n\t"
+ "subl $1, %%ecx\n\t"
+ "jmp .Lxyzzy2\n"
+ ".Lfoobar2:\n\t"
+ "movl %%eax, %1"
+ : /*out*/ : /*in*/ "m"(block[0]),
+ "m"(block[1]) : /*trash*/ "eax","ecx","cc","memory"
+ );
+ return block[1];
+}
+
+int main ( void )
+{
+ UInt arg = 0x01028374;
+ printf("test_jcxz(0x%x) = 0x%x\n", arg, test_jcxz(arg));
+ printf("test_jecxz(0x%x) = 0x%x\n", arg, test_jecxz(arg));
+ return 0;
+}