List Info

Thread: 32-bit immediates in 64-bit mode




32-bit immediates in 64-bit mode
user name
2007-09-25 18:15:04
Well, bugger it all to heck.

It appears that 32-bit immediates are *sign*-extended in
64-bit mode,
rather than zero-extended, as moving into registers are
(sheesh, are we
confused yet?)

In other words,

	mov rax,dword foo	; 48 C7 C0 xx xx xx xx
	mov eax,foo		; B8 xx xx xx xx

... will produce different values if bit 31 of foo is set.

I'm still inclined to have "mov rax,foo" produce
the 64-bit form by
default, but it might make a stronger cause for having the
optimizer
handle relaxation of this form.

	mov rax,foo		; 48 B8 xx xx xx xx xx xx xx xx

Depending on the value of "foo", this 10-byte
instruction can be
converted to either a 5- or a 7-byte form.

I do want to know if this makes people have other opinions. 
Anyone
happens to know what MASM does about this?

	-hpa

------------------------------------------------------------
-------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nasm-devel mailing list
Nasm-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nasm-devel

Re: 32-bit immediates in 64-bit mode
user name
2007-09-26 03:38:00
> Anyone happens to know what MASM does about this?

Find a .lst file attached.

------------------------------------------------------------
-------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nasm-devel mailing list
Nasm-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nasm-devel

  
Re: 32-bit immediates in 64-bit mode
user name
2007-09-26 08:56:42
anonymous coward wrote:
>> Anyone happens to know what MASM does about this?
> 
> Find a .lst file attached.
> 

Okay, that's just *weird*... the only qword form it outputs
is the one
that is explicitly declared dword.  I guess it is a
Microsoft product...

	-hpa


------------------------------------------------------------
-------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nasm-devel mailing list
Nasm-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nasm-devel

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )