From patchwork Thu Apr 9 19:59:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 38794 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by sourceware.org (Postfix) with ESMTPS id DBF8A385DC03 for ; Thu, 9 Apr 2020 19:59:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DBF8A385DC03 Received: by mail-qv1-xf2b.google.com with SMTP id p60so6172420qva.5 for ; Thu, 09 Apr 2020 12:59:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=9yO4QWPgiemOPhXNqfaiatkR+Y95k7OXCQ4giUxQ25Q=; b=g7aKFMFTfiRAz1GOVxXLhS/1x4oC7wYucCNQ8WmN5/rQiQ0LhekBLbtF4FK1MNrfeN nji8Gc5DG9z+eiEuRQBpuEFf/w/6100SywUz3/clUeWL/HBgKE1MIPayPBuEKkEBafP+ QyqXUHwcmqD2U/uL8AaHNLjZxQ92uP2EtKAhO+QqZQc+sYaeCI6YyjcGfXjbw1ITiuOD YpG/CBZd3RqCUkeRuOsm4z7FA/gE0+GfFUHEE8xNJufri35B/THbrB483T6oTDawzDfo /IabnlX+4fQv2noIzO1zlz7rQp6C5dNxCXZejQRyCA+Q9pvvUr8dNjYnz+DgHjzgFZDV Xe3w== X-Gm-Message-State: AGi0PuaVXnoLg4pYhRlhKluDRo40q+SuLrtUJ3NHDyGPvM2RJ3mWg7W7 Ck9dqAkXvoW8EmzWxdfhfC4AItuKQJCPDA== X-Google-Smtp-Source: APiQypLoU4T5/y9/B+bm+c5EE0Ht0oRH2vb4BnGXUAx/iqW3ZWysWsqk72tvj+z7YuZ2WsXuKjG+IQ== X-Received: by 2002:a0c:8444:: with SMTP id l62mr1873656qva.239.1586462393176; Thu, 09 Apr 2020 12:59:53 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id f7sm8605434qkh.25.2020.04.09.12.59.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Apr 2020 12:59:52 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 3/5] i386: Use generic exp10f Date: Thu, 9 Apr 2020 16:59:43 -0300 Message-Id: <20200409195945.10393-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200409195945.10393-1-adhemerval.zanella@linaro.org> References: <20200409195945.10393-1-adhemerval.zanella@linaro.org> X-Spam-Status: No, score=-25.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Thu, 09 Apr 2020 19:59:55 -0000 The generic implementation is twice as fast. Using the exp10f benchmark: * master: "exp10f": { "": { "duration": 4.25753e+09, "iterations": 3.3376e+07, "max": 1414.77, "min": 103.649, "mean": 127.563 } } * patched: "exp10f": { "": { "duration": 4.05755e+09, "iterations": 6.9136e+07, "max": 1489.64, "min": 50.95, "mean": 58.6894 } } Checked on i686-linux-gnu. --- sysdeps/i386/fpu/e_exp10f.S | 54 ------------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 sysdeps/i386/fpu/e_exp10f.S diff --git a/sysdeps/i386/fpu/e_exp10f.S b/sysdeps/i386/fpu/e_exp10f.S deleted file mode 100644 index 196ce8744a..0000000000 --- a/sysdeps/i386/fpu/e_exp10f.S +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Written by Ulrich Drepper. - */ - -#include -#include -#include - -DEFINE_FLT_MIN - -#ifdef PIC -# define MO(op) op##@GOTOFF(%ecx) -#else -# define MO(op) op -#endif - - .text -/* 10^x = 2^(x * log2(10)) */ -ENTRY(__ieee754_exp10f) -#ifdef PIC - LOAD_PIC_REG (cx) -#endif - flds 4(%esp) -/* I added the following ugly construct because exp(+-Inf) resulted - in NaN. The ugliness results from the bright minds at Intel. - For the i686 the code can be written better. - -- drepper@cygnus.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - fldl2t - fmulp /* x * log2(10) */ - fld %st - frndint /* int(x * log2(10)) */ - fsubr %st,%st(1) /* fract(x * log2(10)) */ - fxch - f2xm1 /* 2^(fract(x * log2(10))) - 1 */ - fld1 - faddp /* 2^(fract(x * log2(10))) */ - fscale /* e^x */ - fstp %st(1) - FLT_NARROW_EVAL_UFLOW_NONNEG_NAN - ret - -1: testl $0x200, %eax /* Test sign. */ - jz 2f /* If positive, jump. */ - fstp %st - fldz /* Set result to 0. */ -2: ret -END (__ieee754_exp10f) -libm_alias_finite (__ieee754_exp10f, __exp10f)