From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) by sourceware.org (Postfix) with ESMTPS id 62D813858000 for ; Tue, 7 Dec 2021 19:04:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 62D813858000 Received: by mail-ua1-x932.google.com with SMTP id p37so301503uae.8 for ; Tue, 07 Dec 2021 11:04:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3rn0KMwJJ4M5+4KjlOQoh5BRvVH09JGSasQfcp+JVss=; b=fVFqNOTfmYlDIUy5eJhETUbXSZ06zv7SruX37zSh0jx9idLOkgvCP2bgb3cCXrTRBD vt598jr3La69HSTzdgC1HizVcMSKaR7JJpzciZVVgkD/KJrWP5Uy0szHbTl1d7JKhipz 5yRi84qbxoPuqg8dhGnZ+0UaMcjLx4D6iWmRSj755BwR7c63q2O8+2ynR64l2z03+eKM iy9JvuYMXSbILA8CJ1AU98AWdrLXPals0QDo1iDahkTPOLVLHnEELYaeInOC+CI/zdt2 ZKulJDsKz17idQeT56VIlhAa7aRmaNrlJbuWsS+Q3odwIbC5B5NTyLBd1FpNlKTq3iSL LJbQ== X-Gm-Message-State: AOAM530X9YJyCZUZX9tAiqFy56eBp6x7itfAkEXLnKJPd0Yi2/wP4Gf4 ic5Gt5ZoMJ/RldoD3AKypK0wXrtryNs50A== X-Google-Smtp-Source: ABdhPJyBN4UZD9xmbDftoSY4oyhmAKMdmskeZDVoK3nEKAaXSsXixaRvjU3TuLugopDY453Vp8xX/Q== X-Received: by 2002:a67:eb54:: with SMTP id x20mr48418378vso.18.1638903876868; Tue, 07 Dec 2021 11:04:36 -0800 (PST) Received: from birita.. ([2804:431:c7ca:a776:246c:70fd:1377:eec7]) by smtp.gmail.com with ESMTPSA id l190sm312904vsc.26.2021.12.07.11.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 11:04:36 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Paul Zimmermann , Wilco Dijkstra Subject: [PATCH v5 08/12] math: Add math-use-builtinds-fmax.h Date: Tue, 7 Dec 2021 16:03:49 -0300 Message-Id: <20211207190353.3282666-9-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211207190353.3282666-1-adhemerval.zanella@linaro.org> References: <20211207190353.3282666-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Dec 2021 19:04:39 -0000 It allows the architecture to use the builtin instead of generic implementation. --- math/s_fmax_template.c | 5 +++++ sysdeps/generic/math-type-macros-double.h | 1 + sysdeps/generic/math-type-macros-float.h | 1 + sysdeps/generic/math-type-macros-float128.h | 1 + sysdeps/generic/math-type-macros-ldouble.h | 1 + sysdeps/generic/math-use-builtins-fmax.h | 4 ++++ sysdeps/generic/math-use-builtins.h | 1 + 7 files changed, 14 insertions(+) create mode 100644 sysdeps/generic/math-use-builtins-fmax.h diff --git a/math/s_fmax_template.c b/math/s_fmax_template.c index d817406f04..4a88266e71 100644 --- a/math/s_fmax_template.c +++ b/math/s_fmax_template.c @@ -17,10 +17,14 @@ . */ #include +#include FLOAT M_DECL_FUNC (__fmax) (FLOAT x, FLOAT y) { +#if M_USE_BUILTIN (FMAX) + return M_SUF (__builtin_fmax) (x, y); +#else if (isgreaterequal (x, y)) return x; else if (isless (x, y)) @@ -29,6 +33,7 @@ M_DECL_FUNC (__fmax) (FLOAT x, FLOAT y) return x + y; else return isnan (y) ? x : y; +#endif } declare_mgen_alias (__fmax, fmax); diff --git a/sysdeps/generic/math-type-macros-double.h b/sysdeps/generic/math-type-macros-double.h index 8d2d8362cc..e29112d814 100644 --- a/sysdeps/generic/math-type-macros-double.h +++ b/sysdeps/generic/math-type-macros-double.h @@ -26,6 +26,7 @@ #define FLOAT double #define CFLOAT _Complex double #define M_STRTO_NAN __strtod_nan +#define M_USE_BUILTIN(c) USE_ ##c ##_BUILTIN #include #include diff --git a/sysdeps/generic/math-type-macros-float.h b/sysdeps/generic/math-type-macros-float.h index fb84d62909..5ba7615500 100644 --- a/sysdeps/generic/math-type-macros-float.h +++ b/sysdeps/generic/math-type-macros-float.h @@ -25,6 +25,7 @@ #define FLOAT float #define CFLOAT _Complex float #define M_STRTO_NAN __strtof_nan +#define M_USE_BUILTIN(c) USE_ ##c ##F_BUILTIN /* Standard/GNU macro literals do not exist for the float type. Use the double macro constants. */ diff --git a/sysdeps/generic/math-type-macros-float128.h b/sysdeps/generic/math-type-macros-float128.h index 5c190606f5..de4de6e555 100644 --- a/sysdeps/generic/math-type-macros-float128.h +++ b/sysdeps/generic/math-type-macros-float128.h @@ -24,6 +24,7 @@ #define M_SUF(c) c ## f128 #define FLOAT _Float128 #define M_STRTO_NAN __strtof128_nan +#define M_USE_BUILTIN(c) USE_ ##c ##F128_BUILTIN #define CFLOAT __CFLOAT128 diff --git a/sysdeps/generic/math-type-macros-ldouble.h b/sysdeps/generic/math-type-macros-ldouble.h index a2f282500e..c3edfcea73 100644 --- a/sysdeps/generic/math-type-macros-ldouble.h +++ b/sysdeps/generic/math-type-macros-ldouble.h @@ -26,6 +26,7 @@ #define FLOAT long double #define CFLOAT _Complex long double #define M_STRTO_NAN __strtold_nan +#define M_USE_BUILTIN(c) USE_ ##c ##L_BUILTIN #include #include diff --git a/sysdeps/generic/math-use-builtins-fmax.h b/sysdeps/generic/math-use-builtins-fmax.h new file mode 100644 index 0000000000..8fc4efca6a --- /dev/null +++ b/sysdeps/generic/math-use-builtins-fmax.h @@ -0,0 +1,4 @@ +#define USE_FMAX_BUILTIN 0 +#define USE_FMAXF_BUILTIN 0 +#define USE_FMAXL_BUILTIN 0 +#define USE_FMAXF128_BUILTIN 0 diff --git a/sysdeps/generic/math-use-builtins.h b/sysdeps/generic/math-use-builtins.h index 19d2d1cf3c..e07bba242f 100644 --- a/sysdeps/generic/math-use-builtins.h +++ b/sysdeps/generic/math-use-builtins.h @@ -34,5 +34,6 @@ #include #include #include +#include #endif /* MATH_USE_BUILTINS_H */ -- 2.32.0