q extension with C compilers and libraries

83 views
Skip to first unread message

Michael Zoran

unread,
Nov 4, 2022, 9:47:13 AM11/4/22
to RISC-V SW Dev
Have anybody looked into adding the q extension to any of the standard C compilers such as gcc and clang?

I'm thinking that long double could use 128bit ieee floating point.

Christoph Müllner

unread,
Nov 4, 2022, 10:51:51 AM11/4/22
to Michael Zoran, RISC-V SW Dev
On Fri, Nov 4, 2022 at 2:47 PM Michael Zoran <mic...@michaelzoran.net> wrote:
>
> Have anybody looked into adding the q extension to any of the standard C compilers such as gcc and clang?

The RISC-V psABI document defines a corresponding ABI ("abi-lp64q").

GCC has support for quad precision floating-point processing, but the
RISC-V backend does not implement the required pieces.
Other backends (e.g. PowerPC or HP-UX) provide that.

I'm not aware of anyone working on RISC-V support in GCC.
If you plan to work on this, you could consider implementing QEMU
support or use the implementation in Spike, as I am not aware of any
RISC-V hardware that supports 128-bit floating point instructions.

> I'm thinking that long double could use 128bit ieee floating point.

The RISC-V psABI defines long double to be of 16 bytes (size and alignment).
That is also how it is implemented in GCC for e.g. PowerPC or HP-UX.
GCC also knows the type __float128 and uses that for its APIs in libquadmath.

BR
Christoph

Dennis Clarke

unread,
Nov 5, 2022, 6:27:24 AM11/5/22
to sw-...@groups.riscv.org
I fail to see how that would help at all. There is no hardware
anywhere that supports the IEE754-2008 datatypes other than IBM POWER9
and POWER10 in addition to IBM Mainframes. Everything else just uses a
software emulation of some sort. Everything x86 is just plain broken
with a strange 80-bit format. Older IBM ppc64 hardware will have the
equally borked fp64 + fp64 concatonation of two 8-byte floating point
datatypes to get a bizarre 128-bit mess with entirely too many bits lost
to exponent and sign bits. At least the RISC-V has a IEEE754-2008 proper
specification but it may be a long time ( forever? ) before you ever see
actual hardware implementation. If you can spare half a billion dollars
then I am sure a 7nm fab could be done.


--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional
Reply all
Reply to author
Forward
0 new messages