From 02af290b8560e97001f9dc98eec8766898df9954 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Sun, 4 Dec 2016 18:11:59 +0100 Subject: [PATCH] ck_pr: Add an option to disable any double function --- configure | 6 ++++++ include/ck_md.h.in | 4 ++++ include/ck_pr.h | 24 ++++++++++++++++-------- include/gcc/aarch64/ck_pr.h | 6 ++++++ include/gcc/arm/ck_pr.h | 9 +++++++++ include/gcc/ck_pr.h | 2 ++ include/gcc/ppc64/ck_pr.h | 6 ++++++ include/gcc/x86_64/ck_pr.h | 12 ++++++++++++ 8 files changed, 61 insertions(+), 8 deletions(-) diff --git a/configure b/configure index a9c931d..a4d03d2 100755 --- a/configure +++ b/configure @@ -118,6 +118,7 @@ generate() -e "s#@GZIP@#$GZIP#g" \ -e "s#@GZIP_SUFFIX@#$GZIP_SUFFIX#g" \ -e "s#@POINTER_PACK_ENABLE@#$POINTER_PACK_ENABLE#g" \ + -e "s#@DISABLE_DOUBLE@#$DISABLE_DOUBLE#g" \ -e "s#@RTM_ENABLE@#$RTM_ENABLE#g" \ -e "s#@VMA_BITS@#$VMA_BITS_R#g" \ -e "s#@VMA_BITS_VALUE@#$VMA_BITS_VALUE_R#g" \ @@ -196,6 +197,7 @@ for option; do echo " --vma-bits=N Specify valid number of VMA bits" echo " --platform=N Force the platform type, instead of relying on autodetection" echo " --use-cc-builtins Use the compiler atomic bultin functions, instead of the CK implementation" + echo " --disable-double Don't generate any of the functions using the \"double\" type" echo echo "The following options affect regression testing." echo " --cores=N Specify number of cores available on target machine" @@ -265,6 +267,9 @@ for option; do --use-cc-builtins) USE_CC_BUILTINS=1 ;; + --disable-double) + DISABLE_DOUBLE="CK_PR_DISABLE_DOUBLE" + ;; --platform=*) PLATFORM=$value ;; @@ -300,6 +305,7 @@ LIBRARY=${LIBRARY:-"${PREFIX}/lib"} MANDIR=${MANDIR:-"${PREFIX}/share/man"} GZIP=${GZIP:-"gzip -c"} POINTER_PACK_ENABLE=${POINTER_PACK_ENABLE:-"CK_MD_POINTER_PACK_DISABLE"} +DISABLE_DOUBLE=${DISABLE_DOUBLE:-"CK_PR_ENABLE_DOUBLE"} RTM_ENABLE=${RTM_ENABLE_SET:-"CK_MD_RTM_DISABLE"} VMA_BITS=${VMA_BITS:-"unknown"} diff --git a/include/ck_md.h.in b/include/ck_md.h.in index 07dd384..0694b9e 100644 --- a/include/ck_md.h.in +++ b/include/ck_md.h.in @@ -51,6 +51,10 @@ #define @MM@ #endif /* @MM@ */ +#ifndef @DISABLE_DOUBLE@ +#define @DISABLE_DOUBLE@ +#endif /* @DISABLE_DOUBLE@ */ + #define CK_VERSION "@VERSION@" #define CK_GIT_SHA "@GIT_SHA@" diff --git a/include/ck_pr.h b/include/ck_pr.h index 4054689..9b7fc42 100644 --- a/include/ck_pr.h +++ b/include/ck_pr.h @@ -169,7 +169,9 @@ ck_pr_rfo(const void *m) #define ck_pr_store_ptr(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), ptr) #define ck_pr_store_char(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), char) +#ifndef CK_PR_DISABLE_DOUBLE #define ck_pr_store_double(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), double) +#endif #define ck_pr_store_uint(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), uint) #define ck_pr_store_int(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), int) #define ck_pr_store_32(DST, VAL) CK_PR_STORE_SAFE((DST), (VAL), 32) @@ -187,7 +189,9 @@ ck_pr_rfo(const void *m) #define CK_PR_LOAD_SAFE(SRC, TYPE) ck_pr_md_load_##TYPE((SRC)) #define ck_pr_load_char(SRC) CK_PR_LOAD_SAFE((SRC), char) +#ifndef CK_PR_DISABLE_DOUBLE #define ck_pr_load_double(SRC) CK_PR_LOAD_SAFE((SRC), double) +#endif #define ck_pr_load_uint(SRC) CK_PR_LOAD_SAFE((SRC), uint) #define ck_pr_load_int(SRC) CK_PR_LOAD_SAFE((SRC), int) #define ck_pr_load_32(SRC) CK_PR_LOAD_SAFE((SRC), 32) @@ -275,7 +279,8 @@ CK_PR_BIN_S(or, int, int, |) #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */ -#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) +#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \ + !defined(CK_PR_DISABLE_DOUBLE) #ifndef CK_F_PR_ADD_DOUBLE #define CK_F_PR_ADD_DOUBLE @@ -287,7 +292,7 @@ CK_PR_BIN_S(add, double, double, +) CK_PR_BIN_S(sub, double, double, -) #endif /* CK_F_PR_SUB_DOUBLE */ -#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */ +#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && !CK_PR_DISABLE_DOUBLE */ #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE) @@ -675,7 +680,8 @@ CK_PR_UNARY_Z_S(dec, int, int, -, 1) #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */ -#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) +#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \ + !defined(CK_PR_DISABLE_DOUBLE) #ifndef CK_F_PR_INC_DOUBLE #define CK_F_PR_INC_DOUBLE @@ -687,7 +693,7 @@ CK_PR_UNARY_S(inc, add, double, double) CK_PR_UNARY_S(dec, sub, double, double) #endif /* CK_F_PR_DEC_DOUBLE */ -#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */ +#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && !CK_PR_DISABLE_DOUBLE */ #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE) @@ -914,14 +920,15 @@ CK_PR_N_Z_S(int, int) #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */ -#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) +#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \ + !defined(CK_PR_DISABLE_DOUBLE) #ifndef CK_F_PR_NEG_DOUBLE #define CK_F_PR_NEG_DOUBLE CK_PR_N_S(neg, double, double, -) #endif /* CK_F_PR_NEG_DOUBLE */ -#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */ +#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && !CK_PR_DISABLE_DOUBLE */ #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE) @@ -1105,7 +1112,8 @@ CK_PR_FAS_S(int, int) #endif /* CK_F_PR_LOAD_INT && CK_F_PR_CAS_INT_VALUE */ -#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) +#if defined(CK_F_PR_LOAD_DOUBLE) && defined(CK_F_PR_CAS_DOUBLE_VALUE) && \ + !defined(CK_PR_DISABLE_DOUBLE) #ifndef CK_F_PR_FAA_DOUBLE #define CK_F_PR_FAA_DOUBLE @@ -1117,7 +1125,7 @@ CK_PR_FAA_S(double, double) CK_PR_FAS_S(double, double) #endif /* CK_F_PR_FAS_DOUBLE */ -#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE */ +#endif /* CK_F_PR_LOAD_DOUBLE && CK_F_PR_CAS_DOUBLE_VALUE && !CK_PR_DISABLE_DOUBLE */ #if defined(CK_F_PR_LOAD_UINT) && defined(CK_F_PR_CAS_UINT_VALUE) diff --git a/include/gcc/aarch64/ck_pr.h b/include/gcc/aarch64/ck_pr.h index ba382d8..57ede3e 100644 --- a/include/gcc/aarch64/ck_pr.h +++ b/include/gcc/aarch64/ck_pr.h @@ -124,7 +124,9 @@ CK_PR_LOAD_S(uint, unsigned int, "ldr") CK_PR_LOAD_S(int, int, "ldr") CK_PR_LOAD_S(short, short, "ldrh") CK_PR_LOAD_S(char, char, "ldrb") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_LOAD_S_64(double, double, "ldr") +#endif #undef CK_PR_LOAD_S #undef CK_PR_LOAD_S_64 @@ -167,7 +169,9 @@ CK_PR_STORE_S(uint, unsigned int, "str") CK_PR_STORE_S(int, int, "str") CK_PR_STORE_S(short, short, "strh") CK_PR_STORE_S(char, char, "strb") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_STORE_S_64(double, double, "str") +#endif #undef CK_PR_STORE_S #undef CK_PR_STORE_S_64 @@ -283,7 +287,9 @@ CK_PR_CAS(ptr, void, void *, "", "") #define CK_PR_CAS_S(N, M, W, R) CK_PR_CAS(N, M, M, W, R) CK_PR_CAS_S(64, uint64_t, "", "") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_CAS_S(double, double, "", "") +#endif CK_PR_CAS_S(32, uint32_t, "", "w") CK_PR_CAS_S(uint, unsigned int, "", "w") CK_PR_CAS_S(int, int, "", "w") diff --git a/include/gcc/arm/ck_pr.h b/include/gcc/arm/ck_pr.h index 4577ec6..841ca21 100644 --- a/include/gcc/arm/ck_pr.h +++ b/include/gcc/arm/ck_pr.h @@ -148,7 +148,9 @@ ck_pr_md_load_##N(const T *target) \ } CK_PR_DOUBLE_LOAD(uint64_t, 64) +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_DOUBLE_LOAD(double, double) +#endif #undef CK_PR_DOUBLE_LOAD #endif @@ -199,7 +201,9 @@ ck_pr_md_store_##N(const T *target, T value) \ } CK_PR_DOUBLE_STORE(uint64_t, 64) +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_DOUBLE_STORE(double, double) +#endif #undef CK_PR_DOUBLE_STORE @@ -227,7 +231,9 @@ ck_pr_cas_##N##_value(T *target, T compare, T set, T *value) \ } CK_PR_DOUBLE_CAS_VALUE(uint64_t, 64) +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_DOUBLE_CAS_VALUE(double, double) +#endif #undef CK_PR_DOUBLE_CAS_VALUE @@ -271,7 +277,10 @@ ck_pr_cas_##N(T *target, T compare, T set) \ } CK_PR_DOUBLE_CAS(uint64_t, 64) +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_DOUBLE_CAS(double, double) +#endif + CK_CC_INLINE static bool ck_pr_cas_ptr_2(void *target, void *compare, void *set) { diff --git a/include/gcc/ck_pr.h b/include/gcc/ck_pr.h index 7448997..084d423 100644 --- a/include/gcc/ck_pr.h +++ b/include/gcc/ck_pr.h @@ -101,7 +101,9 @@ ck_pr_md_store_ptr(void *target, const void *v) CK_PR_LOAD_S(char, char) CK_PR_LOAD_S(uint, unsigned int) CK_PR_LOAD_S(int, int) +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_LOAD_S(double, double) +#endif CK_PR_LOAD_S(64, uint64_t) CK_PR_LOAD_S(32, uint32_t) CK_PR_LOAD_S(16, uint16_t) diff --git a/include/gcc/ppc64/ck_pr.h b/include/gcc/ppc64/ck_pr.h index 828da6b..3f5e5db 100644 --- a/include/gcc/ppc64/ck_pr.h +++ b/include/gcc/ppc64/ck_pr.h @@ -112,7 +112,9 @@ CK_PR_LOAD_S(uint, unsigned int, "lwz") CK_PR_LOAD_S(int, int, "lwz") CK_PR_LOAD_S(short, short, "lhz") CK_PR_LOAD_S(char, char, "lbz") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_LOAD_S(double, double, "ld") +#endif #undef CK_PR_LOAD_S #undef CK_PR_LOAD @@ -140,7 +142,9 @@ CK_PR_STORE_S(uint, unsigned int, "stw") CK_PR_STORE_S(int, int, "stw") CK_PR_STORE_S(short, short, "sth") CK_PR_STORE_S(char, char, "stb") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_STORE_S(double, double, "std") +#endif #undef CK_PR_STORE_S #undef CK_PR_STORE @@ -294,7 +298,9 @@ CK_PR_CAS(int, int) CK_PR_FAS(64, uint64_t, uint64_t, "d") CK_PR_FAS(32, uint32_t, uint32_t, "w") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_FAS(double, double, double, "d") +#endif CK_PR_FAS(ptr, void, void *, "d") CK_PR_FAS(int, int, int, "w") CK_PR_FAS(uint, unsigned int, unsigned int, "w") diff --git a/include/gcc/x86_64/ck_pr.h b/include/gcc/x86_64/ck_pr.h index e9ea216..532d593 100644 --- a/include/gcc/x86_64/ck_pr.h +++ b/include/gcc/x86_64/ck_pr.h @@ -132,7 +132,9 @@ CK_PR_FAS(ptr, void, void *, char, "xchgq") #define CK_PR_FAS_S(S, T, I) CK_PR_FAS(S, T, T, T, I) +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_FAS_S(double, double, "xchgq") +#endif CK_PR_FAS_S(char, char, "xchgb") CK_PR_FAS_S(uint, unsigned int, "xchgl") CK_PR_FAS_S(int, int, "xchgl") @@ -166,7 +168,9 @@ CK_PR_LOAD(ptr, void, void *, char, "movq") CK_PR_LOAD_S(char, char, "movb") CK_PR_LOAD_S(uint, unsigned int, "movl") CK_PR_LOAD_S(int, int, "movl") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_LOAD_S(double, double, "movq") +#endif CK_PR_LOAD_S(64, uint64_t, "movq") CK_PR_LOAD_S(32, uint32_t, "movl") CK_PR_LOAD_S(16, uint16_t, "movw") @@ -240,7 +244,9 @@ CK_PR_LOAD_2(8, 16, uint8_t) } CK_PR_STORE_IMM(ptr, void, const void *, char, "movq", CK_CC_IMM_U32) +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_STORE(double, double, double, double, "movq") +#endif #define CK_PR_STORE_S(S, T, I, K) CK_PR_STORE_IMM(S, T, T, T, I, K) @@ -404,7 +410,9 @@ CK_PR_CAS(ptr, void, void *, char, "cmpxchgq") CK_PR_CAS_S(char, char, "cmpxchgb") CK_PR_CAS_S(int, int, "cmpxchgl") CK_PR_CAS_S(uint, unsigned int, "cmpxchgl") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_CAS_S(double, double, "cmpxchgq") +#endif CK_PR_CAS_S(64, uint64_t, "cmpxchgq") CK_PR_CAS_S(32, uint32_t, "cmpxchgl") CK_PR_CAS_S(16, uint16_t, "cmpxchgw") @@ -441,7 +449,9 @@ CK_PR_CAS_O(ptr, void, void *, char, "q", "rax") CK_PR_CAS_O_S(char, char, "b", "al") CK_PR_CAS_O_S(int, int, "l", "eax") CK_PR_CAS_O_S(uint, unsigned int, "l", "eax") +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_CAS_O_S(double, double, "q", "rax") +#endif CK_PR_CAS_O_S(64, uint64_t, "q", "rax") CK_PR_CAS_O_S(32, uint32_t, "l", "eax") CK_PR_CAS_O_S(16, uint16_t, "w", "ax") @@ -526,7 +536,9 @@ ck_pr_cas_##S##_##W##_value(T *t, T c[W], T s[W], T *v) \ (uint64_t *)(void *)v); \ } +#ifndef CK_PR_DISABLE_DOUBLE CK_PR_CAS_V(double, 2, double) +#endif CK_PR_CAS_V(char, 16, char) CK_PR_CAS_V(int, 4, int) CK_PR_CAS_V(uint, 4, unsigned int)