From patchwork Tue Jan 13 15:18:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 43051 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5CE3020DE8 for ; Tue, 13 Jan 2015 15:28:37 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id hs14sf2068322lab.1 for ; Tue, 13 Jan 2015 07:28:36 -0800 (PST) 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=ttwdu8q58G7B4DYH5LqTOwVWsOdV1CN51ArALFIasa4=; b=iFeJFUnSiN7d/hcbujdZcLBCpHhYYc3e1pGJ/pqt2gGOvPnkFmDbTySIuRSyZ6yCaT PsYKtGQ1Q9MJkbxGCttBVsitkQ9kfWwPZ7sCertEfai2vGOfdDWuJ0uXCt7DVurkbX/Y eVBH66v0N8TpnzGO4+mJF/qP5fqBfMU24Yq1jWLRVYq0Fa54x3ADY9N9473cdnlyVP6V JhELfb4dNDfYM9IsQqv77x5kIHLfqjM+8IzaZM2GbHXsrr+4NCqCNIy+mIcr3V6iKim0 Y4xeZyRu1pLD89ZofwZasn2BaoPnIZNY04TwIYt/bvUoU5McsO2Rk31s4maq5IVJtHyv /OVQ== X-Gm-Message-State: ALoCoQmV5WobAVcc4nrvcQP6eM7MI/GzssBv6j5bX8Lq4UpCOkIAj8MKcBc7BLCZJBgiodD/IUMf X-Received: by 10.112.42.104 with SMTP id n8mr371127lbl.19.1421162916032; Tue, 13 Jan 2015 07:28:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.133 with SMTP id k5ls7735lah.48.gmail; Tue, 13 Jan 2015 07:28:35 -0800 (PST) X-Received: by 10.112.130.65 with SMTP id oc1mr43074534lbb.7.1421162915898; Tue, 13 Jan 2015 07:28:35 -0800 (PST) Received: from mail-lb0-x232.google.com (mail-lb0-x232.google.com. [2a00:1450:4010:c04::232]) by mx.google.com with ESMTPS id u2si3136004lae.110.2015.01.13.07.28.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 07:28:35 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::232 as permitted sender) client-ip=2a00:1450:4010:c04::232; Received: by mail-lb0-f178.google.com with SMTP id u14so3123234lbd.9 for ; Tue, 13 Jan 2015 07:28:35 -0800 (PST) X-Received: by 10.112.30.71 with SMTP id q7mr42995803lbh.41.1421162915677; Tue, 13 Jan 2015 07:28:35 -0800 (PST) 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.9.200 with SMTP id c8csp1416060lbb; Tue, 13 Jan 2015 07:28:34 -0800 (PST) X-Received: by 10.66.90.201 with SMTP id by9mr51663225pab.148.1421162913718; Tue, 13 Jan 2015 07:28:33 -0800 (PST) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id bn9si27514392pdb.54.2015.01.13.07.28.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jan 2015 07:28:33 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-389060-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 26479 invoked by alias); 13 Jan 2015 15:19:49 -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 25290 invoked by uid 89); 13 Jan 2015 15:19:32 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f175.google.com Received: from mail-wi0-f175.google.com (HELO mail-wi0-f175.google.com) (209.85.212.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 13 Jan 2015 15:19:30 +0000 Received: by mail-wi0-f175.google.com with SMTP id l15so22024980wiw.2 for ; Tue, 13 Jan 2015 07:19:27 -0800 (PST) X-Received: by 10.180.208.76 with SMTP id mc12mr7415388wic.73.1421162367191; Tue, 13 Jan 2015 07:19:27 -0800 (PST) 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 jr4sm26100313wjc.20.2015.01.13.07.19.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jan 2015 07:19:26 -0800 (PST) From: Christophe Lyon To: gcc-patches@gcc.gnu.org Subject: [[ARM/AArch64][testsuite] 32/36] Add vqdmulh_lane tests. Date: Tue, 13 Jan 2015 16:18:30 +0100 Message-Id: <1421162314-25779-33-git-send-email-christophe.lyon@linaro.org> In-Reply-To: <1421162314-25779-1-git-send-email-christophe.lyon@linaro.org> References: <1421162314-25779-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:c04::232 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 * gcc.target/aarch64/advsimd-intrinsics/vqdmulh_lane.c: New file. diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqdmulh_lane.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqdmulh_lane.c new file mode 100644 index 0000000..5260676 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqdmulh_lane.c @@ -0,0 +1,121 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected values of cumulative_saturation flag. */ +int VECT_VAR(expected_cumulative_sat,int,16,4) = 0; +int VECT_VAR(expected_cumulative_sat,int,32,2) = 0; +int VECT_VAR(expected_cumulative_sat,int,16,8) = 0; +int VECT_VAR(expected_cumulative_sat,int,32,4) = 0; + +/* Expected results. */ +VECT_VAR_DECL(expected,int,16,4) [] = { 0xffff, 0xffff, 0xffff, 0xffff }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0xffffffff, 0xffffffff }; +VECT_VAR_DECL(expected,int,16,8) [] = { 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff }; +VECT_VAR_DECL(expected,int,32,4) [] = { 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff }; + +/* Expected values of cumulative_saturation flag when saturation + occurs. */ +int VECT_VAR(expected_cumulative_sat2,int,16,4) = 1; +int VECT_VAR(expected_cumulative_sat2,int,32,2) = 1; +int VECT_VAR(expected_cumulative_sat2,int,16,8) = 1; +int VECT_VAR(expected_cumulative_sat2,int,32,4) = 1; + +/* Expected results when saturation occurs. */ +VECT_VAR_DECL(expected2,int,16,4) [] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff }; +VECT_VAR_DECL(expected2,int,32,2) [] = { 0x7fffffff, 0x7fffffff }; +VECT_VAR_DECL(expected2,int,16,8) [] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff, + 0x7fff, 0x7fff, 0x7fff, 0x7fff }; +VECT_VAR_DECL(expected2,int,32,4) [] = { 0x7fffffff, 0x7fffffff, + 0x7fffffff, 0x7fffffff }; + +#define INSN_NAME vqdmulh +#define TEST_MSG "VQDMULH_LANE" +#define FNNAME1(NAME) exec_ ## NAME ## _lane +#define FNNAME(NAME) FNNAME1(NAME) + +void FNNAME (INSN_NAME) (void) +{ + /* vector_res = vqdmulh_lane(vector,vector2,lane), then store the result. */ +#define TEST_VQDMULH_LANE2(INSN, Q, T1, T2, W, N, N2, L, EXPECTED_CUMULATIVE_SAT, CMT) \ + Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W, N)); \ + VECT_VAR(vector_res, T1, W, N) = \ + INSN##Q##_lane_##T2##W(VECT_VAR(vector, T1, W, N), \ + VECT_VAR(vector2, T1, W, N2), \ + L); \ + vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \ + VECT_VAR(vector_res, T1, W, N)); \ + CHECK_CUMULATIVE_SAT(TEST_MSG, T1, W, N, EXPECTED_CUMULATIVE_SAT, CMT) + + /* Two auxliary macros are necessary to expand INSN. */ +#define TEST_VQDMULH_LANE1(INSN, Q, T1, T2, W, N, N2, L, EXPECTED_CUMULATIVE_SAT, CMT) \ + TEST_VQDMULH_LANE2(INSN, Q, T1, T2, W, N, N2, L, EXPECTED_CUMULATIVE_SAT, CMT) + +#define TEST_VQDMULH_LANE(Q, T1, T2, W, N, N2, L, EXPECTED_CUMULATIVE_SAT, CMT) \ + TEST_VQDMULH_LANE1(INSN_NAME, Q, T1, T2, W, N, N2, L, EXPECTED_CUMULATIVE_SAT, CMT) + + DECL_VARIABLE(vector, int, 16, 4); + DECL_VARIABLE(vector, int, 32, 2); + DECL_VARIABLE(vector, int, 16, 8); + DECL_VARIABLE(vector, int, 32, 4); + + DECL_VARIABLE(vector_res, int, 16, 4); + DECL_VARIABLE(vector_res, int, 32, 2); + DECL_VARIABLE(vector_res, int, 16, 8); + DECL_VARIABLE(vector_res, int, 32, 4); + + /* vector2: vqdmulh_lane and vqdmulhq_lane have a 2nd argument with + the same number of elements, so we need only one variable of each + type. */ + DECL_VARIABLE(vector2, int, 16, 4); + DECL_VARIABLE(vector2, int, 32, 2); + + clean_results (); + + VLOAD(vector, buffer, , int, s, 16, 4); + VLOAD(vector, buffer, , int, s, 32, 2); + VLOAD(vector, buffer, q, int, s, 16, 8); + VLOAD(vector, buffer, q, int, s, 32, 4); + + /* Initialize vector2. */ + VDUP(vector2, , int, s, 16, 4, 0x55); + VDUP(vector2, , int, s, 32, 2, 0xBB); + + /* Choose lane arbitrarily. */ + TEST_VQDMULH_LANE(, int, s, 16, 4, 4, 2, expected_cumulative_sat, ""); + TEST_VQDMULH_LANE(, int, s, 32, 2, 2, 1, expected_cumulative_sat, ""); + TEST_VQDMULH_LANE(q, int, s, 16, 8, 4, 3, expected_cumulative_sat, ""); + TEST_VQDMULH_LANE(q, int, s, 32, 4, 2, 0, expected_cumulative_sat, ""); + + CHECK (TEST_MSG, int, 16, 4, PRIx16, expected, ""); + CHECK (TEST_MSG, int, 32, 2, PRIx32, expected, ""); + CHECK (TEST_MSG, int, 16, 8, PRIx16, expected, ""); + CHECK (TEST_MSG, int, 32, 4, PRIx32, expected, ""); + + /* Choose input values to trigger saturation. */ + VDUP(vector, , int, s, 16, 4, 0x8000); + VDUP(vector, , int, s, 32, 2, 0x80000000); + VDUP(vector, q, int, s, 16, 8, 0x8000); + VDUP(vector, q, int, s, 32, 4, 0x80000000); + VDUP(vector2, , int, s, 16, 4, 0x8000); + VDUP(vector2, , int, s, 32, 2, 0x80000000); + +#define TEST_MSG2 " (check mul cumulative saturation)" + TEST_VQDMULH_LANE(, int, s, 16, 4, 4, 3, expected_cumulative_sat2, TEST_MSG2); + TEST_VQDMULH_LANE(, int, s, 32, 2, 2, 1, expected_cumulative_sat2, TEST_MSG2); + TEST_VQDMULH_LANE(q, int, s, 16, 8, 4, 2, expected_cumulative_sat2, TEST_MSG2); + TEST_VQDMULH_LANE(q, int, s, 32, 4, 2, 1, expected_cumulative_sat2, TEST_MSG2); + + CHECK (TEST_MSG, int, 16, 4, PRIx16, expected2, TEST_MSG2); + CHECK (TEST_MSG, int, 32, 2, PRIx32, expected2, TEST_MSG2); + CHECK (TEST_MSG, int, 16, 8, PRIx16, expected2, TEST_MSG2); + CHECK (TEST_MSG, int, 32, 4, PRIx32, expected2, TEST_MSG2); +} + +int main (void) +{ + FNNAME (INSN_NAME) (); + return 0; +}