From patchwork Tue Jun 13 20:56:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul A. Clarke" X-Patchwork-Id: 21000 X-Patchwork-Delegate: joseph@codesourcery.com Received: (qmail 30856 invoked by alias); 13 Jun 2017 20:56:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 29935 invoked by uid 89); 13 Jun 2017 20:56:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-27.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com Reply-To: pc@us.ibm.com To: "libc-alpha@sourceware.org" From: Paul Clarke Subject: [PATCH v3] Add powf bench tests Date: Tue, 13 Jun 2017 15:56:38 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17061320-0020-0000-0000-00000C276AB5 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007226; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00874335; UDB=6.00435208; IPR=6.00654424; BA=6.00005420; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015811; XFM=3.00000015; UTC=2017-06-13 20:56:43 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17061320-0021-0000-0000-00005CC6597E Message-Id: <3f0cba63-6a0a-833d-b60e-a8d2829496b3@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-13_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706130356 Add powf() bench test with input which covers these cases: - positive base to positive exponent - exponent 0 - negative base to even exponent - exponent 1 - exponent -1 - squared - squareroot - 1 to negative exponent - -1 to negative exponent - base 0 - -1 to even exponent - small base - small exponent 2017-06-12 Paul A. Clarke * benchtests/Makefile (bench-math): Add powf. * benchtests/powf-inputs: New file. --- Changes in v3: Rectified incorrect input values, adjusted value set to better map to a more common and expected result space, combined separate bench cases into one case, all per Joseph's review (Thanks!). Changes in v2: Joseph caught me being lazy by using the input for pow tests, which often results in bad/uninteresting input data. (Good catch!) I've now created a new input file which covers a lot of the special cases and the fairly generic case as well. benchtests/Makefile | 2 +- benchtests/powf-inputs | 331 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 332 insertions(+), 1 deletion(-) create mode 100644 benchtests/powf-inputs diff --git a/benchtests/Makefile b/benchtests/Makefile index 7f5fda5..f49e9a0 100644 --- a/benchtests/Makefile +++ b/benchtests/Makefile @@ -23,7 +23,7 @@ subdir := benchtests include ../Makeconfig bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 log log2 \ modf pow rint sin sincos sinh sqrt tan tanh fmin fmax fminf \ - fmaxf + fmaxf powf bench-pthread := pthread_once diff --git a/benchtests/powf-inputs b/benchtests/powf-inputs new file mode 100644 index 0000000..d137da7 --- /dev/null +++ b/benchtests/powf-inputs @@ -0,0 +1,331 @@ +## args: float:float +## ret: float +## includes: math.h +# positive base to positive exponent +0x1p-126, 0x0p+0 +0x1p-126, 0x1.d1745ep+0 +0x1p-126, 0x1.d1745ep+1 +0x1p-126, 0x1.5d1746p+2 +0x1p-126, 0x1.d1745ep+2 +0x1p-126, 0x1.22e8bap+3 +0x1p-126, 0x1.5d1746p+3 +0x1p-126, 0x1.9745dp+3 +0x1p-126, 0x1.d1745ep+3 +0x1p-126, 0x1.05d174p+4 +0x1p-126, 0x1.22e8bap+4 +0x1p-126, 0x1.4p+4 +0x1.d1745ep+2, 0x0p+0 +0x1.d1745ep+2, 0x1.d1745ep+0 +0x1.d1745ep+2, 0x1.d1745ep+1 +0x1.d1745ep+2, 0x1.5d1746p+2 +0x1.d1745ep+2, 0x1.d1745ep+2 +0x1.d1745ep+2, 0x1.22e8bap+3 +0x1.d1745ep+2, 0x1.5d1746p+3 +0x1.d1745ep+2, 0x1.9745dp+3 +0x1.d1745ep+2, 0x1.d1745ep+3 +0x1.d1745ep+2, 0x1.05d174p+4 +0x1.d1745ep+2, 0x1.22e8bap+4 +0x1.d1745ep+2, 0x1.4p+4 +0x1.d1745ep+3, 0x0p+0 +0x1.d1745ep+3, 0x1.d1745ep+0 +0x1.d1745ep+3, 0x1.d1745ep+1 +0x1.d1745ep+3, 0x1.5d1746p+2 +0x1.d1745ep+3, 0x1.d1745ep+2 +0x1.d1745ep+3, 0x1.22e8bap+3 +0x1.d1745ep+3, 0x1.5d1746p+3 +0x1.d1745ep+3, 0x1.9745dp+3 +0x1.d1745ep+3, 0x1.d1745ep+3 +0x1.d1745ep+3, 0x1.05d174p+4 +0x1.d1745ep+3, 0x1.22e8bap+4 +0x1.d1745ep+3, 0x1.4p+4 +0x1.5d1746p+4, 0x0p+0 +0x1.5d1746p+4, 0x1.d1745ep+0 +0x1.5d1746p+4, 0x1.d1745ep+1 +0x1.5d1746p+4, 0x1.5d1746p+2 +0x1.5d1746p+4, 0x1.d1745ep+2 +0x1.5d1746p+4, 0x1.22e8bap+3 +0x1.5d1746p+4, 0x1.5d1746p+3 +0x1.5d1746p+4, 0x1.9745dp+3 +0x1.5d1746p+4, 0x1.d1745ep+3 +0x1.5d1746p+4, 0x1.05d174p+4 +0x1.5d1746p+4, 0x1.22e8bap+4 +0x1.5d1746p+4, 0x1.4p+4 +0x1.d1745ep+4, 0x0p+0 +0x1.d1745ep+4, 0x1.d1745ep+0 +0x1.d1745ep+4, 0x1.d1745ep+1 +0x1.d1745ep+4, 0x1.5d1746p+2 +0x1.d1745ep+4, 0x1.d1745ep+2 +0x1.d1745ep+4, 0x1.22e8bap+3 +0x1.d1745ep+4, 0x1.5d1746p+3 +0x1.d1745ep+4, 0x1.9745dp+3 +0x1.d1745ep+4, 0x1.d1745ep+3 +0x1.d1745ep+4, 0x1.05d174p+4 +0x1.d1745ep+4, 0x1.22e8bap+4 +0x1.d1745ep+4, 0x1.4p+4 +0x1.22e8bap+5, 0x0p+0 +0x1.22e8bap+5, 0x1.d1745ep+0 +0x1.22e8bap+5, 0x1.d1745ep+1 +0x1.22e8bap+5, 0x1.5d1746p+2 +0x1.22e8bap+5, 0x1.d1745ep+2 +0x1.22e8bap+5, 0x1.22e8bap+3 +0x1.22e8bap+5, 0x1.5d1746p+3 +0x1.22e8bap+5, 0x1.9745dp+3 +0x1.22e8bap+5, 0x1.d1745ep+3 +0x1.22e8bap+5, 0x1.05d174p+4 +0x1.22e8bap+5, 0x1.22e8bap+4 +0x1.22e8bap+5, 0x1.4p+4 +0x1.5d1746p+5, 0x0p+0 +0x1.5d1746p+5, 0x1.d1745ep+0 +0x1.5d1746p+5, 0x1.d1745ep+1 +0x1.5d1746p+5, 0x1.5d1746p+2 +0x1.5d1746p+5, 0x1.d1745ep+2 +0x1.5d1746p+5, 0x1.22e8bap+3 +0x1.5d1746p+5, 0x1.5d1746p+3 +0x1.5d1746p+5, 0x1.9745dp+3 +0x1.5d1746p+5, 0x1.d1745ep+3 +0x1.5d1746p+5, 0x1.05d174p+4 +0x1.5d1746p+5, 0x1.22e8bap+4 +0x1.5d1746p+5, 0x1.4p+4 +0x1.9745dp+5, 0x0p+0 +0x1.9745dp+5, 0x1.d1745ep+0 +0x1.9745dp+5, 0x1.d1745ep+1 +0x1.9745dp+5, 0x1.5d1746p+2 +0x1.9745dp+5, 0x1.d1745ep+2 +0x1.9745dp+5, 0x1.22e8bap+3 +0x1.9745dp+5, 0x1.5d1746p+3 +0x1.9745dp+5, 0x1.9745dp+3 +0x1.9745dp+5, 0x1.d1745ep+3 +0x1.9745dp+5, 0x1.05d174p+4 +0x1.9745dp+5, 0x1.22e8bap+4 +0x1.9745dp+5, 0x1.4p+4 +0x1.d1745ep+5, 0x0p+0 +0x1.d1745ep+5, 0x1.d1745ep+0 +0x1.d1745ep+5, 0x1.d1745ep+1 +0x1.d1745ep+5, 0x1.5d1746p+2 +0x1.d1745ep+5, 0x1.d1745ep+2 +0x1.d1745ep+5, 0x1.22e8bap+3 +0x1.d1745ep+5, 0x1.5d1746p+3 +0x1.d1745ep+5, 0x1.9745dp+3 +0x1.d1745ep+5, 0x1.d1745ep+3 +0x1.d1745ep+5, 0x1.05d174p+4 +0x1.d1745ep+5, 0x1.22e8bap+4 +0x1.d1745ep+5, 0x1.4p+4 +0x1.05d174p+6, 0x0p+0 +0x1.05d174p+6, 0x1.d1745ep+0 +0x1.05d174p+6, 0x1.d1745ep+1 +0x1.05d174p+6, 0x1.5d1746p+2 +0x1.05d174p+6, 0x1.d1745ep+2 +0x1.05d174p+6, 0x1.22e8bap+3 +0x1.05d174p+6, 0x1.5d1746p+3 +0x1.05d174p+6, 0x1.9745dp+3 +0x1.05d174p+6, 0x1.d1745ep+3 +0x1.05d174p+6, 0x1.05d174p+4 +0x1.05d174p+6, 0x1.22e8bap+4 +0x1.05d174p+6, 0x1.4p+4 +0x1.22e8bap+6, 0x0p+0 +0x1.22e8bap+6, 0x1.d1745ep+0 +0x1.22e8bap+6, 0x1.d1745ep+1 +0x1.22e8bap+6, 0x1.5d1746p+2 +0x1.22e8bap+6, 0x1.d1745ep+2 +0x1.22e8bap+6, 0x1.22e8bap+3 +0x1.22e8bap+6, 0x1.5d1746p+3 +0x1.22e8bap+6, 0x1.9745dp+3 +0x1.22e8bap+6, 0x1.d1745ep+3 +0x1.22e8bap+6, 0x1.05d174p+4 +0x1.22e8bap+6, 0x1.22e8bap+4 +0x1.22e8bap+6, 0x1.4p+4 +0x1.4p+6, 0x0p+0 +0x1.4p+6, 0x1.d1745ep+0 +0x1.4p+6, 0x1.d1745ep+1 +0x1.4p+6, 0x1.5d1746p+2 +0x1.4p+6, 0x1.d1745ep+2 +0x1.4p+6, 0x1.22e8bap+3 +0x1.4p+6, 0x1.5d1746p+3 +0x1.4p+6, 0x1.9745dp+3 +0x1.4p+6, 0x1.d1745ep+3 +0x1.4p+6, 0x1.05d174p+4 +0x1.4p+6, 0x1.22e8bap+4 +0x1.4p+6, 0x1.4p+4 +# name: exponent 0 +-0x1.fffffep+127, 0x0p+0 +-0x1.333332p+127, 0x0p+0 +-0x1.999998p+125, 0x0p+0 +0x1.999998p+125, 0x0p+0 +0x1.333332p+127, 0x0p+0 +0x1.fffffep+127, 0x0p+0 +# negative base to even exponent +-0x1.4p+2, -0x1.8p+3 +-0x1.4p+2, -0x1p+3 +-0x1.4p+2, -0x1p+2 +-0x1.4p+2, 0x0p+0 +-0x1.4p+2, 0x1p+2 +-0x1.4p+2, 0x1p+3 +-0x1.4p+2, 0x1.8p+3 +-0x1.1p+2, -0x1.8p+3 +-0x1.1p+2, -0x1p+3 +-0x1.1p+2, -0x1p+2 +-0x1.1p+2, 0x0p+0 +-0x1.1p+2, 0x1p+2 +-0x1.1p+2, 0x1p+3 +-0x1.1p+2, 0x1.8p+3 +-0x1.bffffep+1, -0x1.8p+3 +-0x1.bffffep+1, -0x1p+3 +-0x1.bffffep+1, -0x1p+2 +-0x1.bffffep+1, 0x0p+0 +-0x1.bffffep+1, 0x1p+2 +-0x1.bffffep+1, 0x1p+3 +-0x1.bffffep+1, 0x1.8p+3 +-0x1.6p+1, -0x1.8p+3 +-0x1.6p+1, -0x1p+3 +-0x1.6p+1, -0x1p+2 +-0x1.6p+1, 0x0p+0 +-0x1.6p+1, 0x1p+2 +-0x1.6p+1, 0x1p+3 +-0x1.6p+1, 0x1.8p+3 +-0x1p+1, -0x1.8p+3 +-0x1p+1, -0x1p+3 +-0x1p+1, -0x1p+2 +-0x1p+1, 0x0p+0 +-0x1p+1, 0x1p+2 +-0x1p+1, 0x1p+3 +-0x1p+1, 0x1.8p+3 +-0x1.4p+0, -0x1.8p+3 +-0x1.4p+0, -0x1p+3 +-0x1.4p+0, -0x1p+2 +-0x1.4p+0, 0x0p+0 +-0x1.4p+0, 0x1p+2 +-0x1.4p+0, 0x1p+3 +-0x1.4p+0, 0x1.8p+3 +-0x1p-1, -0x1.8p+3 +-0x1p-1, -0x1p+3 +-0x1p-1, -0x1p+2 +-0x1p-1, 0x0p+0 +-0x1p-1, 0x1p+2 +-0x1p-1, 0x1p+3 +-0x1p-1, 0x1.8p+3 +# exponent 1 +-0x1.fffffep+127, 0x1p+0 +-0x1.333332p+127, 0x1p+0 +-0x1.999998p+125, 0x1p+0 +0x1.999998p+125, 0x1p+0 +0x1.333332p+127, 0x1p+0 +0x1.fffffep+127, 0x1p+0 +# exponent -1 +-0x1.fffffep+127, -0x1p+0 +-0x1.333332p+127, -0x1p+0 +-0x1.999998p+125, -0x1p+0 +0x1.999998p+125, -0x1p+0 +0x1.333332p+127, -0x1p+0 +0x1.fffffep+127, -0x1p+0 +# squared +-0x1.fffffep+63, 0x1p+1 +-0x1.333332p+63, 0x1p+1 +-0x1.999998p+61, 0x1p+1 +0x1.999998p+61, 0x1p+1 +0x1.333332p+63, 0x1p+1 +0x1.fffffep+63, 0x1p+1 +# squareroot +0x0p+0, 0x1p-1 +0x1.999998p+125, 0x1p-1 +0x1.999998p+126, 0x1p-1 +0x1.333332p+127, 0x1p-1 +0x1.999998p+127, 0x1p-1 +0x1.fffffep+127, 0x1p-1 +# 1 to negative exponent +0x1p+0, -0x1.fffffep+127 +0x1p+0, -0x1.999998p+127 +0x1p+0, -0x1.333332p+127 +0x1p+0, -0x1.999998p+126 +0x1p+0, -0x1.999998p+125 +# -1 to negative exponent +-0x1p+0, -0x1.fffffep+127 +-0x1p+0, -0x1.999998p+127 +-0x1p+0, -0x1.333332p+127 +-0x1p+0, -0x1.999998p+126 +-0x1p+0, -0x1.999998p+125 +# base 0 +0x0p+0, 0x0p+0 +0x0p+0, 0x1.fffffep+126 +0x0p+0, 0x1.fffffep+127 +# -1 to even exponent +-0x1p+0, -0x1.8p+3 +-0x1p+0, -0x1p+3 +-0x1p+0, -0x1p+2 +-0x1p+0, 0x0p+0 +-0x1p+0, 0x1p+2 +-0x1p+0, 0x1p+3 +-0x1p+0, 0x1.8p+3 +# small base +0x1.fffffp-1, -0x1.d22a5p+22 +0x1.fffffp-1, -0x1.17b2fcp+22 +0x1.fffffp-1, -0x1.74eea4p+20 +0x1.fffffp-1, 0x1.74eebp+20 +0x1.fffffp-1, 0x1.17b2fcp+22 +0x1.fffffp-1, 0x1.d22a5p+22 +0x1.fffff8p-1, -0x1.d22a5p+22 +0x1.fffff8p-1, -0x1.17b2fcp+22 +0x1.fffff8p-1, -0x1.74eea4p+20 +0x1.fffff8p-1, 0x1.74eebp+20 +0x1.fffff8p-1, 0x1.17b2fcp+22 +0x1.fffff8p-1, 0x1.d22a5p+22 +0x1p+0, -0x1.d22a5p+22 +0x1p+0, -0x1.17b2fcp+22 +0x1p+0, -0x1.74eea4p+20 +0x1p+0, 0x1.74eebp+20 +0x1p+0, 0x1.17b2fcp+22 +0x1p+0, 0x1.d22a5p+22 +0x1.000004p+0, -0x1.d22a5p+22 +0x1.000004p+0, -0x1.17b2fcp+22 +0x1.000004p+0, -0x1.74eea4p+20 +0x1.000004p+0, 0x1.74eebp+20 +0x1.000004p+0, 0x1.17b2fcp+22 +0x1.000004p+0, 0x1.d22a5p+22 +0x1.000008p+0, -0x1.d22a5p+22 +0x1.000008p+0, -0x1.17b2fcp+22 +0x1.000008p+0, -0x1.74eea4p+20 +0x1.000008p+0, 0x1.74eebp+20 +0x1.000008p+0, 0x1.17b2fcp+22 +0x1.000008p+0, 0x1.d22a5p+22 +0x1.00001p+0, -0x1.d22a5p+22 +0x1.00001p+0, -0x1.17b2fcp+22 +0x1.00001p+0, -0x1.74eea4p+20 +0x1.00001p+0, 0x1.74eebp+20 +0x1.00001p+0, 0x1.17b2fcp+22 +0x1.00001p+0, 0x1.d22a5p+22 +# small exponent +0x1p-126, -0x1p-32 +0x1p-126, -0x1.333334p-33 +0x1p-126, -0x1.99999cp-35 +0x1p-126, 0x1.9999ap-35 +0x1p-126, 0x1.333334p-33 +0x1p-126, 0x1p-32 +0x1.999998p+29, -0x1p-32 +0x1.999998p+29, -0x1.333334p-33 +0x1.999998p+29, -0x1.99999cp-35 +0x1.999998p+29, 0x1.9999ap-35 +0x1.999998p+29, 0x1.333334p-33 +0x1.999998p+29, 0x1p-32 +0x1.999998p+30, -0x1p-32 +0x1.999998p+30, -0x1.333334p-33 +0x1.999998p+30, -0x1.99999cp-35 +0x1.999998p+30, 0x1.9999ap-35 +0x1.999998p+30, 0x1.333334p-33 +0x1.999998p+30, 0x1p-32 +0x1.333332p+31, -0x1p-32 +0x1.333332p+31, -0x1.333334p-33 +0x1.333332p+31, -0x1.99999cp-35 +0x1.333332p+31, 0x1.9999ap-35 +0x1.333332p+31, 0x1.333334p-33 +0x1.333332p+31, 0x1p-32 +0x1.999998p+31, -0x1p-32 +0x1.999998p+31, -0x1.333334p-33 +0x1.999998p+31, -0x1.99999cp-35 +0x1.999998p+31, 0x1.9999ap-35 +0x1.999998p+31, 0x1.333334p-33 +0x1.999998p+31, 0x1p-32 +0x1.fffffep+31, -0x1p-32 +0x1.fffffep+31, -0x1.333334p-33 +0x1.fffffep+31, -0x1.99999cp-35 +0x1.fffffep+31, 0x1.9999ap-35 +0x1.fffffep+31, 0x1.333334p-33 +0x1.fffffep+31, 0x1p-32