Re: SSE2 instructions emitted in libcompiler_rt

2017-09-08 Thread Patrick Wildt
On Fri, Sep 08, 2017 at 10:15:25AM -0700, Mike Larkin wrote:
> On Thu, Sep 07, 2017 at 06:52:34PM +0200, Christian Weisgerber wrote:
> > Christian Weisgerber:
> > 
> > > > Maybe this would already help?  Would at least not throw stones into the
> > > > way of the next person doing an upgrade of compiler-rt...
> > > -snip-
> > > 
> > > Yes, that's better... but errors out:
> > > make: don't know how to make floatdixf.c.c (prerequisite of: 
> > > floatdixf.c.o)
> > 
> > Oh, it's a typo.  The fixed version looks fine to me.
> > However, I don't know how to test that these functions actually work.
> > 
> > Index: Makefile
> > ===
> > RCS file: /cvs/src/lib/libcompiler_rt/Makefile,v
> > retrieving revision 1.9
> > diff -u -p -r1.9 Makefile
> > --- Makefile4 Aug 2017 12:00:59 -   1.9
> > +++ Makefile7 Sep 2017 16:47:31 -
> > @@ -89,17 +89,11 @@ GEN_SRCS=   absvdi2 \
> > fixunsxfti \
> > fixxfdi \
> > fixxfti \
> > -   floatdidf \
> > -   floatdisf \
> > -   floatdixf \
> > floatsidf \
> > floatsisf \
> > floattidf \
> > floattisf \
> > floattixf \
> > -   floatundidf \
> > -   floatundisf \
> > -   floatundixf \
> > floatunsidf \
> > floatunsisf \
> > floatuntidf \
> > @@ -164,6 +158,22 @@ GEN_SRCS=  absvdi2 \
> > umoddi3 \
> > umodsi3 \
> > umodti3
> > +
> > +.if ${RTARCH} == "i386"
> > +SRCS+= floatdidf.c \
> > +   floatdisf.c \
> > +   floatdixf.c \
> > +   floatundidf.c \
> > +   floatundisf.c \
> > +   floatundixf.c
> > +.else
> > +GEN_SRCS+= floatdidf \
> > +   floatdisf \
> > +   floatdixf \
> > +   floatundidf \
> > +   floatundisf \
> > +   floatundixf
> > +.endif
> >  
> >  .for file in ${GEN_SRCS}
> >  .  if exists(${.CURDIR}/${RTARCH}/${file}.S)
> > -- 
> > Christian "naddy" Weisgerber  na...@mips.inka.de
> > 
> 
> ok mlarkin if you want to head this way. Thanks for the later verification
> that these don't appear to be used on i386 base anyway.
> 

ok patrick as well



Re: SSE2 instructions emitted in libcompiler_rt

2017-09-07 Thread Christian Weisgerber
Christian Weisgerber:

> > Maybe this would already help?  Would at least not throw stones into the
> > way of the next person doing an upgrade of compiler-rt...
> -snip-
> 
> Yes, that's better... but errors out:
> make: don't know how to make floatdixf.c.c (prerequisite of: floatdixf.c.o)

Oh, it's a typo.  The fixed version looks fine to me.
However, I don't know how to test that these functions actually work.

Index: Makefile
===
RCS file: /cvs/src/lib/libcompiler_rt/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- Makefile4 Aug 2017 12:00:59 -   1.9
+++ Makefile7 Sep 2017 16:47:31 -
@@ -89,17 +89,11 @@ GEN_SRCS=   absvdi2 \
fixunsxfti \
fixxfdi \
fixxfti \
-   floatdidf \
-   floatdisf \
-   floatdixf \
floatsidf \
floatsisf \
floattidf \
floattisf \
floattixf \
-   floatundidf \
-   floatundisf \
-   floatundixf \
floatunsidf \
floatunsisf \
floatuntidf \
@@ -164,6 +158,22 @@ GEN_SRCS=  absvdi2 \
umoddi3 \
umodsi3 \
umodti3
+
+.if ${RTARCH} == "i386"
+SRCS+= floatdidf.c \
+   floatdisf.c \
+   floatdixf.c \
+   floatundidf.c \
+   floatundisf.c \
+   floatundixf.c
+.else
+GEN_SRCS+= floatdidf \
+   floatdisf \
+   floatdixf \
+   floatundidf \
+   floatundisf \
+   floatundixf
+.endif
 
 .for file in ${GEN_SRCS}
 .  if exists(${.CURDIR}/${RTARCH}/${file}.S)
