From patchwork Wed May 27 20:15:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 49025 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 09A6B202A3 for ; Wed, 27 May 2015 20:16:39 +0000 (UTC) Received: by lbcue7 with SMTP id ue7sf5394116lbc.3 for ; Wed, 27 May 2015 13:16:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:sender:delivered-to:from:to:subject:date:message-id :in-reply-to:references:x-original-sender :x-original-authentication-results; bh=zhJUrIuo4d+C9XRFMRks47Je/7z9CUPb1yY4j6FtEZA=; b=R/QdrkxtNS/R2r9/6qgZMPmul9+w4N6f6ssjb2szZeEZrO+75g3K9GdSEyLPEo0/cD Q11cxiewOZSLH4V6QvC2BIzG6H7x/+yeU2sQOt/UQ8+T78SU6xxTnIQ1GsV3NE1F5kUq 9hu80QnNTdi/M6xlV/Cr2jR8Z8VX1Ex/0nduUqkup7yaZKrWfLDEUeznaDHm+cJlYQdh 79T/dty/zmFmVSt/HgnUydQR1QfYloIwspFGiSjTJWs7jJxqNF+U1EDOPDs1duNZIcAk SQvmKonci6sFT0P1hVwqypSh1MQzGfSWbBx0om6EkmgyUylKIu9aVnhVA81BxHuMKANQ 1TzQ== X-Gm-Message-State: ALoCoQngPuHhVQmwmyzEk1YFbW+1/LhkyWBOMXhMJcZljrTGuu3BhmUai5Dyu7jcHNYzQM0sUFov X-Received: by 10.112.42.236 with SMTP id r12mr33817830lbl.2.1432757797629; Wed, 27 May 2015 13:16:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.181.34 with SMTP id dt2ls96498lac.14.gmail; Wed, 27 May 2015 13:16:37 -0700 (PDT) X-Received: by 10.153.4.135 with SMTP id ce7mr29611632lad.44.1432757797481; Wed, 27 May 2015 13:16:37 -0700 (PDT) Received: from mail-la0-x233.google.com (mail-la0-x233.google.com. [2a00:1450:4010:c03::233]) by mx.google.com with ESMTPS id wo9si6009lbb.170.2015.05.27.13.16.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 May 2015 13:16:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::233 as permitted sender) client-ip=2a00:1450:4010:c03::233; Received: by labpy14 with SMTP id py14so4301091lab.0 for ; Wed, 27 May 2015 13:16:37 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr29732867lbc.19.1432757796943; Wed, 27 May 2015 13:16:36 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp626306lbb; Wed, 27 May 2015 13:16:35 -0700 (PDT) X-Received: by 10.68.94.193 with SMTP id de1mr61149133pbb.153.1432757795176; Wed, 27 May 2015 13:16:35 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id a5si6238pdn.226.2015.05.27.13.16.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 May 2015 13:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-399108-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 36207 invoked by alias); 27 May 2015 20:16:02 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 36125 invoked by uid 89); 27 May 2015 20:16:02 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f179.google.com Received: from mail-wi0-f179.google.com (HELO mail-wi0-f179.google.com) (209.85.212.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 27 May 2015 20:15:58 +0000 Received: by wizk4 with SMTP id k4so124254115wiz.1 for ; Wed, 27 May 2015 13:15:55 -0700 (PDT) X-Received: by 10.180.72.176 with SMTP id e16mr9591769wiv.12.1432757755447; Wed, 27 May 2015 13:15:55 -0700 (PDT) Received: from babel.clyon.hd.free.fr (vig38-2-82-225-222-175.fbx.proxad.net. [82.225.222.175]) by mx.google.com with ESMTPSA id u7sm76992wif.3.2015.05.27.13.15.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 May 2015 13:15:54 -0700 (PDT) From: Christophe Lyon To: gcc-patches@gcc.gnu.org Subject: [Patch ARM-AArch64/testsuite Neon intrinsics 02/20] Add vrecps tests. Date: Wed, 27 May 2015 22:15:29 +0200 Message-Id: <1432757747-4891-3-git-send-email-christophe.lyon@linaro.org> In-Reply-To: <1432757747-4891-1-git-send-email-christophe.lyon@linaro.org> References: <1432757747-4891-1-git-send-email-christophe.lyon@linaro.org> X-IsSubscribed: yes X-Original-Sender: christophe.lyon@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::233 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vrecps.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vrecps.c new file mode 100644 index 0000000..0e41947 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vrecps.c @@ -0,0 +1,117 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" +#include + +/* Expected results with positive input. */ +VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc2e19eb7, 0xc2e19eb7 }; +VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0xc1db851f, 0xc1db851f, + 0xc1db851f, 0xc1db851f }; + +/* Expected results with FP special values (NaN). */ +VECT_VAR_DECL(expected_fp1,hfloat,32,2) [] = { 0x7fc00000, 0x7fc00000 }; +VECT_VAR_DECL(expected_fp1,hfloat,32,4) [] = { 0x7fc00000, 0x7fc00000, + 0x7fc00000, 0x7fc00000 }; + +/* Expected results with FP special values (infinity, 0) and normal + values. */ +VECT_VAR_DECL(expected_fp2,hfloat,32,2) [] = { 0xff800000, 0xff800000 }; +VECT_VAR_DECL(expected_fp2,hfloat,32,4) [] = { 0x40000000, 0x40000000, + 0x40000000, 0x40000000 }; + +/* Expected results with FP special values (infinity, 0). */ +VECT_VAR_DECL(expected_fp3,hfloat,32,2) [] = { 0x40000000, 0x40000000 }; +VECT_VAR_DECL(expected_fp3,hfloat,32,4) [] = { 0x40000000, 0x40000000, + 0x40000000, 0x40000000 }; + +#define TEST_MSG "VRECPS/VRECPSQ" +void exec_vrecps(void) +{ + int i; + + /* Basic test: y=vrecps(x), then store the result. */ +#define TEST_VRECPS(Q, T1, T2, W, N) \ + VECT_VAR(vector_res, T1, W, N) = \ + vrecps##Q##_##T2##W(VECT_VAR(vector, T1, W, N), \ + VECT_VAR(vector2, T1, W, N)); \ + vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \ + VECT_VAR(vector_res, T1, W, N)) + + /* No need for integer variants. */ + DECL_VARIABLE(vector, float, 32, 2); + DECL_VARIABLE(vector, float, 32, 4); + + DECL_VARIABLE(vector2, float, 32, 2); + DECL_VARIABLE(vector2, float, 32, 4); + + DECL_VARIABLE(vector_res, float, 32, 2); + DECL_VARIABLE(vector_res, float, 32, 4); + + clean_results (); + + /* Choose init value arbitrarily. */ + VDUP(vector, , float, f, 32, 2, 12.9f); + VDUP(vector, q, float, f, 32, 4, 9.2f); + + VDUP(vector2, , float, f, 32, 2, 8.9f); + VDUP(vector2, q, float, f, 32, 4, 3.2f); + + /* Apply the operator. */ + TEST_VRECPS(, float, f, 32, 2); + TEST_VRECPS(q, float, f, 32, 4); + +#define CMT " (positive input)" + CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected, CMT); + CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected, CMT); + + + /* Test FP variants with special input values (NaN). */ + VDUP(vector, , float, f, 32, 2, NAN); + VDUP(vector2, q, float, f, 32, 4, NAN); + + /* Apply the operator. */ + TEST_VRECPS(, float, f, 32, 2); + TEST_VRECPS(q, float, f, 32, 4); + +#undef CMT +#define CMT " FP special (NaN)" + CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected_fp1, CMT); + CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected_fp1, CMT); + + + /* Test FP variants with special input values (infinity, 0). */ + VDUP(vector, , float, f, 32, 2, HUGE_VALF); + VDUP(vector, q, float, f, 32, 4, 0.0f); + VDUP(vector2, q, float, f, 32, 4, 3.2f); /* Restore a normal value. */ + + /* Apply the operator. */ + TEST_VRECPS(, float, f, 32, 2); + TEST_VRECPS(q, float, f, 32, 4); + +#undef CMT +#define CMT " FP special (infinity, 0) and normal value" + CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected_fp2, CMT); + CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected_fp2, CMT); + + + /* Test FP variants with only special input values (infinity, 0). */ + VDUP(vector, , float, f, 32, 2, HUGE_VALF); + VDUP(vector, q, float, f, 32, 4, 0.0f); + VDUP(vector2, , float, f, 32, 2, 0.0f); + VDUP(vector2, q, float, f, 32, 4, HUGE_VALF); + + /* Apply the operator */ + TEST_VRECPS(, float, f, 32, 2); + TEST_VRECPS(q, float, f, 32, 4); + +#undef CMT +#define CMT " FP special (infinity, 0)" + CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected_fp3, CMT); + CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected_fp3, CMT); +} + +int main (void) +{ + exec_vrecps (); + return 0; +}