Johan Tibell | 10 Jan 23:10 2013
Picon

Should ghc -msse imply gcc -msse

Hi all,

You can turn on e.g. SSE 4.1 by passing -msse4.2 to ghc. This doesn't
currently imply that we compile any C code with -msse4.2 turned on, so
if someone really want to use SSE4.2, they have to do:

    ghc -msse4,2 -optc-msse4.2

Do we want to change this so it's enough to pass -msse4.2 to ghc?

-- Johan
Conrad Parker | 11 Jan 02:00 2013

Re: Should ghc -msse imply gcc -msse

On 11 January 2013 06:10, Johan Tibell <johan.tibell <at> gmail.com> wrote:
> Hi all,
>
> You can turn on e.g. SSE 4.1 by passing -msse4.2 to ghc. This doesn't
> currently imply that we compile any C code with -msse4.2 turned on, so
> if someone really want to use SSE4.2, they have to do:
>
>     ghc -msse4,2 -optc-msse4.2
>
> Do we want to change this so it's enough to pass -msse4.2 to ghc?

+1, I'd expect the flag to affect all compiled code (I'd be passing
-msse4.2 to make it go faster).

If anyone really wanted the C code to be compiled without (perhaps for
debugging the code generator), they could run something like:

  ghc -msse4,2 -optc-no-msse4.2

Conrad.
Johan Tibell | 17 Jan 21:01 2013
Picon

Re: Should ghc -msse imply gcc -msse

Hi all,

I forgot I once raised this on the GHC bug tracker:
http://hackage.haskell.org/trac/ghc/ticket/7025

Here's what Simon M had to say back then:

"The right thing is to put -msse in the cc-options field of your
.cabal file, if that's what you want.

I'm distinctly uneasy about having -msse magically pass through to gcc.

* There are many flags that we do not pass through to gcc, so having
one that we do pass through could be confusing (and lead to lots more
requests for more flags to be passed through)

* What if there is a variant of -msse that gcc supports but we don't?
Wouldn't we have to keep them in sync?

I'm going to close this as wontfix, but please feel free to reopen and
disagree."
Johan Tibell | 17 Jan 21:06 2013
Picon

Re: Should ghc -msse imply gcc -msse

On Thu, Jan 17, 2013 at 12:01 PM, Johan Tibell <johan.tibell <at> gmail.com> wrote:
> I forgot I once raised this on the GHC bug tracker:
> http://hackage.haskell.org/trac/ghc/ticket/7025
>
> Here's what Simon M had to say back then:
>
> "The right thing is to put -msse in the cc-options field of your
> .cabal file, if that's what you want.
>
> I'm distinctly uneasy about having -msse magically pass through to gcc.
>
> * There are many flags that we do not pass through to gcc, so having
> one that we do pass through could be confusing (and lead to lots more
> requests for more flags to be passed through)
>
> * What if there is a variant of -msse that gcc supports but we don't?
> Wouldn't we have to keep them in sync?
>
> I'm going to close this as wontfix, but please feel free to reopen and
> disagree."

One problem with having the user set cc-options in addition to passing
-msse to GHC, is that the user might not realize that he/she needs to
do this. This is bad if you use -fllvm, as your -msse will essentially
just be ignored as the LLVM primitives we use in the LLVM backend
(e.g. for popcnt) won't convert to SSE instructions.

Even worse, LLVM doesn't support a -msse flag, instead you need to use
-mattr=+sse, so the user needs to be aware of this difference and
change his/her flags depending on if we use the native backend or the
(Continue reading)

Simon Marlow | 17 Jan 21:29 2013
Picon

Re: Should ghc -msse imply gcc -msse

On 17/01/13 20:06, Johan Tibell wrote:
> On Thu, Jan 17, 2013 at 12:01 PM, Johan Tibell <johan.tibell <at> gmail.com> wrote:
>> I forgot I once raised this on the GHC bug tracker:
>> http://hackage.haskell.org/trac/ghc/ticket/7025
>>
>> Here's what Simon M had to say back then:
>>
>> "The right thing is to put -msse in the cc-options field of your
>> .cabal file, if that's what you want.
>>
>> I'm distinctly uneasy about having -msse magically pass through to gcc.
>>
>> * There are many flags that we do not pass through to gcc, so having
>> one that we do pass through could be confusing (and lead to lots more
>> requests for more flags to be passed through)
>>
>> * What if there is a variant of -msse that gcc supports but we don't?
>> Wouldn't we have to keep them in sync?
>>
>> I'm going to close this as wontfix, but please feel free to reopen and
>> disagree."
>
> One problem with having the user set cc-options in addition to passing
> -msse to GHC, is that the user might not realize that he/she needs to
> do this. This is bad if you use -fllvm, as your -msse will essentially
> just be ignored as the LLVM primitives we use in the LLVM backend
> (e.g. for popcnt) won't convert to SSE instructions.
>
> Even worse, LLVM doesn't support a -msse flag, instead you need to use
> -mattr=+sse, so the user needs to be aware of this difference and
(Continue reading)

Johan Tibell | 17 Jan 22:09 2013
Picon

Re: Should ghc -msse imply gcc -msse

On Thu, Jan 17, 2013 at 12:29 PM, Simon Marlow <marlowsd <at> gmail.com> wrote:
> If the intended meaning of -msse is
>
>   Use SSE instructions in Haskell compilations
>
> then of course we should pass -mattr=+sse to LLVM, because it is the backend
> for Haskell compilations.  But we should not pass it to gcc, unless we're
> using the C backend.

Lets do at least this then.

-- Johan

Gmane