home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.asm.x86      Ahh, the lost art of x86 assembly      4,675 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,027 of 4,675   
   Terje Mathisen to All   
   Re: Why does adding a 49 prefix to this    
   10 Mar 20 12:11:38   
   
   XPost: comp.lang.forth   
   From: terje.mathisen@nospicedham.tmsw.no   
      
   JJ wrote:   
   > On Mon, 09 Mar 2020 14:10:13 GMT, Stephen Pelc wrote:   
   >>   
   >> In AMD64, the 4x instructions are *all* REX prefices. The 48   
   >> instruction is NOT a DEC reg instruction, it's a REX prefix.   
   >>   
   >> Stephen   
   >   
   > That's interresting. I didn't realize that there are two sets of opcode for   
   > `INC/DEC ` instructions in x86: `4x` and `FF Cx`. Is there any article   
   > about it? Why there's two set of them? And if one was added later, when was   
   > that?   
      
   I suspect they first defined the single-byte opcodes for things like   
   PUSH/POP reg, INC/DEC/RET/IRET/CLD/STD/CLC etc, many/most of them   
   inherited from the 8080, then we got the two-byte opcodes for an   
   accumulator machine, with almost everything going through AL/AX, along   
   with the Jcc/JMP short branches. Finally they added a much more modern   
   reg/mem decoding engine which as a side-effect meant that most of the   
   reg-reg forms with AX as the target would duplicate the short form.   
      
   I once stumbled over this when challenging Mike Abrash to improve some   
   code I had written and was very proud of:   
      
   He pointed out that I had written something like 'CMP BX,AX' instead of   
   the opposite 'CMP AX,BX' and the AX target form would be a byte shorter   
   and therefore also  a few percent faster.   
      
   Terje   
      
   --   
   -    
   "almost all programming can be viewed as an exercise in caching"   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca