Opened 2 years ago

Closed 2 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 Revisions:

Description

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 2 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 2 years ago by tibbe

  • Owner set to simonmar

comment:2 Changed 2 years ago by tibbe

  • Status changed from new to patch

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 2 years ago by simonmar

  • difficulty set to Unknown
  • Owner simonmar deleted
  • Status changed from patch to new

Looks good to me.

comment:4 Changed 2 years ago by tibbe

  • Status changed from new to patch

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

comment:5 Changed 2 years ago by tibbe

  • Status changed from patch to merge

comment:6 Changed 2 years ago by igloo

  • Resolution set to fixed
  • Status changed from merge to closed

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

Note: See TracTickets for help on using tickets.