Re: Linux, X, ld, gcc, linking, shared libraries and stuff
From: Herbert Kleebauer (klee_at_unibwm.de)
Date: 03/28/05
- Next message: Frank Kotler: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- Previous message: Jonathan Bartlett: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- In reply to: Betov: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- Next in thread: Frank Kotler: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- Reply: Frank Kotler: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- Reply: Betov: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- Reply: wolfgang kern: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 28 Mar 2005 22:19:52 +0200
Betov wrote:
> Herbert Kleebauer <klee@unibwm.de> écrivait news:4248167F.5263BD35
> > What code does RosAsm generate for a "mov eax,eax"
> > instruction:
> >
> > 89 c0 move.l r0,r0
> > 90 exg.l r0,r0
>
> It generates, of course the first form. You are
> confusing _Optimization_ and choice of the most
> appropriated encoding form.
??? To choose the most appropriate encoding for a given
task is optimization. I think, you mean that RosAsm does
optimization only within a single instruction (choose the
most appropriate encoding for a single instruction) but
does not optimize a sequence of instructions.
Therefore if you want to push a 10 onto the stack, RosAsm
uses:
6a 0a moveq.l #10,-(sp)
and not:
68 0000000a move.l #10,-(sp)
But that's illogical. In the example above (move the content
of register eax into eax) there is also just one instruction
with two different encoding
89 c0 move.l r0,r0
90 exg.l r0,r0
and RosAsm doesn't automatically choose the "most appropriated
encoding form".
Another example would be, if you want to sign extend the
content of ax to eax. There are also two encoding forms:
98 ext.l r0
0f bf c0 movs.wl r0,r0
Does RosAsm here automatically choose the "most appropriated
encoding form"? If not, why then in the "push" example?
I think, the real problem again is Intel. There are two different
move instructions, MOV moves a 32 bit source operand to 32 bit
destination whereas MOVSX takes a 8 bit source operand, sign
extends it to 32 bit and moves it to a 32 bit destination.
Exactly the same is true for push. There is a PUSH instruction
which takes a 32 immediate operand and pushes it onto the stack
and there is a PUSHSX instruction (a completely different
instruction as MOVSX is different from MOV) which takes a 8 bit
immediate operand, sign extends it to 32 bit an push it onto
the stack. The God Intel has chosen to use the same name PUSH
for this two different instructions. And as a religious man you
do exactly as your God tell you and also use the same name for
this different instructions (without wasting a single second
whether this makes any sense). But now you have a big problem:
With "PUSH 10" you are not able to decide which of the two
PUSH instruction should be used. NASM at least gives a workaround
by adding a "byte" before the immediate operand, but RosAsm
completely ignores the problem.
If Intel had chosen to use two different names for the
different instructions (PUSH and PUSHSX similar to MOV
and MOVSX), would RosAsm then also automatically convert a
"PUSH 10" to a "PUSHSX 10"?
- If not, then your PUSH solution has nothing to do with
2) RosAsm chooses the shortest of the available forms
when there are several equivalent one.
but only shows, that RosAsm (in opposite to NASM) isn't able
to solve the problem with the two different push instructions.
- If yes, then RosAsm also has to use the shortest of the
available forms for
89 c0 move.l r0,r0
90 exg.l r0,r0
or
98 ext.l r0
0f bf c0 movs.wl r0,r0
- Next message: Frank Kotler: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- Previous message: Jonathan Bartlett: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- In reply to: Betov: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- Next in thread: Frank Kotler: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- Reply: Frank Kotler: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- Reply: Betov: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- Reply: wolfgang kern: "Re: Linux, X, ld, gcc, linking, shared libraries and stuff"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|