fpu_lazy_eflags.vgtest \
fxtract.stdout.exp fxtract.stderr.exp fxtract.vgtest \
getseg.stdout.exp getseg.stderr.exp getseg.vgtest \
+ incdec_alt.stdout.exp incdec_alt.stderr.exp incdec_alt.vgtest \
int.stderr.exp int.stdout.exp int.vgtest \
$(addsuffix .stderr.exp,$(INSN_TESTS)) \
$(addsuffix .stdout.exp,$(INSN_TESTS)) \
$(addsuffix .vgtest,$(INSN_TESTS)) \
+ lahf.stdout.exp lahf.stderr.exp lahf.vgtest \
looper.stderr.exp looper.stdout.exp looper.vgtest \
pushpopseg.stderr.exp pushpopseg.stdout.exp pushpopseg.vgtest \
sbbmisc.stderr.exp sbbmisc.stdout.exp sbbmisc.vgtest \
check_PROGRAMS = \
badseg bt_everything bt_literal cmpxchg8b cpuid fpu_lazy_eflags \
fxtract \
- getseg $(INSN_TESTS) \
- looper int pushpopseg sbbmisc \
+ getseg incdec_alt $(INSN_TESTS) \
+ lahf looper int pushpopseg sbbmisc \
seg_override sigcontext smc1 yield
AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow \
--- /dev/null
+
+/* A test of the alternative (redundant) encodings for {inc,dec}{w,l}. */
+
+#include <stdio.h>
+
+int r1,r2,r3,r4,r5,r6,r7,r8,a1,a2;
+
+extern void foo ( void );
+asm("\n"
+"foo:\n"
+"\tpushl $0\n"
+"\tpopfl\n"
+"\tmovl a1,%eax\n"
+"\tmovl a2,%edx\n"
+
+/* inc %eax */
+"\t.byte 0xFF\n"
+"\t.byte 0xC0\n"
+
+"\tmovl %eax,r1\n"
+"\tpushfl\n"
+"\tpopl r2\n"
+
+/* inc %dx */
+"\t.byte 0x66\n"
+"\t.byte 0xFF\n"
+"\t.byte 0xC2\n"
+
+"\tmovl %edx,r3\n"
+"\tpushfl\n"
+"\tpopl r4\n"
+
+/* dec %edx */
+"\t.byte 0xFF\n"
+"\t.byte 0xCA\n"
+
+"\tmovl %edx,r5\n"
+"\tpushfl\n"
+"\tpopl r6\n"
+
+/* dec %ax */
+"\t.byte 0x66\n"
+"\t.byte 0xFF\n"
+"\t.byte 0xC8\n"
+
+"\tmovl %eax,r7\n"
+"\tpushfl\n"
+"\tpopl r8\n"
+
+"\tret\n"
+);
+
+int main ( void )
+{
+ a1 = 0x77777777;
+ a2 = 0x88888888;
+ r1=r2=r3=r4=r5=r6=r7=r8=0;
+ foo();
+ printf("0x%08x\n",r1);
+ printf("0x%08x\n",r2);
+ printf("0x%08x\n",r3);
+ printf("0x%08x\n",r4);
+ printf("0x%08x\n",r5);
+ printf("0x%08x\n",r6);
+ printf("0x%08x\n",r7);
+ printf("0x%08x\n",r8);
+ return 0;
+}
--- /dev/null
+
+#include <stdio.h>
+
+extern int foo_1 ( void );
+asm("\n"
+"foo_1:\n"
+"\tpushl $0\n"
+"\tpopfl\n"
+"\tmovl $0xFFFFFFFF, %eax\n"
+"\tmovl $0x12345678, %edx\n"
+"\tsubl %eax, %edx\n"
+"\tlahf\n"
+"\tret\n"
+);
+
+extern int foo_0 ( void );
+asm("\n"
+"foo_0:\n"
+"\tpushl $0\n"
+"\tpopfl\n"
+"\tmovl $0x0, %eax\n"
+"\tmovl $0x12345678, %edx\n"
+"\tsubl %eax, %edx\n"
+"\tlahf\n"
+"\tret\n"
+);
+
+int main ( void )
+{
+ printf("0x%x\n", foo_0());
+ printf("0x%x\n", foo_1());
+ return 0;
+}