From patchwork Tue Jan 13 15:18:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 43050 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 62A1220DE8 for ; Tue, 13 Jan 2015 15:28:21 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e53sf2282495eek.3 for ; Tue, 13 Jan 2015 07:28:20 -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=UA+yrB9//4KO8G4W7L47bxMQIj/RsA4++uZO+4ygM7g=; b=OekM6YCEwT1OcIxpLGybwqyk/s4QFXTarr8CtRUSAKAq6x0HUb4CfA5SQlwfnzarsX WNs0buKgJ3cE0rjpEIgS9trPE0L/m30HvBh4akqafZm8sQCAdUIMMM7WfAh56D4RCWEg X0X0rOo4EFPO7p9JWrS35KtPCFrMoPOgxUuTxbAowvugDJ+h1seI60N2OkItPETovEUv ndA1DlzB25zfFdcEe1wO+KWGuzjACjUcnbKItSMT80ZFHR6nIK3OJo5i/6er5y++Zeof fRqyTo4rCMN4vqgdGPWDG/wwKZaldEDVsiqmS/TXPvQ+Kjz91FrrZCCHZXiczBAixmvV YcRA== X-Gm-Message-State: ALoCoQngbM1m/cXSbvo5NPCeS9rLIgqFttWjsA+d+lA1oaE5waw1Fne0haRI1xaphA5lkh7nt/Ny X-Received: by 10.194.92.34 with SMTP id cj2mr414788wjb.5.1421162900576; Tue, 13 Jan 2015 07:28:20 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.7 with SMTP id f7ls6106laa.100.gmail; Tue, 13 Jan 2015 07:28:20 -0800 (PST) X-Received: by 10.112.12.65 with SMTP id w1mr42645260lbb.68.1421162900284; Tue, 13 Jan 2015 07:28:20 -0800 (PST) Received: from mail-lb0-x22c.google.com (mail-lb0-x22c.google.com. [2a00:1450:4010:c04::22c]) by mx.google.com with ESMTPS id 2si3203110lai.59.2015.01.13.07.28.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 07:28:20 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22c as permitted sender) client-ip=2a00:1450:4010:c04::22c; Received: by mail-lb0-f172.google.com with SMTP id z12so3159230lbi.3 for ; Tue, 13 Jan 2015 07:28:20 -0800 (PST) X-Received: by 10.112.89.232 with SMTP id br8mr42885565lbb.69.1421162900170; Tue, 13 Jan 2015 07:28:20 -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 c8csp1415978lbb; Tue, 13 Jan 2015 07:28:19 -0800 (PST) X-Received: by 10.68.232.33 with SMTP id tl1mr52612035pbc.65.1421162898180; Tue, 13 Jan 2015 07:28:18 -0800 (PST) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id gw10si27202880pbd.213.2015.01.13.07.28.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jan 2015 07:28:18 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-389059-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 26394 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 25354 invoked by uid 89); 13 Jan 2015 15:19:34 -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-wg0-f46.google.com Received: from mail-wg0-f46.google.com (HELO mail-wg0-f46.google.com) (74.125.82.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 13 Jan 2015 15:19:31 +0000 Received: by mail-wg0-f46.google.com with SMTP id x13so3554422wgg.5 for ; Tue, 13 Jan 2015 07:19:28 -0800 (PST) X-Received: by 10.180.108.232 with SMTP id hn8mr8007924wib.39.1421162368343; Tue, 13 Jan 2015 07:19:28 -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.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jan 2015 07:19:27 -0800 (PST) From: Christophe Lyon To: gcc-patches@gcc.gnu.org Subject: [[ARM/AArch64][testsuite] 33/36] Add vqdmulh_n tests. Date: Tue, 13 Jan 2015 16:18:31 +0100 Message-Id: <1421162314-25779-34-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::22c 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_n.c: New file. diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqdmulh_n.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqdmulh_n.c new file mode 100644 index 0000000..ab66e2d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqdmulh_n.c @@ -0,0 +1,110 @@ +#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) [] = { 0x19, 0x19, 0x19, 0x19 }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0x4, 0x4 }; +VECT_VAR_DECL(expected,int,16,8) [] = { 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10 }; +VECT_VAR_DECL(expected,int,32,4) [] = { 0xa, 0xa, 0xa, 0xa }; + +/* 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_N" +#define FNNAME1(NAME) exec_ ## NAME ## _n +#define FNNAME(NAME) FNNAME1(NAME) + +void FNNAME (INSN_NAME) (void) +{ + int i; + + /* vector_res = vqdmulh_n(vector,val), then store the result. */ +#define TEST_VQDMULH_N2(INSN, Q, T1, T2, W, N, 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##_n_##T2##W(VECT_VAR(vector, T1, W, N), \ + 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_N1(INSN, Q, T1, T2, W, N, L, EXPECTED_CUMULATIVE_SAT, CMT) \ + TEST_VQDMULH_N2(INSN, Q, T1, T2, W, N, L, EXPECTED_CUMULATIVE_SAT, CMT) + +#define TEST_VQDMULH_N(Q, T1, T2, W, N, L, EXPECTED_CUMULATIVE_SAT, CMT) \ + TEST_VQDMULH_N1(INSN_NAME, Q, T1, T2, W, N, 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); + + clean_results (); + + /* Initialize vector. */ + VDUP(vector, , int, s, 16, 4, 0x1000); + VDUP(vector, , int, s, 32, 2, 0x100023); + VDUP(vector, q, int, s, 16, 8, 0x1000); + VDUP(vector, q, int, s, 32, 4, 0x100045); + + /* Choose multiplier arbitrarily. */ + TEST_VQDMULH_N(, int, s, 16, 4, 0xCF, expected_cumulative_sat, ""); + TEST_VQDMULH_N(, int, s, 32, 2, 0x2344, expected_cumulative_sat, ""); + TEST_VQDMULH_N(q, int, s, 16, 8, 0x80, expected_cumulative_sat, ""); + TEST_VQDMULH_N(q, int, s, 32, 4, 0x5422, 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); + +#define TEST_MSG2 " (check mul cumulative saturation)" + TEST_VQDMULH_N(, int, s, 16, 4, 0x8000, expected_cumulative_sat2, TEST_MSG2); + TEST_VQDMULH_N(, int, s, 32, 2, 0x80000000, expected_cumulative_sat2, TEST_MSG2); + TEST_VQDMULH_N(q, int, s, 16, 8, 0x8000, expected_cumulative_sat2, TEST_MSG2); + TEST_VQDMULH_N(q, int, s, 32, 4, 0x80000000, 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; +}