[RFC PATCH, ia64]: Do not convert XF to TF in mulxc and divxc libgcc functions

Uros Bizjak ubizjak@gmail.com
Wed Sep 12 07:38:00 GMT 2007


Hello!

I was going through my mail archives and found this RFC patch, we were
discussing with Steve Ellcey some time ago. I think that this patch
can be of some interest also to other readers.

The patch proposes a (partial) solution to get XF<->TF conversions out
of mulxc and divxc routines by adding a couple of __builtin_..._w
80bit intrinsics. Similar solution was implemented in x86_64 to
support TFmode multc and divtc routines.

(I hope that Steve doesn't mind to make a part of private conversation
public, but it is purelly technical stuff after all).

Uros.

---------- Forwarded message ----------
From: Uros Bizjak <ubizjak@gmail.com>
Date: Jun 19, 2007 8:39 AM
Subject: Re: Patch to (partially) fix IA64 HP-UX bootstrap
To: Steve Ellcey <sje@cup.hp.com>


On 6/19/07, Steve Ellcey <sje@cup.hp.com> wrote:

> It looks like mulxc has about 12 calls to __builtin_copysignl which will
> cause a XF to TF conversion and 2 calls to __builtin_infl.  Not all of
> these will get called in any given execution path.
>
> divxc3 has 2 calls to __builtin_fabsl, 4 to __builtin_infl, and 6 to
> __builtin_copysignl.
>
> Not ideal, but I don't think there are any 80 bit builtin XF routines I
> can call instead.  Don't the builtins only support float, double, and
> long double types?  That is my impression from builtins.def.

In x86_64-linux, we have just opposite case. __builtin_..._l routines
are 80bit XFmode, and we want 128 bit TFmode ones. However, the
solution can be similar for both cases:

1) You should remove #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80, as
__builtin_..._l functions are 128 bit in your case.

2) Create missing builtins in target-dependant fashion (there are only
3 of them, give them 'w' suffix, __builtin_infw, __builtin_absw,
__builtin_copysignw). Please look in [1], how this was done for x86_64
(128bit versions were added in x86_64, you need 80 bit ones).

3) Enable XFmodes similar to the solution in [2]. You need to enable
XFmode libgcc functions by defining LIBGCC2_HAS_XF_MODE and XF_SIZE,
not by hacking on LIBGCC2_LONG_DOUBLE_TYPE_SIZE, something like
(untested) attached patch, and since your correct
LIBGCC2_LONG_DOUBLE_TYPE_SIZE is 128, this patch will cause all
(three...) buitlins to be defined from LIBGCC2_TF_CEXT  as
__builtin_..._w.

[1] http://gcc.gnu.org/ml/gcc-patches/2007-06/msg00442.html
[2] http://gcc.gnu.org/ml/gcc-patches/2007-06/msg00997.html

HTH,
Uros.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ia64-libgcc.diff
Type: application/octet-stream
Size: 1707 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070912/7575e984/attachment.obj>


More information about the Gcc-patches mailing list