-- 
Christian "naddy" Weisgerber  na...@mips.inka.de



Re: SSE2 instructions emitted in libcompiler_rt

2017-09-07 Thread Christian Weisgerber
Patrick Wildt:

> Maybe this would already help?  Would at least not throw stones into the
> way of the next person doing an upgrade of compiler-rt...
-snip-

Yes, that's better... but errors out:

make: don't know how to make floatdixf.c.c (prerequisite of: floatdixf.c.o)

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de



Re: SSE2 instructions emitted in libcompiler_rt

2017-09-06 Thread Mike Larkin
On Wed, Sep 06, 2017 at 11:54:38PM +0200, Patrick Wildt wrote:
> On Wed, Sep 06, 2017 at 11:43:15PM +0200, Christian Weisgerber wrote:
> > Somebody noticed this on FreeBSD:
> > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221733
> > 
> > On i386, libcompiler_rt includes assembly implementations for
> > floating point conversion functions that unconditionally use SSE2
> > instructions, which are not supported by older CPUs.  Specifically,
> > these files:
> > 
> > floatdidf.S
> > floatdisf.S
> > floatdixf.S
> > floatundidf.S
> > floatundisf.S
> > floatundixf.S
> > 
> > We need to use the generic C implementation instead.  The way the
> > Makefile is currently set up, I guess we would just delete the
> > affected files under lib/libcompiler_rt/i386/?
> > 
> > -- 
> > Christian "naddy" Weisgerber  na...@mips.inka.de
> > 
> 
> Maybe this would already help?  Would at least not throw stones into the
> way of the next person doing an upgrade of compiler-rt...
> 
> Patrick
> 
> diff --git a/lib/libcompiler_rt/Makefile b/lib/libcompiler_rt/Makefile
> index f82c8156c2f..070b6e7cbde 100644
> --- a/lib/libcompiler_rt/Makefile
> +++ b/lib/libcompiler_rt/Makefile
> @@ -89,17 +89,11 @@ GEN_SRCS= absvdi2 \
>   fixunsxfti \
>   fixxfdi \
>   fixxfti \
> - floatdidf \
> - floatdisf \
> - floatdixf \
>   floatsidf \
>   floatsisf \
>   floattidf \
>   floattisf \
>   floattixf \
> - floatundidf \
> - floatundisf \
> - floatundixf \
>   floatunsidf \
>   floatunsisf \
>   floatuntidf \
> @@ -165,6 +159,22 @@ GEN_SRCS=absvdi2 \
>   umodsi3 \
>   umodti3
>  
> +.if ${RTARCH} == "i386"
> +SRCS+=   floatdidf.c \
> + floatdisf.c \
> + floatdixf.c.c \
> + floatundidf.c \
> + floatundisf.c \
> + floatundixf.c
> +.else
> +GEN_SRCS+=   floatdidf \
> + floatdisf \
> + floatdixf \
> + floatundidf \
> + floatundisf \
> + floatundixf
> +.endif
> +
>  .for file in ${GEN_SRCS}
>  .if exists(${.CURDIR}/${RTARCH}/${file}.S)
>  SRCS+=   ${file}.S
> 

this looks ok to me. I can run at least a build test later, but I don't
have any hardware that lacks these instructions.

-ml



Re: SSE2 instructions emitted in libcompiler_rt

