Skip to content

Commit

Permalink
set a min target architecture of pentium4 to require support for sse2…
Browse files Browse the repository at this point in the history
… and _mm_pause
  • Loading branch information
vtjnash committed Oct 7, 2015
1 parent 1b41d64 commit 930e6b5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ before_install:
sudo add-apt-repository ppa:staticfloat/julia-deps -y;
sudo apt-get update -qq -y;
if [ "$ARCH" = "i686" ]; then
export BUILDOPTS="$BUILDOPTS MARCH=pentium4";
sudo apt-get remove libblas3gf liblapack3gf libarmadillo2 -y;
sudo apt-get install binutils:i386 -y;
sudo apt-get install gcc:i386 g++:i386 make:i386 cpp:i386 g++-4.6:i386 gcc-4.6:i386 libssl-dev:i386 patchelf:i386 gfortran:i386 llvm-3.3-dev:i386 libsuitesparse-dev:i386 libopenblas-dev:i386 libopenblas-base:i386 libblas-dev:i386 liblapack-dev:i386 liblapack3:i386 libarpack2-dev:i386 libarpack2:i386 libfftw3-dev:i386 libgmp-dev:i386 libpcre3-dev:i386 libunwind7-dev:i386 libopenlibm-dev:i386 libmpfr-dev:i386 -y;
Expand Down
22 changes: 16 additions & 6 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ DEBUGFLAGS := -O0 -g -DJL_DEBUG_BUILD -fstack-protector-all
SHIPFLAGS := -O3 -g -falign-functions
endif

JCPPFLAGS += -ftls-model=global-dynamic

ifeq ($(USECCACHE), 1)
# expand CC and CXX at declaration time because we will redefine them
CC_ARG := $(CC) # Expand CC and CXX here already because we want
Expand Down Expand Up @@ -497,6 +499,8 @@ else
ifneq ($(XC_HOST),)
XC_HOST := $(ARCH)$(shell echo $(XC_HOST) | sed "s/[^-]*\(.*\)$$/\1/")
MARCH := $(subst _,-,$(ARCH))
else # insert ARCH into HOST
XC_HOST := $(ARCH)$(shell echo $(BUILD_MACHINE) | sed "s/[^-]*\(.*\)$$/\1/")
endif
endif

Expand Down Expand Up @@ -528,6 +532,18 @@ ARCH := $(BUILD_OS)
endif
endif

# Detect common pre-SSE2 JULIA_CPU_TARGET values known not to work (#7185)
ifeq ($(MARCH),)
ifneq ($(findstring $(ARCH),i386 i486 i586 i686),)
MARCH := pentium4
endif
endif

ifneq ($(findstring $(MARCH),i386 i486 i586 i686 pentium pentium2 pentium3),)
$(error Pre-SSE2 CPU targets not supported. To create a generic 32-bit x86 binary, \
pass 'MARCH=pentium4'.)
endif

ifneq ($(MARCH),)
CC += -march=$(MARCH)
CXX += -march=$(MARCH)
Expand All @@ -551,12 +567,6 @@ endif

JULIA_CPU_TARGET ?= native

# Detect common pre-SSE2 JULIA_CPU_TARGET values known not to work (#7185)
ifneq ($(findstring $(JULIA_CPU_TARGET),i386 i486 i586 i686 pentium pentium2 pentium3),)
$(error Pre-SSE2 CPU targets not supported. To create a generic 32-bit x86 binary, \
pass 'MARCH=i686 JULIA_CPU_TARGET=pentium4', or 'MARCH=pentium4' if not building any dependencies.)
endif

# We map amd64 to x86_64 for compatibility with systems that identify 64-bit systems as such
ifeq ($(ARCH),amd64)
override ARCH := x86_64
Expand Down
3 changes: 1 addition & 2 deletions contrib/windows/msys_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ else
bits=32
archsuffix=86
exc=sjlj
echo "override MARCH = i686" >> Make.user
echo "override JULIA_CPU_TARGET = pentium4" >> Make.user
echo "override MARCH = pentium4" >> Make.user
echo 'LIBBLAS = -L$(JULIAHOME)/usr/bin -lopenblas' >> Make.user
echo 'LIBBLASNAME = libopenblas' >> Make.user
fi
Expand Down
4 changes: 2 additions & 2 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6014,8 +6014,8 @@ extern "C" void jl_init_codegen(void)
.setMCJITMemoryManager(std::move(std::unique_ptr<RTDyldMemoryManager>{new SectionMemoryManager()}))
#endif
.setTargetOptions(options)
.setRelocationModel(Reloc::PIC_)
.setCodeModel(CodeModel::Small)
.setRelocationModel(Reloc::Default)
.setCodeModel(CodeModel::JITDefault)
#ifdef DISABLE_OPT
.setOptLevel(CodeGenOpt::None)
#else
Expand Down

3 comments on commit 930e6b5

@staticfloat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks building on 32-bit, because findstring finds pentium inside pentium4

@vtjnash
Copy link
Member Author

@vtjnash vtjnash commented on 930e6b5 Oct 7, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have the parameters reversed in your mind: pentium4 does not appear as a substring of pentium pentium2 pentium3

@staticfloat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so I do. Thanks, the problem was another set of crossed wires in my mind. :)

Please sign in to comment.