SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Technology Stocks : Advanced Micro Devices - Moderated (AMD) -- Ignore unavailable to you. Want to Upgrade?


To: Joe NYC who wrote (87572)8/23/2002 10:15:52 PM
From: brushwudRead Replies (1) | Respond to of 275872
 
Suppose I load number 1 (literal) to register A. Do I have to specify if one is an 8, 16, 32 or 64 bit number?

Yes, but since '1' is less than 8-bits, you can use any of those size literals, and there's an obvious best (smallest) choice.

Are there different instructions for loading each one of the data widths?

Yes, four widths, three opcodes. (Aren't you glad you asked?) The choice between 16 and 32 bits is modal. You can change the mode with a one-byte instruction prefix.

1) Yes, you need to specify that you are loading 8 bit literal and there are different load instructions for each width. Ok, I specify I am loading only low 8 bits to the register (or the Assembler does it for me). Low 8 bits get loaded, and next, I add this number to another register that has a 64 bit value, expecting 64 bit results. What was in high 56 bits of the register to which I originally loaded low 8 bits?

What you said was MOV reg8, imm8. In this case the hi 56 bits is not changed. Then you would have to sign-extend it (MOVSX reg64, reg8) before adding it to a 64-bit register (ADD reg64, reg64). But alternatively you could've done ADD reg64, imm8 in one instruction or MOV reg64, imm8; ADD reg64, reg64 in two instructions.