Skip to content

Commit

Permalink
Merge pull request flintlib#1821 from albinahlback/config.guess
Browse files Browse the repository at this point in the history
Add GMP's config.guess and prepare for CPU-specific configurations
  • Loading branch information
albinahlback authored Mar 11, 2024
2 parents e84002f + 50be832 commit 46f5b8d
Show file tree
Hide file tree
Showing 65 changed files with 5,658 additions and 439 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
src/fmpz/fmpz.c
src/config.h
src/config.h.in
src/fft_tuning.h
src/flint.h
src/flint-config.h
src/gmpcompat.h
build/
config/
config/*
!config/config.guess
!config/config.sub
!config/configfsf.guess
!config/configfsf.sub
config.log
confdefs.h
conftest.*
Expand Down Expand Up @@ -60,3 +63,4 @@ libtool
flint.pc
autom4te.cache/
config.m4
src/flint-mparam.h
12 changes: 3 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ string(REGEX REPLACE "([A-Za-z0-9_-]+;|[A-Za-z0-9_-]+$)" "src/\\1" BUILD_DIRS "$
# NOTE: Template directories are not supposed to be used.

set(_HEADERS
NTL-interface.h flint.h longlong.h flint-config.h gmpcompat.h fft_tuning.h
NTL-interface.h flint.h longlong.h flint-config.h gmpcompat.h flint-mparam.h
profiler.h templates.h mpf-impl.h
)
string(REGEX REPLACE "([A-Za-z0-9_-]+\.h;|[A-Za-z0-9_-]+\.h$)" "src/\\1" HEADERS "${_HEADERS}")
Expand Down Expand Up @@ -352,16 +352,10 @@ endif()

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/fft_tuning64.in
${CMAKE_CURRENT_SOURCE_DIR}/src/fft_tuning.h
${CMAKE_CURRENT_SOURCE_DIR}/src/mpn_extras/generic/flint-mparam.h
${CMAKE_CURRENT_SOURCE_DIR}/src/flint-mparam.h
COPYONLY
)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/fft_tuning32.in
${CMAKE_CURRENT_SOURCE_DIR}/src/fft_tuning.h
COPYONLY
)
endif()


Expand Down
54 changes: 21 additions & 33 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ WANT_DEPS:=@WANT_DEPS@

WANT_CXX:=@WANT_CXX@

WANT_ADX_ASSEMBLY:=@WANT_ADX_ASSEMBLY@
WANT_ARMV8_ASSEMBLY:=@WANT_ARMV8_ASSEMBLY@
WANT_ASSEMBLY:=@WANT_ASSEMBLY@
ASM_PATH:=$(SRC_DIR)/mpn_extras/@ASM_PATH@

GMP_LIB_PATH:=@GMP_LIB_PATH@
MPFR_LIB_PATH:=@MPFR_LIB_PATH@
Expand Down Expand Up @@ -136,9 +135,9 @@ endif
CFG_FILES := \
$(FLINT_DIR)/config.h $(SRC_DIR)/flint-config.h \
$(FLINT_DIR)/config.log $(SRC_DIR)/flint.h \
$(SRC_DIR)/fft_tuning.h $(FLINT_DIR)/flint.pc \
$(SRC_DIR)/gmpcompat.h $(FLINT_DIR)/flint.pc \
$(FLINT_DIR)/Makefile $(SRC_DIR)/fmpz/fmpz.c \
$(SRC_DIR)/gmpcompat.h $(SRC_DIR)/config.m4
$(SRC_DIR)/config.m4 $(SRC_DIR)/flint-mparam.h

################################################################################
# directories
Expand Down Expand Up @@ -233,13 +232,9 @@ ifneq ($(COVERAGE), 0)
BUILD_DIRS += \
$(BUILD_DIR)/coverage
endif
ifeq ($(WANT_ADX_ASSEMBLY),1)
BUILD_DIRS += \
$(BUILD_DIR)/mpn_extras/broadwell
endif
ifeq ($(WANT_ARMV8_ASSEMBLY),1)
ifeq ($(WANT_ASSEMBLY),1)
BUILD_DIRS += \
$(BUILD_DIR)/mpn_extras/arm64
$(patsubst $(SRC_DIR)/%,$(BUILD_DIR)/%,$(ASM_PATH))
endif

INSTALL_DIRS := \
Expand All @@ -254,13 +249,16 @@ endif
################################################################################

SINGLE_HEADERS := \
flint.h flint-config.h gmpcompat.h \
profiler.h templates.h fft_tuning.h \
flint.h flint-config.h flint-mparam.h \
\
profiler.h templates.h \
\
longlong.h longlong_asm_clang.h \
longlong_asm_gcc.h longlong_div_gnu.h \
longlong_msc_arm64.h longlong_msc_x86.h \
\
gmpcompat.h \
\
crt_helpers.h machine_vectors.h \
\
mpf-impl.h fq_zech_vec.h \
Expand Down Expand Up @@ -296,12 +294,7 @@ fmpz_lll_SOURCES := $(filter-out $(SRC_DIR)/fmpz_lll/babai.c $(SRC_DIR)/fmpz_lll
SOURCES := $(foreach dir,$(DIRS),$($(dir)_SOURCES))

ifeq ($(WANT_ASSEMBLY),1)
ifeq ($(WANT_ADX_ASSEMBLY),1)
mpn_extras_ASM_SOURCES := $(wildcard $(SRC_DIR)/mpn_extras/broadwell/*.asm)
endif
ifeq ($(WANT_ARMV8_ASSEMBLY),1)
mpn_extras_ASM_SOURCES := $(wildcard $(SRC_DIR)/mpn_extras/arm64/*.asm)
endif
mpn_extras_ASM_SOURCES := $(wildcard $(ASM_PATH)/*.asm)
mpn_extras_PIC_S_SOURCES := $(patsubst $(SRC_DIR)/%.asm,$(BUILD_DIR)/%_pic.s,$(mpn_extras_ASM_SOURCES))
mpn_extras_S_SOURCES := $(patsubst $(SRC_DIR)/%.asm,$(BUILD_DIR)/%.s,$(mpn_extras_ASM_SOURCES))
ifneq ($(SHARED), 0)
Expand Down Expand Up @@ -584,18 +577,11 @@ DEPFLAGS = -MMD -MP -MF $(@:%=%.d)
# generated sources
################################################################################

ifeq ($(WANT_ADX_ASSEMBLY),1)
$(BUILD_DIR)/%.s: $(SRC_DIR)/%.asm $(FLINT_DIR)/config.m4 $(SRC_DIR)/mpn_extras/asm-defs.m4 $(SRC_DIR)/mpn_extras/broadwell/x86_64-defs.m4 | $(BUILD_DIR)/mpn_extras/broadwell
@$(M4) $< > $@

$(BUILD_DIR)/%_pic.s: $(SRC_DIR)/%.asm $(FLINT_DIR)/config.m4 $(SRC_DIR)/mpn_extras/asm-defs.m4 $(SRC_DIR)/mpn_extras/broadwell/x86_64-defs.m4 | $(BUILD_DIR)/mpn_extras/broadwell
@$(M4) -DPIC $< > $@
endif
ifeq ($(WANT_ARMV8_ASSEMBLY),1)
$(BUILD_DIR)/%.s: $(SRC_DIR)/%.asm $(FLINT_DIR)/config.m4 $(SRC_DIR)/mpn_extras/asm-defs.m4 $(SRC_DIR)/mpn_extras/arm64/arm64-defs.m4 | $(BUILD_DIR)/mpn_extras/arm64
ifeq ($(WANT_ASSEMBLY),1)
$(BUILD_DIR)/%.s: $(SRC_DIR)/%.asm $(FLINT_DIR)/config.m4 | $(BUILD_DIR)/mpn_extras/@ASM_PATH@
@$(M4) $< > $@

$(BUILD_DIR)/%_pic.s: $(SRC_DIR)/%.asm $(FLINT_DIR)/config.m4 $(SRC_DIR)/mpn_extras/asm-defs.m4 $(SRC_DIR)/mpn_extras/arm64/arm64-defs.m4 | $(BUILD_DIR)/mpn_extras/arm64
$(BUILD_DIR)/%_pic.s: $(SRC_DIR)/%.asm $(FLINT_DIR)/config.m4 | $(BUILD_DIR)/mpn_extras/@ASM_PATH@
@$(M4) -DPIC $< > $@
endif

Expand Down Expand Up @@ -966,14 +952,16 @@ src/flint.h: src/flint.h.in config.status
libtool: config.status
./config.status $@

src/fft_tuning.h: @FFT_TUNING_IN@ config.status
src/gmpcompat.h: src/@GMPCOMPAT_H_IN@ config.status
./config.status $@

src/fmpz/fmpz.c: @FMPZ_C_IN@ config.status
./config.status $@
# The following two are only linked during configuration

src/gmpcompat.h: src/@GMPCOMPAT_H_IN@ config.status
./config.status $@
# src/fmpz/fmpz.c: @FMPZ_C_IN@ config.status
# ./config.status $@
#
# src/flint-mparam.h: src/mpn_extras/@PARAM_PATH@/flint-mparam.h config.status
# ./config.status $@

################################################################################
# maintainer stuff
Expand Down
Loading

0 comments on commit 46f5b8d

Please sign in to comment.