Should ghc -msse imply gcc -msse

Simon Marlow marlowsd at gmail.com
Thu Jan 17 21:29:01 CET 2013


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
> change his/her flags depending on if we use the native backend or the
> LLVM backend.

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.

If instead the intended meaning of -msse is

   Use SSE instructions in all compilations

then we should pass it to gcc too.  This just feels a bit too magical to 
me, and since we have a way to say exactly what you want, I'm not sure 
it's necessary.

Cheers,
	Simon




More information about the Glasgow-haskell-users mailing list