Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 16 Apr 2020 12:34:45 -0400
From: 'Rich Felker' <dalias@...c.org>
To: sidneym@...eaurora.org
Cc: musl@...ts.openwall.com
Subject: Re: Hexagon DSP support

On Thu, Apr 16, 2020 at 11:26:52AM -0500, sidneym@...eaurora.org wrote:
> 
> 
> > -----Original Message-----
> > From: Rich Felker <dalias@...c.org>
> > Sent: Thursday, April 16, 2020 10:34 AM
> > To: sidneym@...eaurora.org; musl@...ts.openwall.com
> > Subject: Re: [musl] Hexagon DSP support
> > 
> > On Thu, Apr 16, 2020 at 11:36:38AM +0200, Szabolcs Nagy wrote:
> > > * sidneym@...eaurora.org <sidneym@...eaurora.org> [2020-04-15
> > 13:22:29 -0500]:
> > > > > sqrt/sqrtf should work too (you may want to implement them if
> > > > > there is a single instruction) other math failures are not target
> specific.
> > > >
> > > > In fact that does go away if I used the hardware accelerated routine
> that
> > is
> > > > part of compiler-rt.builtins (__hexagon_sqrt)   Creating an explicit
> > > > reference to compiler-rt-builtins vs just copying the assembly,
> > > > which is preferred?
> > >
> > > the preferred is like on other targets an inline asm block.
> > > i think using __builtin_sqrt may be fine too if you know that all
> > > hexagon compilers support that and doesnt generate an actual sqrt call
> > > (e.g. on gcc that needs -fno-math-errno).
> > 
> > __builtin_sqrt is explicitly allowed to compile to an external call to
> sqrt (at
> > compiler discretion), and thus can't be used to implement the sqrt
> function.
> > If you're implementing a native sqrt it should be inline asm. But the C
> sqrt
> > should work too. If it's not working that indicates a bug in the compiler,
> in the
> > code in musl, or in qemu, and whichever it is we should track that down
> and
> > get it fixed.
> 
> I will add the assembly version for sqrt. There was an issue in qemu when
> using the assembly version but that is fixed.  FWIW when I use the soft
> version with clang for hexagon I still see errors, mostly looking for
> INEXACT but not seeing it.

I saw errors that were actual incorrect results not just wrong
exception flags, like:

src/math/ucb/sqrt.h:49: RU sqrt(0x1.fffffffffffffp+1023) want 0x1p+512 got 0x1.fffffffffffffp+511 ulperr -0.250 = -0x1p-1 + 0x1p-2

At least they all seemed to be in non-default rounding modes though so
the impact is low-ish. These are probably all qemu bugs but hard to
say for sure...

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.