From patchwork Tue Jan 13 15:18: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: 43049 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D547E20DE8 for ; Tue, 13 Jan 2015 15:28:05 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id t10sf1491090eei.2 for ; Tue, 13 Jan 2015 07:28:05 -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=/jg7hobYO3CxezBdpXevx9T+4Mkl/W8TBlzqPRYtH8o=; b=gl5s/83wZWGrzSF3vS8XElfEJf5n1W/iIlyiQlz6SR/vC88cpirPl7ttqhnvZ8WM4M ko/b+6IrBP3WieGnGnFYlwJ6l134I59eBIDhgMm3T3MFJ8nP9C4XbjBXuy6eCpx3JgnL 55V28jt7jp/lMd6k3GBJqkhvXgy+HP9o0VkJVcEpk5b5ju1yHH9/An4Bk6epVd1qSlJO 5MqM5TPjR1zZ55eAI6+qwroI3KEDV+k4MUnmMg4zYHBo7FkCLat6RGwVVIO7YRi55tZ6 1wrAv80SIHfCLL6RU/MLt6Int3p2DB1BWZTQ5nGJihc4T/yBDqf4zS7+gfJY64kYfRjU Khdg== X-Gm-Message-State: ALoCoQmU2R0zABDvsVtKrB1ZvwuDbN1ZTNTPSMArEYPg0v9hQxaD9yVS8mwOL53KiuptPUzRJkzN X-Received: by 10.152.10.233 with SMTP id l9mr4551199lab.0.1421162884998; Tue, 13 Jan 2015 07:28:04 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.131 with SMTP id am3ls6758lac.47.gmail; Tue, 13 Jan 2015 07:28:04 -0800 (PST) X-Received: by 10.112.170.69 with SMTP id ak5mr43197152lbc.71.1421162884859; Tue, 13 Jan 2015 07:28:04 -0800 (PST) Received: from mail-la0-x22e.google.com (mail-la0-x22e.google.com. [2a00:1450:4010:c03::22e]) by mx.google.com with ESMTPS id ds5si24479634lbc.138.2015.01.13.07.28.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 07:28:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22e as permitted sender) client-ip=2a00:1450:4010:c03::22e; Received: by mail-la0-f46.google.com with SMTP id q1so3220728lam.5 for ; Tue, 13 Jan 2015 07:28:04 -0800 (PST) X-Received: by 10.112.159.136 with SMTP id xc8mr42627668lbb.98.1421162884427; Tue, 13 Jan 2015 07:28:04 -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 c8csp1415897lbb; Tue, 13 Jan 2015 07:28:03 -0800 (PST) X-Received: by 10.66.123.7 with SMTP id lw7mr53056709pab.103.1421162882379; Tue, 13 Jan 2015 07:28:02 -0800 (PST) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id tl7si27201648pbc.203.2015.01.13.07.28.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jan 2015 07:28:02 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-389058-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 26323 invoked by alias); 13 Jan 2015 15:19:48 -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 25157 invoked by uid 89); 13 Jan 2015 15:19:31 -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-we0-f169.google.com Received: from mail-we0-f169.google.com (HELO mail-we0-f169.google.com) (74.125.82.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 13 Jan 2015 15:19:29 +0000 Received: by mail-we0-f169.google.com with SMTP id m14so3528919wev.0 for ; Tue, 13 Jan 2015 07:19:26 -0800 (PST) X-Received: by 10.194.78.204 with SMTP id d12mr70204429wjx.37.1421162365870; Tue, 13 Jan 2015 07:19:25 -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.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jan 2015 07:19:25 -0800 (PST) From: Christophe Lyon To: gcc-patches@gcc.gnu.org Subject: [[ARM/AArch64][testsuite] 31/36] Add vqdmulh tests. Date: Tue, 13 Jan 2015 16:18:29 +0100 Message-Id: <1421162314-25779-32-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:c03::22e 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.c: New file. diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqdmulh.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqdmulh.c new file mode 100644 index 0000000..8d2a365 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqdmulh.c @@ -0,0 +1,122 @@ +#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" + +#define FNNAME1(NAME) exec_ ## NAME +#define FNNAME(NAME) FNNAME1(NAME) + +void FNNAME (INSN_NAME) (void) +{ + /* vector_res = vqdmulh(vector,vector2,lane), then store the result. */ +#define TEST_VQDMULH2(INSN, Q, T1, T2, W, N, 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##_##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)); \ + CHECK_CUMULATIVE_SAT(TEST_MSG, T1, W, N, EXPECTED_CUMULATIVE_SAT, CMT) + + /* Two auxliary macros are necessary to expand INSN. */ +#define TEST_VQDMULH1(INSN, Q, T1, T2, W, N, EXPECTED_CUMULATIVE_SAT, CMT) \ + TEST_VQDMULH2(INSN, Q, T1, T2, W, N, EXPECTED_CUMULATIVE_SAT, CMT) + +#define TEST_VQDMULH(Q, T1, T2, W, N, EXPECTED_CUMULATIVE_SAT, CMT) \ + TEST_VQDMULH1(INSN_NAME, Q, T1, T2, W, N, 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); + + DECL_VARIABLE(vector2, int, 16, 4); + DECL_VARIABLE(vector2, int, 32, 2); + DECL_VARIABLE(vector2, int, 16, 8); + DECL_VARIABLE(vector2, int, 32, 4); + + 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); + VDUP(vector2, q, int, s, 16, 8, 0x33); + VDUP(vector2, q, int, s, 32, 4, 0x22); + + TEST_VQDMULH(, int, s, 16, 4, expected_cumulative_sat, ""); + TEST_VQDMULH(, int, s, 32, 2, expected_cumulative_sat, ""); + TEST_VQDMULH(q, int, s, 16, 8, expected_cumulative_sat, ""); + TEST_VQDMULH(q, int, s, 32, 4, 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, ""); + + VDUP(vector, , int, s, 16, 4, 0x8000); + VDUP(vector2, , int, s, 16, 4, 0x8000); + VDUP(vector, , int, s, 32, 2, 0x80000000); + VDUP(vector2, , int, s, 32, 2, 0x80000000); + VDUP(vector, q, int, s, 16, 8, 0x8000); + VDUP(vector2, q, int, s, 16, 8, 0x8000); + VDUP(vector, q, int, s, 32, 4, 0x80000000); + VDUP(vector2, q, int, s, 32, 4, 0x80000000); + +#define TEST_MSG2 "with saturation" + TEST_VQDMULH(, int, s, 16, 4, expected_cumulative_sat2, TEST_MSG2); + TEST_VQDMULH(, int, s, 32, 2, expected_cumulative_sat2, TEST_MSG2); + TEST_VQDMULH(q, int, s, 16, 8, expected_cumulative_sat2, TEST_MSG2); + TEST_VQDMULH(q, int, s, 32, 4, 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; +}