Re: CVS commit: src/sys/arch

2014-02-05 Thread Joerg Sonnenberger
On Wed, Feb 05, 2014 at 11:43:21PM +, David Laight wrote:
> On Wed, Feb 05, 2014 at 03:09:59PM -0800, Matt Thomas wrote:
> > 
> > >> 
> > >> This breaks clang. Please do not depend on one SSE option disabling
> > >> another.
> > > 
> > > Without those flags I believe gcc might generate x87 instructions.
> > > Quite possibly even for amd64.
> > > See a very recent linux fix.
> > > Try searching for: Disable generation of traditional x87 instructions
> > 
> > I think Joerg is saying put in -mno-sse2 since that is not disabled
> > by -mno-sse when using clang.
> 
> with the gcc I'm looking at (if I'm reading to code properly):
> no-sse => no-sse2 => no-sse3 => no-ssse3 & no-sse4a => no-sse4_1
> => no-sse4_2 => no-avx => no-fma => no-fma4

While I mostly believe that -mno-sse will imply -mno-sse2, it is the one
I want to be explicit about since it is default feature of the amd64
platform.

Joerg


Re: CVS commit: src/sys/arch

2014-02-05 Thread Matt Thomas

On Feb 5, 2014, at 3:43 PM, David Laight  wrote:

> On Wed, Feb 05, 2014 at 03:09:59PM -0800, Matt Thomas wrote:
>> 
 
 This breaks clang. Please do not depend on one SSE option disabling
 another.
>>> 
>>> Without those flags I believe gcc might generate x87 instructions.
>>> Quite possibly even for amd64.
>>> See a very recent linux fix.
>>> Try searching for: Disable generation of traditional x87 instructions
>> 
>> I think Joerg is saying put in -mno-sse2 since that is not disabled
>> by -mno-sse when using clang.
> 
> with the gcc I'm looking at (if I'm reading to code properly):
> no-sse => no-sse2 => no-sse3 => no-ssse3 & no-sse4a => no-sse4_1
> => no-sse4_2 => no-avx => no-fma => no-fma4

But clang is not gcc. :)

> You either need all of them, and the one that the next sub-version
> of the cpu/compiler add, or you assume that the first ones imply the
> latter - at least to some degree.

From llvm/dist/llvm/lib/Target/X86/X86.td:

// All x86-64 hardware has SSE2, but we don't mark SSE2 as an implied
// feature, because SSE2 can be disabled (e.g. for compiling OS kernels)
// without disabling 64-bit mode.



Re: CVS commit: src/sys/arch

2014-02-05 Thread David Laight
On Wed, Feb 05, 2014 at 03:09:59PM -0800, Matt Thomas wrote:
> 
> >> 
> >> This breaks clang. Please do not depend on one SSE option disabling
> >> another.
> > 
> > Without those flags I believe gcc might generate x87 instructions.
> > Quite possibly even for amd64.
> > See a very recent linux fix.
> > Try searching for: Disable generation of traditional x87 instructions
> 
> I think Joerg is saying put in -mno-sse2 since that is not disabled
> by -mno-sse when using clang.

with the gcc I'm looking at (if I'm reading to code properly):
no-sse => no-sse2 => no-sse3 => no-ssse3 & no-sse4a => no-sse4_1
=> no-sse4_2 => no-avx => no-fma => no-fma4

You either need all of them, and the one that the next sub-version
of the cpu/compiler add, or you assume that the first ones imply the
latter - at least to some degree.

David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/sys/arch

2014-02-05 Thread Matt Thomas

On Feb 5, 2014, at 3:06 PM, David Laight  wrote:

> On Wed, Feb 05, 2014 at 11:09:05PM +0100, Joerg Sonnenberger wrote:
>> On Wed, Feb 05, 2014 at 06:52:22PM +, David Laight wrote:
>>> Module Name:src
>>> Committed By:   dsl
>>> Date:   Wed Feb  5 18:52:22 UTC 2014
>>> 
>>> Modified Files:
>>> src/sys/arch/amd64/conf: Makefile.amd64
>>> src/sys/arch/i386/conf: Makefile.i386
>>> 
>>> Log Message:
>>> Change the compiler options to explicitly specify:
>>>  -mno-mmx -mno-sse -mno-avx -mno-80387 -mno-fp-ret-in-387
>>> Since no-sse implies no-sse2 that should ensure that the compiler really
>>>  doesn't emit any instructions that might trap trying to use the FPU.
>>> On amd64 at least some of those are needed to stop the compiler
>>>  saving the registers to stack on every varargs function.
>>> It might be that -mno-sse did that before.
>> 
>> This breaks clang. Please do not depend on one SSE option disabling
>> another.
> 
> Without those flags I believe gcc might generate x87 instructions.
> Quite possibly even for amd64.
> See a very recent linux fix.
> Try searching for: Disable generation of traditional x87 instructions

I think Joerg is saying put in -mno-sse2 since that is not disabled
by -mno-sse when using clang.


Re: CVS commit: src/sys/arch

2014-02-05 Thread David Laight
On Wed, Feb 05, 2014 at 11:09:05PM +0100, Joerg Sonnenberger wrote:
> On Wed, Feb 05, 2014 at 06:52:22PM +, David Laight wrote:
> > Module Name:src
> > Committed By:   dsl
> > Date:   Wed Feb  5 18:52:22 UTC 2014
> > 
> > Modified Files:
> > src/sys/arch/amd64/conf: Makefile.amd64
> > src/sys/arch/i386/conf: Makefile.i386
> > 
> > Log Message:
> > Change the compiler options to explicitly specify:
> >   -mno-mmx -mno-sse -mno-avx -mno-80387 -mno-fp-ret-in-387
> > Since no-sse implies no-sse2 that should ensure that the compiler really
> >   doesn't emit any instructions that might trap trying to use the FPU.
> > On amd64 at least some of those are needed to stop the compiler
> >   saving the registers to stack on every varargs function.
> > It might be that -mno-sse did that before.
> 
> This breaks clang. Please do not depend on one SSE option disabling
> another.

Without those flags I believe gcc might generate x87 instructions.
Quite possibly even for amd64.
See a very recent linux fix.
Try searching for: Disable generation of traditional x87 instructions

David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/sys/arch

2014-02-05 Thread Joerg Sonnenberger
On Wed, Feb 05, 2014 at 06:52:22PM +, David Laight wrote:
> Module Name:  src
> Committed By: dsl
> Date: Wed Feb  5 18:52:22 UTC 2014
> 
> Modified Files:
>   src/sys/arch/amd64/conf: Makefile.amd64
>   src/sys/arch/i386/conf: Makefile.i386
> 
> Log Message:
> Change the compiler options to explicitly specify:
>   -mno-mmx -mno-sse -mno-avx -mno-80387 -mno-fp-ret-in-387
> Since no-sse implies no-sse2 that should ensure that the compiler really
>   doesn't emit any instructions that might trap trying to use the FPU.
> On amd64 at least some of those are needed to stop the compiler
>   saving the registers to stack on every varargs function.
> It might be that -mno-sse did that before.

This breaks clang. Please do not depend on one SSE option disabling
another.

Joerg