[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] next gcc tests: vsprintf.s



On Thu, Dec 19, 2002 at 02:54:59AM +0100, devik wrote:
> Hi,
> 
> I added output of latest gcc compilation
> of vsprintf.c. I repaired most of things
> reported by MR.
> 
> devik

As printed some error messages. In detail:

> ; F-CPU ASM by devik@cdi.cz

Similar to gcc, my assembler uses `;' to separate instructions on a
single line. Please use `//' for comments. Or rather, use something
like

	.comment "F-CPU ASM by devik@cdi.cz"

if the comment should appear in the object file :)

> .text
> .extern simple_strtoul
> simple_strtoul:
> 	dmove r2,r5,r3,r10

There is no dmove.

> 	move.64 r0,r6
> 	jmp_direct_nz r4,@L2

Gcc normally uses the `.L' prefix for local labels, which is
compatible with ELF linkers. `@' is used for other purposes.
You may also use the `0f'/`0b' syntax for local labels:

	blah $0f
	blubb
0:

> 	loadcons.32 $10,r4

There is loadcons.[0-3], but no loadcons.32. If you want to fill the
entire register, use `loadconsx.0 $10, r4' in this case.

> 	load.8 [r2],r1

Square brackets are no valid characters.
`load.8 r2, r1' would be correct.

> 	xor.ori.8 $48,r1,r1

That instruction doesn't exist (combine instructions have no immediate
mode - and if they had one, it would be `xori.or.8' instead).

> 	jmp_direct_nz r1,@L2

It's not perfect, but

	loadaddri $label-.-4, tmpreg
	jmpnz r1, tmpreg

would be the correct way to do a (short) jump. Unfortunately, there is
a slight chance that the target is too far away for loadaddri; if
you're not sure, better use the long sequence

	loadconsx $label-.-20, tmpreg	// 4 instructions!
	loadaddr tmpreg, tmpreg
	jmpnz r1, tmpreg

The immediate constant MUST match the distance between the address of
loadconsx and the address *after* loadaddr. I know it's ugly, but there
currently is no other way.

[...]
> 	loadcons.64 $_ctype,r2

If you load an address, skip the size suffix: `loadcons $_ctype, r2'.
As will output the full 4-instruction loadcons sequence and add
relocs for the symbol.

> 	add.64 r2,r1,r1
> 	load.8 [r1],r1
> 	andi.8 $68,r1,r1

AFAIK, there is no size suffix with immediate logic operations, except
in SIMD mode. Yann?

[...]
> 	cmove.8 r1,r3,r2

It's called move{condition}, where {condition} is one of `[n]z', `[n]l',
`[n]m', `.[not]zero', `.[not]lsb' or `.[not]msb'.

> 	subi.32 55,r2,r2

Should be `$55'.

[...]
> 	jmp ra

ra := r63

> 	store $-8,sp,r63

sp := r62

[...]
> @LC0:
> 	.ascii "0123456789abcdefghijklmnopqrstuvwxyz\0"

If you use `.string' or `.asciz', as will add the trailing '\0'.

[...]
> 	nxor.andi.32 $0,r1,r1

Unknown. And it's called `xnor' BTW.

-- 
 Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
 "All I wanna do is have a little fun before I die"
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/