1 2 /* A test of the alternative (redundant) encodings for {inc,dec}{w,l}. */ 3 4 #include "tests/asm.h" 5 #include <stdio.h> 6 7 int r1,r2,r3,r4,r5,r6,r7,r8,a1,a2; 8 9 extern void foo ( void ); 10 asm("\n" 11 VG_SYM(foo) ":\n" 12 "\tpushl $0\n" 13 "\tpopfl\n" 14 "\tmovl " VG_SYM(a1) ",%eax\n" 15 "\tmovl " VG_SYM(a2) ",%edx\n" 16 17 /* inc %eax */ 18 "\t.byte 0xFF\n" 19 "\t.byte 0xC0\n" 20 21 "\tmovl %eax," VG_SYM(r1) "\n" 22 "\tpushfl\n" 23 "\tpopl " VG_SYM(r2) "\n" 24 25 /* inc %dx */ 26 "\t.byte 0x66\n" 27 "\t.byte 0xFF\n" 28 "\t.byte 0xC2\n" 29 30 "\tmovl %edx," VG_SYM(r3) "\n" 31 "\tpushfl\n" 32 "\tpopl " VG_SYM(r4) "\n" 33 34 /* dec %edx */ 35 "\t.byte 0xFF\n" 36 "\t.byte 0xCA\n" 37 38 "\tmovl %edx," VG_SYM(r5) "\n" 39 "\tpushfl\n" 40 "\tpopl " VG_SYM(r6) "\n" 41 42 /* dec %ax */ 43 "\t.byte 0x66\n" 44 "\t.byte 0xFF\n" 45 "\t.byte 0xC8\n" 46 47 "\tmovl %eax," VG_SYM(r7) "\n" 48 "\tpushfl\n" 49 "\tpopl " VG_SYM(r8) "\n" 50 51 "\tret\n" 52 ); 53 54 int main ( void ) 55 { 56 a1 = 0x77777777; 57 a2 = 0x88888888; 58 r1=r2=r3=r4=r5=r6=r7=r8=0; 59 foo(); 60 printf("0x%08x\n",r1); 61 printf("0x%08x\n",r2); 62 printf("0x%08x\n",r3); 63 printf("0x%08x\n",r4); 64 printf("0x%08x\n",r5); 65 printf("0x%08x\n",r6); 66 printf("0x%08x\n",r7); 67 printf("0x%08x\n",r8); 68 return 0; 69 } 70