From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36925 invoked by alias); 27 May 2015 20:16:08 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 36813 invoked by uid 89); 27 May 2015 20:16:07 -0000 Authentication-Results: sourceware.org; auth=none 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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=IV1aWwAAhXhGoiudSwgrWyIEN8hhHxTe0CmKa+9m2P4=; b=eOoF0TQMpeqqLmf2EJy2rfUZUGn66ihC7YkkgO9+ElrxZPJO+p90LpixBIXrvsBNJz E9NoM4JNKZj1XyKlFBwc1Rx0MxwseXm4B/TnJGfZblZme66ojzIDYLWQQJrulDQxSraL TK63cXbGVy5TyK9bkNECuVAPx/RRznQ7v5lJOeOvjqDvZmC2L4O9fOcs9bd5RHJp+ao6 4hOippKdyHk6w7AQgVE9EF4RhxscT62AukpJ4EsSjwxmfHOlSvTaeGJlKx2CR89xzq6j E9S+ykT8el6PpW78pL729rmKmqyLj65Zj4BZqKU1m3oYc+LJvjd0DOMGkkBEYgJn0X90 bNiw== X-Gm-Message-State: ALoCoQnpOj8oLMnodi3Rg1DTccAayqKYetS6Xfda/p2cdP5mxXkUQRB5YgAvr3ODH7fNcz3XEbCy 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 20:51:00 -0000 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-SW-Source: 2015-05/txt/msg02564.txt.bz2 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; +} -- 2.1.4