Article View: comp.sys.intel
Article #1739mov reg,imm32
From: Mike McNally
Date: Fri, 10 Jun 1988 00:10
Date: Fri, 10 Jun 1988 00:10
19 lines
1108 bytes
1108 bytes
According to the 386 programmer's manual, a "mov" instruction which sets a register to a 32-bit value takes 2 clocks. It bothers some part of me to think that it takes five bytes to set EAX to 1. It then dawned on me that I could clear EAX and increment it to 1 with the sequence xor EAX, EAX inc EAX Three bytes. But the problem is, each of these two guys is 2 cycles, according to the book. But but, doesn't the "mov" kinda sorta take extra time too, like in terms of extra instruction fetch overhead? I know it's hard to figure out the costs, but one way or another the CPU has to fetch five bytes. So which is better? -- Mike McNally of Lynx Real-Time Systems uucp: lynx!m5 (maybe pyramid!voder!lynx!m5 if lynx is unknown)
Technical Details
Message-ID:
<3889@lynx.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-tis!ames!amdahl!nsc!voder!lynx!m5Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-tis!ames!amdahl!nsc!voder!lynx!m5 From: m5@lynx.UUCP (Mike McNally) Newsgroups: comp.sys.intel Subject: mov reg,imm32 Message-ID: <3889@lynx.UUCP> Date: 10 Jun 88 00:10:23 GMT Reply-To: m5@lynx.UUCP (Mike McNally) Distribution: na Organization: Lynx Real-Time Systems Inc, Campbell CA Lines: 18