From patchwork Wed May 27 20:15: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: 49027 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 803CB202A3 for ; Wed, 27 May 2015 20:17:05 +0000 (UTC) Received: by lagv1 with SMTP id v1sf5585229lag.1 for ; Wed, 27 May 2015 13:17:04 -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=IV1aWwAAhXhGoiudSwgrWyIEN8hhHxTe0CmKa+9m2P4=; b=GeSbfTCB53N6loXn4uxlFS9ZvIHQrG4tL4lg2mMy/9KTI87606YIyxjIEPRVcUahb/ gOzJYppKW7cROY/aXbyo6LOX7QlqM1WexVt3II+UjOBNuoLM8ZYXcvWXIWPw0fFk2w04 CPQ9WAEh9T3LQAAkzFHsTDCbhmfr6dCQbzDj0ulve72FhPQkCrng1KCH4fBVM1lRKqtV sLuAOuXfgp/7yhCwRP/Yx6Rw9TNkymelq3SL925xsPiqSy/AiVff7N6d8TsoeNyFIjgl Cr3ReORk9nhekigpaVxIeLwYSZSFMDwk4W5MLO+Nq/7GMERIC/rdzBNF6cxLyDW+4Fu9 R8FQ== X-Gm-Message-State: ALoCoQmE/Ux/MXr07dO7L+ICfSZhGZw/2tQex957baxbGkm+LDO2LubrcvnwkOlUC59NNbGZFr8Z X-Received: by 10.112.166.137 with SMTP id zg9mr33713579lbb.11.1432757824330; Wed, 27 May 2015 13:17:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.116.74 with SMTP id ju10ls101375lab.23.gmail; Wed, 27 May 2015 13:17:04 -0700 (PDT) X-Received: by 10.152.19.198 with SMTP id h6mr29736725lae.62.1432757824178; Wed, 27 May 2015 13:17:04 -0700 (PDT) Received: from mail-la0-x22e.google.com (mail-la0-x22e.google.com. [2a00:1450:4010:c03::22e]) by mx.google.com with ESMTPS id lb7si29985lac.89.2015.05.27.13.17.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 May 2015 13:17:03 -0700 (PDT) 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 labpy14 with SMTP id py14so4309710lab.0 for ; Wed, 27 May 2015 13:17:03 -0700 (PDT) X-Received: by 10.152.206.75 with SMTP id lm11mr29052606lac.41.1432757823856; Wed, 27 May 2015 13:17:03 -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 hn6csp626554lbb; Wed, 27 May 2015 13:17:02 -0700 (PDT) X-Received: by 10.68.198.36 with SMTP id iz4mr62104444pbc.167.1432757821838; Wed, 27 May 2015 13:17:01 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id iw6si18862pbd.183.2015.05.27.13.17.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 May 2015 13:17:01 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-399110-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 36925 invoked by alias); 27 May 2015 20:16:08 -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 36813 invoked by uid 89); 27 May 2015 20:16:07 -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; Wed, 27 May 2015 20:16:00 +0000 Received: by wizk4 with SMTP id k4so124255141wiz.1 for ; Wed, 27 May 2015 13:15:57 -0700 (PDT) X-Received: by 10.180.85.9 with SMTP id d9mr9537983wiz.28.1432757757764; Wed, 27 May 2015 13:15:57 -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.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 May 2015 13:15:57 -0700 (PDT) From: Christophe Lyon To: gcc-patches@gcc.gnu.org Subject: [Patch ARM-AArch64/testsuite Neon intrinsics 04/20] Add vrev tests. Date: Wed, 27 May 2015 22:15:31 +0200 Message-Id: <1432757747-4891-5-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::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 diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vrev.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vrev.c new file mode 100644 index 0000000..3b574da --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vrev.c @@ -0,0 +1,200 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results for vrev16. */ +VECT_VAR_DECL(expected_vrev16,int,8,8) [] = { 0xf1, 0xf0, 0xf3, 0xf2, + 0xf5, 0xf4, 0xf7, 0xf6 }; +VECT_VAR_DECL(expected_vrev16,uint,8,8) [] = { 0xf1, 0xf0, 0xf3, 0xf2, + 0xf5, 0xf4, 0xf7, 0xf6 }; +VECT_VAR_DECL(expected_vrev16,poly,8,8) [] = { 0xf1, 0xf0, 0xf3, 0xf2, + 0xf5, 0xf4, 0xf7, 0xf6 }; +VECT_VAR_DECL(expected_vrev16,int,8,16) [] = { 0xf1, 0xf0, 0xf3, 0xf2, + 0xf5, 0xf4, 0xf7, 0xf6, + 0xf9, 0xf8, 0xfb, 0xfa, + 0xfd, 0xfc, 0xff, 0xfe }; +VECT_VAR_DECL(expected_vrev16,uint,8,16) [] = { 0xf1, 0xf0, 0xf3, 0xf2, + 0xf5, 0xf4, 0xf7, 0xf6, + 0xf9, 0xf8, 0xfb, 0xfa, + 0xfd, 0xfc, 0xff, 0xfe }; +VECT_VAR_DECL(expected_vrev16,poly,8,16) [] = { 0xf1, 0xf0, 0xf3, 0xf2, + 0xf5, 0xf4, 0xf7, 0xf6, + 0xf9, 0xf8, 0xfb, 0xfa, + 0xfd, 0xfc, 0xff, 0xfe }; + +/* Expected results for vrev32. */ +VECT_VAR_DECL(expected_vrev32,int,8,8) [] = { 0xf3, 0xf2, 0xf1, 0xf0, + 0xf7, 0xf6, 0xf5, 0xf4 }; +VECT_VAR_DECL(expected_vrev32,int,16,4) [] = { 0xfff1, 0xfff0, 0xfff3, 0xfff2 }; +VECT_VAR_DECL(expected_vrev32,uint,8,8) [] = { 0xf3, 0xf2, 0xf1, 0xf0, + 0xf7, 0xf6, 0xf5, 0xf4 }; +VECT_VAR_DECL(expected_vrev32,uint,16,4) [] = { 0xfff1, 0xfff0, 0xfff3, 0xfff2 }; +VECT_VAR_DECL(expected_vrev32,poly,8,8) [] = { 0xf3, 0xf2, 0xf1, 0xf0, + 0xf7, 0xf6, 0xf5, 0xf4 }; +VECT_VAR_DECL(expected_vrev32,poly,16,4) [] = { 0xfff1, 0xfff0, 0xfff3, 0xfff2 }; +VECT_VAR_DECL(expected_vrev32,int,8,16) [] = { 0xf3, 0xf2, 0xf1, 0xf0, + 0xf7, 0xf6, 0xf5, 0xf4, + 0xfb, 0xfa, 0xf9, 0xf8, + 0xff, 0xfe, 0xfd, 0xfc }; +VECT_VAR_DECL(expected_vrev32,int,16,8) [] = { 0xfff1, 0xfff0, 0xfff3, 0xfff2, + 0xfff5, 0xfff4, 0xfff7, 0xfff6 }; +VECT_VAR_DECL(expected_vrev32,uint,8,16) [] = { 0xf3, 0xf2, 0xf1, 0xf0, + 0xf7, 0xf6, 0xf5, 0xf4, + 0xfb, 0xfa, 0xf9, 0xf8, + 0xff, 0xfe, 0xfd, 0xfc }; +VECT_VAR_DECL(expected_vrev32,uint,16,8) [] = { 0xfff1, 0xfff0, 0xfff3, 0xfff2, + 0xfff5, 0xfff4, 0xfff7, 0xfff6 }; +VECT_VAR_DECL(expected_vrev32,poly,8,16) [] = { 0xf3, 0xf2, 0xf1, 0xf0, + 0xf7, 0xf6, 0xf5, 0xf4, + 0xfb, 0xfa, 0xf9, 0xf8, + 0xff, 0xfe, 0xfd, 0xfc }; +VECT_VAR_DECL(expected_vrev32,poly,16,8) [] = { 0xfff1, 0xfff0, 0xfff3, 0xfff2, + 0xfff5, 0xfff4, 0xfff7, 0xfff6 }; + +/* Expected results for vrev64. */ +VECT_VAR_DECL(expected_vrev64,int,8,8) [] = { 0xf7, 0xf6, 0xf5, 0xf4, + 0xf3, 0xf2, 0xf1, 0xf0 }; +VECT_VAR_DECL(expected_vrev64,int,16,4) [] = { 0xfff3, 0xfff2, 0xfff1, 0xfff0 }; +VECT_VAR_DECL(expected_vrev64,int,32,2) [] = { 0xfffffff1, 0xfffffff0 }; +VECT_VAR_DECL(expected_vrev64,uint,8,8) [] = { 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, + 0xf2, 0xf1, 0xf0 }; +VECT_VAR_DECL(expected_vrev64,uint,16,4) [] = { 0xfff3, 0xfff2, 0xfff1, 0xfff0 }; +VECT_VAR_DECL(expected_vrev64,uint,32,2) [] = { 0xfffffff1, 0xfffffff0 }; +VECT_VAR_DECL(expected_vrev64,poly,8,8) [] = { 0xf7, 0xf6, 0xf5, 0xf4, + 0xf3, 0xf2, 0xf1, 0xf0 }; +VECT_VAR_DECL(expected_vrev64,poly,16,4) [] = { 0xfff3, 0xfff2, 0xfff1, 0xfff0 }; +VECT_VAR_DECL(expected_vrev64,hfloat,32,2) [] = { 0xc1700000, 0xc1800000 }; +VECT_VAR_DECL(expected_vrev64,int,8,16) [] = { 0xf7, 0xf6, 0xf5, 0xf4, + 0xf3, 0xf2, 0xf1, 0xf0, + 0xff, 0xfe, 0xfd, 0xfc, + 0xfb, 0xfa, 0xf9, 0xf8 }; +VECT_VAR_DECL(expected_vrev64,int,16,8) [] = { 0xfff3, 0xfff2, 0xfff1, 0xfff0, + 0xfff7, 0xfff6, 0xfff5, 0xfff4 }; +VECT_VAR_DECL(expected_vrev64,int,32,4) [] = { 0xfffffff1, 0xfffffff0, + 0xfffffff3, 0xfffffff2 }; +VECT_VAR_DECL(expected_vrev64,uint,8,16) [] = { 0xf7, 0xf6, 0xf5, 0xf4, + 0xf3, 0xf2, 0xf1, 0xf0, + 0xff, 0xfe, 0xfd, 0xfc, + 0xfb, 0xfa, 0xf9, 0xf8 }; +VECT_VAR_DECL(expected_vrev64,uint,16,8) [] = { 0xfff3, 0xfff2, 0xfff1, 0xfff0, + 0xfff7, 0xfff6, 0xfff5, 0xfff4 }; +VECT_VAR_DECL(expected_vrev64,uint,32,4) [] = { 0xfffffff1, 0xfffffff0, + 0xfffffff3, 0xfffffff2 }; +VECT_VAR_DECL(expected_vrev64,poly,8,16) [] = { 0xf7, 0xf6, 0xf5, 0xf4, + 0xf3, 0xf2, 0xf1, 0xf0, + 0xff, 0xfe, 0xfd, 0xfc, + 0xfb, 0xfa, 0xf9, 0xf8 }; +VECT_VAR_DECL(expected_vrev64,poly,16,8) [] = { 0xfff3, 0xfff2, 0xfff1, 0xfff0, + 0xfff7, 0xfff6, 0xfff5, 0xfff4 }; +VECT_VAR_DECL(expected_vrev64,hfloat,32,4) [] = { 0xc1700000, 0xc1800000, + 0xc1500000, 0xc1600000 }; + +void exec_vrev (void) +{ + /* Basic test: y=vrev(x), then store the result. */ +#define TEST_VREV(Q, T1, T2, W, N, W2) \ + VECT_VAR(vector_res, T1, W, N) = \ + vrev##W2##Q##_##T2##W(VECT_VAR(vector, T1, W, N)); \ + vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) + + DECL_VARIABLE_ALL_VARIANTS(vector); + DECL_VARIABLE_ALL_VARIANTS(vector_res); + + clean_results (); + + /* Initialize input "vector" from "buffer". */ + TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); + VLOAD(vector, buffer, , float, f, 32, 2); + VLOAD(vector, buffer, q, float, f, 32, 4); + + /* Check vrev in each of the existing combinations. */ +#define TEST_MSG "VREV16" + TEST_VREV(, int, s, 8, 8, 16); + TEST_VREV(, uint, u, 8, 8, 16); + TEST_VREV(, poly, p, 8, 8, 16); + TEST_VREV(q, int, s, 8, 16, 16); + TEST_VREV(q, uint, u, 8, 16, 16); + TEST_VREV(q, poly, p, 8, 16, 16); + + CHECK(TEST_MSG, int, 8, 8, PRIx8, expected_vrev16, ""); + CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected_vrev16, ""); + CHECK(TEST_MSG, poly, 8, 8, PRIx8, expected_vrev16, ""); + CHECK(TEST_MSG, int, 8, 16, PRIx8, expected_vrev16, ""); + CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_vrev16, ""); + CHECK(TEST_MSG, poly, 8, 16, PRIx8, expected_vrev16, ""); + +#undef TEST_MSG +#define TEST_MSG "VREV32" + TEST_VREV(, int, s, 8, 8, 32); + TEST_VREV(, int, s, 16, 4, 32); + TEST_VREV(, uint, u, 8, 8, 32); + TEST_VREV(, uint, u, 16, 4, 32); + TEST_VREV(, poly, p, 8, 8, 32); + TEST_VREV(, poly, p, 16, 4, 32); + TEST_VREV(q, int, s, 8, 16, 32); + TEST_VREV(q, int, s, 16, 8, 32); + TEST_VREV(q, uint, u, 8, 16, 32); + TEST_VREV(q, uint, u, 16, 8, 32); + TEST_VREV(q, poly, p, 8, 16, 32); + TEST_VREV(q, poly, p, 16, 8, 32); + + CHECK(TEST_MSG, int, 8, 8, PRIx8, expected_vrev32, ""); + CHECK(TEST_MSG, int, 16, 4, PRIx16, expected_vrev32, ""); + CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected_vrev32, ""); + CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected_vrev32, ""); + CHECK(TEST_MSG, poly, 8, 8, PRIx8, expected_vrev32, ""); + CHECK(TEST_MSG, poly, 16, 4, PRIx16, expected_vrev32, ""); + CHECK(TEST_MSG, int, 8, 16, PRIx8, expected_vrev32, ""); + CHECK(TEST_MSG, int, 16, 8, PRIx16, expected_vrev32, ""); + CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_vrev32, ""); + CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected_vrev32, ""); + CHECK(TEST_MSG, poly, 8, 16, PRIx8, expected_vrev32, ""); + CHECK(TEST_MSG, poly, 16, 8, PRIx16, expected_vrev32, ""); + +#undef TEST_MSG +#define TEST_MSG "VREV64" + TEST_VREV(, int, s, 8, 8, 64); + TEST_VREV(, int, s, 16, 4, 64); + TEST_VREV(, int, s, 32, 2, 64); + TEST_VREV(, uint, u, 8, 8, 64); + TEST_VREV(, uint, u, 16, 4, 64); + TEST_VREV(, uint, u, 32, 2, 64); + TEST_VREV(, poly, p, 8, 8, 64); + TEST_VREV(, poly, p, 16, 4, 64); + TEST_VREV(q, int, s, 8, 16, 64); + TEST_VREV(q, int, s, 16, 8, 64); + TEST_VREV(q, int, s, 32, 4, 64); + TEST_VREV(q, uint, u, 8, 16, 64); + TEST_VREV(q, uint, u, 16, 8, 64); + TEST_VREV(q, uint, u, 32, 4, 64); + TEST_VREV(q, poly, p, 8, 16, 64); + TEST_VREV(q, poly, p, 16, 8, 64); + + CHECK(TEST_MSG, int, 8, 8, PRIx8, expected_vrev64, ""); + CHECK(TEST_MSG, int, 16, 4, PRIx16, expected_vrev64, ""); + CHECK(TEST_MSG, int, 32, 2, PRIx32, expected_vrev64, ""); + CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected_vrev64, ""); + CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected_vrev64, ""); + CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected_vrev64, ""); + CHECK(TEST_MSG, poly, 8, 8, PRIx8, expected_vrev64, ""); + CHECK(TEST_MSG, poly, 16, 4, PRIx16, expected_vrev64, ""); + CHECK(TEST_MSG, int, 8, 16, PRIx8, expected_vrev64, ""); + CHECK(TEST_MSG, int, 16, 8, PRIx16, expected_vrev64, ""); + CHECK(TEST_MSG, int, 32, 4, PRIx32, expected_vrev64, ""); + CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_vrev64, ""); + CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected_vrev64, ""); + CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected_vrev64, ""); + CHECK(TEST_MSG, poly, 8, 16, PRIx8, expected_vrev64, ""); + CHECK(TEST_MSG, poly, 16, 8, PRIx16, expected_vrev64, ""); + + TEST_VREV(, float, f, 32, 2, 64); + TEST_VREV(q, float, f, 32, 4, 64); + CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected_vrev64, ""); + CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected_vrev64, ""); +} + +int main (void) +{ + exec_vrev (); + return 0; +}