This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [RFC PATCH, x86_64] Use -mno-sse[,2] to fall back to x87 FP argument passing convention


Hi, Uros. 

> I would like to present a kind of x86_64 ABI enhancement for FP types,
> where argument passing convention would follow x87 argument passing
> convention.

Honza has already chimed in that such idea would be better implemented much in the way of the sseregparm  attribute.

> where patched gcc -O2 -mno-sse [-mfpmath=387] would produce:
> test:
> .LFB2:
>         subq    $24, %rsp
> .LCFI0:
>         movabsq $4611686018427387904, %rax
>         movq    %rax, 8(%rsp)
>         movq    32(%rsp), %rax
>         movq    %rax, (%rsp)
>         call    atan2
>         fmuls   .LC1(%rip)
>         addq    $24, %rsp
>         ret

Woa!  Which atan2 () on x86-64 returns anything on %st?  Please, let's not go down the multilib route for this...
 
> But the real gain will be using -O2 -mno-sse [-mfpmath=387]
> -ffast-math where x87 builtins will be emitted:
> test:
> .LFB2:
>         flds    .LC0(%rip)
>         fldl    8(%rsp)
>         fxch    %st(1)
>         fpatan
>         fmuls   .LC1(%rip)
>         ret

Better???  x87's FPATAN is quite innacturate.

> I think that this would be a nice extension in comparison to an error
> that is currently emmited for -mno-sse. Please note, that complex
> numbers and decimal FP are not supported by attached patch.

I think that all this comes from the fact that the current GLIBC math transcendentals are generally inferior to x87.  I tried to correct that by offering other faster, more accurate routines, but their acceptance was stalled.

IMHO, such hurdles will be addressed by Richard Guenther's libgcc-math project for 4.3.  As I stated at the BOFS on it, I am ready to donate such routines and then we can revisit this issue, if it still stands.

Thanks,

-- 
_______________________________________________________
Evandro Menezes               AMD            Austin, TX




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]