2017-09-06 Thread Mike Larkin
On Wed, Sep 06, 2017 at 11:43:15PM +0200, Christian Weisgerber wrote:
> Somebody noticed this on FreeBSD:
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221733
> 
> On i386, libcompiler_rt includes assembly implementations for
> floating point conversion functions that unconditionally use SSE2
> instructions, which are not supported by older CPUs.  Specifically,
> these files:
> 
> floatdidf.S
> floatdisf.S
> floatdixf.S
> floatundidf.S
> floatundisf.S
> floatundixf.S
> 
> We need to use the generic C implementation instead.  The way the
> Makefile is currently set up, I guess we would just delete the
> affected files under lib/libcompiler_rt/i386/?
> 
> -- 
> Christian "naddy" Weisgerber  na...@mips.inka.de
> 

Removing sse2 instructions on i386 seems to be the right thing to do.
Whether or not it's a simple makefile change or removing files from
libcompiler_rt/i386, I'm not sure.

Did you try to remove these files and did it work?

-ml



Re: SSE2 instructions emitted in libcompiler_rt

2017-09-06 Thread Patrick Wildt
On Wed, Sep 06, 2017 at 11:43:15PM +0200, Christian Weisgerber wrote:
> Somebody noticed this on FreeBSD:
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221733
> 
> On i386, libcompiler_rt includes assembly implementations for
> floating point conversion functions that unconditionally use SSE2
> instructions, which are not supported by older CPUs.  Specifically,
> these files:
> 
> floatdidf.S
> floatdisf.S
> floatdixf.S
> floatundidf.S
> floatundisf.S
> floatundixf.S
> 
> We need to use the generic C implementation instead.  The way the
> Makefile is currently set up, I guess we would just delete the
> affected files under lib/libcompiler_rt/i386/?
> 
> -- 
> Christian "naddy" Weisgerber  na...@mips.inka.de
> 

Maybe this would already help?  Would at least not throw stones into the
way of the next person doing an upgrade of compiler-rt...

Patrick

diff --git a/lib/libcompiler_rt/Makefile b/lib/libcompiler_rt/Makefile
index f82c8156c2f..070b6e7cbde 100644
--- a/lib/libcompiler_rt/Makefile
+++ b/lib/libcompiler_rt/Makefile
@@ -89,17 +89,11 @@ GEN_SRCS=   absvdi2 \
fixunsxfti \
fixxfdi \
fixxfti \
-   floatdidf \
-   floatdisf \
-   floatdixf \
floatsidf \
floatsisf \
floattidf \
floattisf \
floattixf \
-   floatundidf \
-   floatundisf \
-   floatundixf \
floatunsidf \
floatunsisf \
floatuntidf \
@@ -165,6 +159,22 @@ GEN_SRCS=  absvdi2 \
umodsi3 \
umodti3
 
+.if ${RTARCH} == "i386"
+SRCS+= floatdidf.c \
+   floatdisf.c \
+   floatdixf.c.c \
+   floatundidf.c \
+   floatundisf.c \
+   floatundixf.c
+.else
+GEN_SRCS+= floatdidf \
+   floatdisf \
+   floatdixf \
+   floatundidf \
+   floatundisf \
+   floatundixf
+.endif
+
 .for file in ${GEN_SRCS}
 .  if exists(${.CURDIR}/${RTARCH}/${file}.S)
 SRCS+= ${file}.S



SSE2 instructions emitted in libcompiler_rt

2017-09-06 Thread Christian Weisgerber
Somebody noticed this on FreeBSD:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221733

On i386, libcompiler_rt includes assembly implementations for
floating point conversion functions that unconditionally use SSE2
instructions, which are not supported by older CPUs.  Specifically,
these files:

floatdidf.S
floatdisf.S
floatdixf.S
floatundidf.S
floatundisf.S
floatundixf.S

We need to use the generic C implementation instead.  The way the
Makefile is currently set up, I guess we would just delete the
affected files under lib/libcompiler_rt/i386/?

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de