Opened 5 years ago

Closed 5 years ago

#7554 closed feature request (fixed)

Define __SSE__ when compiling with -msse

Reported by: tibbe Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


The hashable package needs to know if GHC was invoked with -msse4.1 so it can call out to faster C code in that case. I'd like to propose that GHC provides the following defines when running the preprocessor:

## If SSE is turned on at all:
#define __SSE__ 1

## Only with -msse2 and up:
#define __SSE2__ 1

## Only with -msse4.1 and up:
#define __SSE4_1__ 1

This behavior is consistent with GCC.

Note that on some platforms SSE2 might be enabled by default and so should the defines.

Attachments (1)

0001-Add-preprocessor-defines-when-SSE-is-enabled.patch (5.0 KB) - added by tibbe 5 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 5 years ago by tibbe

Owner: set to simonmar

comment:2 Changed 5 years ago by tibbe

Status: newpatch

Simon M, as I removed a 'panic' you added to the code, could you please review? My rationale for removing it is that if the X86 codegen is run and the architecture is not X86, we have bigger problems and we should check that elsewhere (if at all).

comment:3 Changed 5 years ago by simonmar

difficulty: Unknown
Owner: simonmar deleted
Status: patchnew

Looks good to me.

comment:4 Changed 5 years ago by tibbe

Status: newpatch

I managed to break my OS X install completely. Could someone else please merge?

comment:5 Changed 5 years ago by tibbe

Status: patchmerge

comment:6 Changed 5 years ago by igloo

Resolution: fixed
Status: mergeclosed

Interface change, so not suitable for merging to stable branch.

Note: See TracTickets for help on using tickets.