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

Re: Atlas: Help with s390 ASM



Sylvestre Ledru wrote:
> Good question... I can try to do that. I was just trying to match the
> current upstream behavior first.
>

Ok did this :

************
int foo(i)
{
        return i*3;
}
************

Compiled this with :

gcc -O3 foo.c -S -o foo.s

which yields :

************
        .file   "foo.c"
.text
        .align  4
.globl foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        lr      %r1,%r2
        sll     %r1,1
        ar      %r2,%r1
        br      %r14
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .ident  "GCC: (Debian 4.4.2-5) 4.4.2"
        .section        .note.GNU-stack,"",@progbits
************

(apparently, GCC optimizer says that 3x=2x+x is the best way..)

That being said, and with the s390 ABI giving parm 1 in R2, returning R2, R1 being expandable and R14 being the return address there are several possibilities...
	lr	%r1,%r2
	ar	%r2,%r1
	ar	%r2,%r1
	br	%r14
would probably also work (3x=x+x+x)

The 64 bit version (s390x) - with gcc -m64 adds a 32 bit truncation..

        lr      %r1,%r2
        sll     %r1,1
        ar      %r1,%r2
        lgfr    %r2,%r1
        br      %r14

You will probably also need to tweak your atlas_asm.h - and add a case for ATL_GAS_S390 - I don't know what it does, but if it is some function decoration, it *may* be ABI dependent (not sure.. but checking wouldn't hurt).

--Ivan

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Reply to: