From patchwork Tue May 12 20:30:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 48402 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AC8DC2121F for ; Tue, 12 May 2015 20:31:52 +0000 (UTC) Received: by wivs14 with SMTP id s14sf5808609wiv.1 for ; Tue, 12 May 2015 13:31:52 -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=5MShGr6b1tROuVIOD8SlOZPI8cNSQ0lkceoBB/66ZWw=; b=d5mDQwuu2P+iwM+6wua7GfBnRh8D3AdKzGUWVTMlWzaJUFDeEKru0zyDvRBEmbfXpV RiJ52zBP72ZmH+ChQuMCPj4ffdZW7o6zIQsP7sQ3p75ZMRVxoKB95NVNvzlVreBNXyPB P0zqVEG5EG1KZCtIf2DAWgz+LzAduUSFMm7/ucIDzSyoeBT/ckZoQJt+8KbT2fSZfLQs rbdKkl57aHUNODSIslq5mEgrkk0QBRdbNeUXFhPnFbeZwc/0Qkc5rvAFQWR2wunKVGUR GW3JoY6Y/a6mWkWyCD7gWBQDqflJfAAbMMhnnxvncrgF4NuCYXHcT/97+WM3U+KkWUS5 VbiQ== X-Gm-Message-State: ALoCoQmbM5GS2VO74EukB4COgh5HFYuh8j7cIZK1Ls8/tcJt2Ac17m94X7RFDroFyfuRi0ASiTHp X-Received: by 10.180.85.129 with SMTP id h1mr2871424wiz.6.1431462712017; Tue, 12 May 2015 13:31:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.100 with SMTP id j4ls92387lah.92.gmail; Tue, 12 May 2015 13:31:51 -0700 (PDT) X-Received: by 10.112.120.199 with SMTP id le7mr13226798lbb.48.1431462711791; Tue, 12 May 2015 13:31:51 -0700 (PDT) Received: from mail-lb0-x232.google.com (mail-lb0-x232.google.com. [2a00:1450:4010:c04::232]) by mx.google.com with ESMTPS id pj6si11024812lbb.17.2015.05.12.13.31.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 May 2015 13:31:51 -0700 (PDT) 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 lbbuc2 with SMTP id uc2so14837423lbb.2 for ; Tue, 12 May 2015 13:31:51 -0700 (PDT) X-Received: by 10.112.182.4 with SMTP id ea4mr13653914lbc.35.1431462711516; Tue, 12 May 2015 13:31:51 -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 hn6csp136447lbb; Tue, 12 May 2015 13:31:50 -0700 (PDT) X-Received: by 10.68.222.167 with SMTP id qn7mr30841501pbc.136.1431462709644; Tue, 12 May 2015 13:31:49 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id gm10si22642738pbd.98.2015.05.12.13.31.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 May 2015 13:31:49 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-397710-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 75556 invoked by alias); 12 May 2015 20:31:19 -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 75354 invoked by uid 89); 12 May 2015 20:31:15 -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-f172.google.com Received: from mail-wi0-f172.google.com (HELO mail-wi0-f172.google.com) (209.85.212.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 12 May 2015 20:31:13 +0000 Received: by wicmc15 with SMTP id mc15so62933523wic.1 for ; Tue, 12 May 2015 13:31:10 -0700 (PDT) X-Received: by 10.180.97.164 with SMTP id eb4mr8410540wib.3.1431462670191; Tue, 12 May 2015 13:31:10 -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 u9sm24921095wju.44.2015.05.12.13.31.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 May 2015 13:31:09 -0700 (PDT) From: Christophe Lyon To: gcc-patches@gcc.gnu.org Subject: [Patch ARM-AArch64/testsuite Neon intrinsics 01/13] Add vqmovn tests. Date: Tue, 12 May 2015 22:30:49 +0200 Message-Id: <1431462661-27247-2-git-send-email-christophe.lyon@linaro.org> In-Reply-To: <1431462661-27247-1-git-send-email-christophe.lyon@linaro.org> References: <1431462661-27247-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 diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqmovn.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqmovn.c new file mode 100644 index 0000000..b4d3198 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqmovn.c @@ -0,0 +1,134 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected values of cumulative_saturation flag. */ +int VECT_VAR(expected_cumulative_sat,int,8,8) = 0; +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,uint,8,8) = 0; +int VECT_VAR(expected_cumulative_sat,uint,16,4) = 0; +int VECT_VAR(expected_cumulative_sat,uint,32,2) = 0; + +/* Expected results. */ +VECT_VAR_DECL(expected,int,8,8) [] = { 0x12, 0x12, 0x12, 0x12, + 0x12, 0x12, 0x12, 0x12 }; +VECT_VAR_DECL(expected,int,16,4) [] = { 0x1278, 0x1278, 0x1278, 0x1278 }; +VECT_VAR_DECL(expected,int,32,2) [] = { 0x12345678, 0x12345678 }; +VECT_VAR_DECL(expected,uint,8,8) [] = { 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82 }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0x8765, 0x8765, 0x8765, 0x8765 }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0x87654321, 0x87654321 }; + +/* Expected values of cumulative_saturation flag when saturation occurs. */ +int VECT_VAR(expected_cumulative_sat1,int,8,8) = 1; +int VECT_VAR(expected_cumulative_sat1,int,16,4) = 1; +int VECT_VAR(expected_cumulative_sat1,int,32,2) = 1; +int VECT_VAR(expected_cumulative_sat1,uint,8,8) = 1; +int VECT_VAR(expected_cumulative_sat1,uint,16,4) = 1; +int VECT_VAR(expected_cumulative_sat1,uint,32,2) = 1; + +/* Expected results when saturation occurs. */ +VECT_VAR_DECL(expected1,int,8,8) [] = { 0x7f, 0x7f, 0x7f, 0x7f, + 0x7f, 0x7f, 0x7f, 0x7f }; +VECT_VAR_DECL(expected1,int,16,4) [] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff }; +VECT_VAR_DECL(expected1,int,32,2) [] = { 0x7fffffff, 0x7fffffff }; +VECT_VAR_DECL(expected1,uint,8,8) [] = { 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff }; +VECT_VAR_DECL(expected1,uint,16,4) [] = { 0xffff, 0xffff, 0xffff, 0xffff }; +VECT_VAR_DECL(expected1,uint,32,2) [] = { 0xffffffff, 0xffffffff }; + +#define INSN_NAME vqmovn +#define TEST_MSG "VQMOVN" + +#define FNNAME1(NAME) void exec_ ## NAME (void) +#define FNNAME(NAME) FNNAME1(NAME) + +FNNAME (INSN_NAME) +{ + /* Basic test: y=OP(x), then store the result. */ +#define TEST_UNARY_OP1(INSN, T1, T2, W, W2, 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##_##T2##W2(VECT_VAR(vector, T1, W2, N)); \ + vst1##_##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) + +#define TEST_UNARY_OP(INSN, T1, T2, W, W2, N, EXPECTED_CUMULATIVE_SAT, CMT) \ + TEST_UNARY_OP1(INSN, T1, T2, W, W2, N, EXPECTED_CUMULATIVE_SAT, CMT) + + /* No need for 64 bits variants. */ + DECL_VARIABLE(vector, int, 16, 8); + DECL_VARIABLE(vector, int, 32, 4); + DECL_VARIABLE(vector, int, 64, 2); + DECL_VARIABLE(vector, uint, 16, 8); + DECL_VARIABLE(vector, uint, 32, 4); + DECL_VARIABLE(vector, uint, 64, 2); + + DECL_VARIABLE(vector_res, int, 8, 8); + DECL_VARIABLE(vector_res, int, 16, 4); + DECL_VARIABLE(vector_res, int, 32, 2); + DECL_VARIABLE(vector_res, uint, 8, 8); + DECL_VARIABLE(vector_res, uint, 16, 4); + DECL_VARIABLE(vector_res, uint, 32, 2); + + clean_results (); + + /* Fill input vector with arbitrary values. */ + VDUP(vector, q, int, s, 16, 8, 0x12); + VDUP(vector, q, int, s, 32, 4, 0x1278); + VDUP(vector, q, int, s, 64, 2, 0x12345678); + VDUP(vector, q, uint, u, 16, 8, 0x82); + VDUP(vector, q, uint, u, 32, 4, 0x8765); + VDUP(vector, q, uint, u, 64, 2, 0x87654321); + + /* Apply a unary operator named INSN_NAME. */ +#define CMT "" + TEST_UNARY_OP(INSN_NAME, int, s, 8, 16, 8, expected_cumulative_sat, CMT); + TEST_UNARY_OP(INSN_NAME, int, s, 16, 32, 4, expected_cumulative_sat, CMT); + TEST_UNARY_OP(INSN_NAME, int, s, 32, 64, 2, expected_cumulative_sat, CMT); + TEST_UNARY_OP(INSN_NAME, uint, u, 8, 16, 8, expected_cumulative_sat, CMT); + TEST_UNARY_OP(INSN_NAME, uint, u, 16, 32, 4, expected_cumulative_sat, CMT); + TEST_UNARY_OP(INSN_NAME, uint, u, 32, 64, 2, expected_cumulative_sat, CMT); + + CHECK(TEST_MSG, int, 8, 8, PRIx8, expected, CMT); + CHECK(TEST_MSG, int, 16, 4, PRIx16, expected, CMT); + CHECK(TEST_MSG, int, 32, 2, PRIx32, expected, CMT); + CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected, CMT); + CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected, CMT); + CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected, CMT); + + + /* Fill input vector with arbitrary values which cause cumulative + saturation. */ + VDUP(vector, q, int, s, 16, 8, 0x1234); + VDUP(vector, q, int, s, 32, 4, 0x12345678); + VDUP(vector, q, int, s, 64, 2, 0x1234567890ABLL); + VDUP(vector, q, uint, u, 16, 8, 0x8234); + VDUP(vector, q, uint, u, 32, 4, 0x87654321); + VDUP(vector, q, uint, u, 64, 2, 0x8765432187654321ULL); + + /* Apply a unary operator named INSN_NAME. */ +#undef CMT +#define CMT " (with saturation)" + TEST_UNARY_OP(INSN_NAME, int, s, 8, 16, 8, expected_cumulative_sat1, CMT); + TEST_UNARY_OP(INSN_NAME, int, s, 16, 32, 4, expected_cumulative_sat1, CMT); + TEST_UNARY_OP(INSN_NAME, int, s, 32, 64, 2, expected_cumulative_sat1, CMT); + TEST_UNARY_OP(INSN_NAME, uint, u, 8, 16, 8, expected_cumulative_sat1, CMT); + TEST_UNARY_OP(INSN_NAME, uint, u, 16, 32, 4, expected_cumulative_sat1, CMT); + TEST_UNARY_OP(INSN_NAME, uint, u, 32, 64, 2, expected_cumulative_sat1, CMT); + + CHECK(TEST_MSG, int, 8, 8, PRIx8, expected1, CMT); + CHECK(TEST_MSG, int, 16, 4, PRIx16, expected1, CMT); + CHECK(TEST_MSG, int, 32, 2, PRIx32, expected1, CMT); + CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected1, CMT); + CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected1, CMT); + CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected1, CMT); +} + +int main (void) +{ + exec_vqmovn (); + return 0; +}