From patchwork Thu Jul 2 13:44:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 50593 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 80CD9214B3 for ; Thu, 2 Jul 2015 13:44:45 +0000 (UTC) Received: by wgjx7 with SMTP id x7sf21303220wgj.3 for ; Thu, 02 Jul 2015 06:44:44 -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 :x-original-sender:x-original-authentication-results; bh=Zjck7h5RmsK3DwTf8I670fmuByj5oycGK++5USax71c=; b=CgcqS8l3HiUrZYZIPKgv0z8IykFLvwgoUA6xs6rjtE3L4OgY4GO3rT9V9kPgEsjmaw AaJ3TqrJdo2xL/cVHGJA1788oHzGGgo80ibFF6MECtNwW4Wh1WG8iYrLmIivbLjWSa8/ 398tnLWtODFA3/jaG1KSVQLEzQ2VQYErzPjalA8qAp7nvNek5w1PUzN7vFmQMTIqjiQ3 V1GH2JDvpYWbZI1E9bbU++kjYCEnrEcx5L1iRs7V3ruhZKaCgkkEUFRiQLlfYrf3948q +BzpVtjU+tqr5gal140ZwErE7uVeeU+33IoIg8Yomwremni/JmvaJrOZF9a5btE2Qa2l go9Q== X-Gm-Message-State: ALoCoQk7HpDNjLSUUr+46E446MIPms9OB3UajpAGQQ8A5Jax9Bcf/XhjnY9Nq7hLW5HtM7qt0BD8 X-Received: by 10.180.81.170 with SMTP id b10mr4766375wiy.4.1435844684840; Thu, 02 Jul 2015 06:44:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.201 with SMTP id t9ls319948laa.95.gmail; Thu, 02 Jul 2015 06:44:44 -0700 (PDT) X-Received: by 10.152.20.106 with SMTP id m10mr2036572lae.7.1435844684423; Thu, 02 Jul 2015 06:44:44 -0700 (PDT) Received: from mail-la0-x22c.google.com (mail-la0-x22c.google.com. [2a00:1450:4010:c03::22c]) by mx.google.com with ESMTPS id kx6si4499135lac.108.2015.07.02.06.44.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 06:44:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22c as permitted sender) client-ip=2a00:1450:4010:c03::22c; Received: by lagx9 with SMTP id x9so61472986lag.1 for ; Thu, 02 Jul 2015 06:44:44 -0700 (PDT) X-Received: by 10.152.26.163 with SMTP id m3mr30660085lag.86.1435844684144; Thu, 02 Jul 2015 06:44:44 -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 hn6csp491809lbb; Thu, 2 Jul 2015 06:44:43 -0700 (PDT) X-Received: by 10.66.146.100 with SMTP id tb4mr66602581pab.70.1435844682320; Thu, 02 Jul 2015 06:44:42 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id z2si9178939par.138.2015.07.02.06.44.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 06:44:42 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-401872-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 109932 invoked by alias); 2 Jul 2015 13:44:29 -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 109921 invoked by uid 89); 2 Jul 2015 13:44:28 -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-f180.google.com Received: from mail-wi0-f180.google.com (HELO mail-wi0-f180.google.com) (209.85.212.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 02 Jul 2015 13:44:27 +0000 Received: by wiwl6 with SMTP id l6so197491789wiw.0 for ; Thu, 02 Jul 2015 06:44:24 -0700 (PDT) X-Received: by 10.180.84.170 with SMTP id a10mr16818094wiz.52.1435844664587; Thu, 02 Jul 2015 06:44:24 -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 u7sm27387115wif.3.2015.07.02.06.44.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Jul 2015 06:44:24 -0700 (PDT) From: Christophe Lyon To: gcc-patches@gcc.gnu.org Subject: [Patch ARM-AArch64/testsuite Neon intrinsics: vget_lane Date: Thu, 2 Jul 2015 15:44:18 +0200 Message-Id: <1435844658-20945-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::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 Hi, Here is the missing test for ARM/AArch64 AdvSIMD intrinsic: vget_lane. Tested on arm, armeb, aarch64 and aarch64_be targets (using QEMU). The tests all pass, expect on armeb where vgetq_lane_s64 and vgetq_lane_u64 fail. I haven't investigated in details yet. OK for trunk? 2015-07-02 Christophe Lyon * gcc.target/aarch64/advsimd-intrinsics/vget_lane.c: New testcase. diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_lane.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_lane.c new file mode 100644 index 0000000..5806050 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_lane.c @@ -0,0 +1,125 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected results. */ +int8_t expected_s8 = 0xf7; +int16_t expected_s16 = 0xfff3; +int32_t expected_s32 = 0xfffffff1; +int64_t expected_s64 = 0xfffffffffffffff0; +uint8_t expected_u8 = 0xf6; +uint16_t expected_u16 = 0xfff2; +uint32_t expected_u32 = 0xfffffff1; +uint64_t expected_u64 = 0xfffffffffffffff0; +poly8_t expected_p8 = 0xf6; +poly16_t expected_p16 = 0xfff2; +hfloat32_t expected_f32 = 0xc1700000; + +int8_t expectedq_s8 = 0xff; +int16_t expectedq_s16 = 0xfff5; +int32_t expectedq_s32 = 0xfffffff3; +int64_t expectedq_s64 = 0xfffffffffffffff1; +uint8_t expectedq_u8 = 0xfe; +uint16_t expectedq_u16 = 0xfff6; +uint32_t expectedq_u32 = 0xfffffff2; +uint64_t expectedq_u64 = 0xfffffffffffffff1; +poly8_t expectedq_p8 = 0xfe; +poly16_t expectedq_p16 = 0xfff6; +hfloat32_t expectedq_f32 = 0xc1500000; + +int error_found = 0; + +#define TEST_MSG "VGET_LANE" +void exec_vget_lane (void) +{ + /* vec=vget_lane(vec, lane), then store the result. */ +#define TEST_VGET_LANE(Q, T1, T2, W, N, L) \ + VAR(var, T1, W) = vget##Q##_lane_##T2##W(VECT_VAR(vector, T1, W, N), L); \ + if (VAR(var, T1, W) != expected##Q##_##T2##W) { \ + fprintf(stderr, \ + "ERROR in %s (%s line %d in result '%s') at type %s " \ + "got 0x%" PRIx##W " != 0x%" PRIx##W "\n", \ + TEST_MSG, __FILE__, __LINE__, \ + STR(expected##Q##_##T2##W), \ + STR(VECT_NAME(T1, W, N)), \ + VAR(var, T1, W), \ + expected##Q##_##T2##W); \ + error_found = 1; \ + } + + /* Special variant for floating-point. */ + union { + uint32_t var_int32; + float32_t var_float32; + } var_int32_float32; + +#define TEST_VGET_LANE_FP(Q, T1, T2, W, N, L) \ + VAR(var, T1, W) = vget##Q##_lane_##T2##W(VECT_VAR(vector, T1, W, N), L); \ + var_int##W##_float##W.var_float##W = VAR(var, T1, W); \ + if (var_int##W##_float##W.var_int##W != expected##Q##_##T2##W) { \ + fprintf(stderr, \ + "ERROR in %s (%s line %d in result '%s') at type %s " \ + "got 0x%" PRIx##W " != 0x%" PRIx##W "\n", \ + TEST_MSG, __FILE__, __LINE__, \ + STR(expected##Q##_##T2##W), \ + STR(VECT_NAME(T1, W, N)), \ + var_int##W##_float##W.var_int##W, \ + expected##Q##_##T2##W); \ + error_found = 1; \ + } + + DECL_VARIABLE_ALL_VARIANTS(vector); + + /* Scalar variables. */ + VAR_DECL(var, int, 8); + VAR_DECL(var, int, 16); + VAR_DECL(var, int, 32); + VAR_DECL(var, int, 64); + VAR_DECL(var, uint, 8); + VAR_DECL(var, uint, 16); + VAR_DECL(var, uint, 32); + VAR_DECL(var, uint, 64); + VAR_DECL(var, poly, 8); + VAR_DECL(var, poly, 16); + VAR_DECL(var, float, 32); + + /* Initialize input values. */ + TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); + VLOAD(vector, buffer, , float, f, 32, 2); + VLOAD(vector, buffer, q, float, f, 32, 4); + + /* Choose lane arbitrarily. */ + TEST_VGET_LANE(, int, s, 8, 8, 7); + TEST_VGET_LANE(, int, s, 16, 4, 3); + TEST_VGET_LANE(, int, s, 32, 2, 1); + TEST_VGET_LANE(, int, s, 64, 1, 0); + TEST_VGET_LANE(, uint, u, 8, 8, 6); + TEST_VGET_LANE(, uint, u, 16, 4, 2); + TEST_VGET_LANE(, uint, u, 32, 2, 1); + TEST_VGET_LANE(, uint, u, 64, 1, 0); + TEST_VGET_LANE(, poly, p, 8, 8, 6); + TEST_VGET_LANE(, poly, p, 16, 4, 2); + TEST_VGET_LANE_FP(, float, f, 32, 2, 1); + + TEST_VGET_LANE(q, int, s, 8, 16, 15); + TEST_VGET_LANE(q, int, s, 16, 8, 5); + TEST_VGET_LANE(q, int, s, 32, 4, 3); + TEST_VGET_LANE(q, int, s, 64, 2, 1); + TEST_VGET_LANE(q, uint, u, 8, 16, 14); + TEST_VGET_LANE(q, uint, u, 16, 8, 6); + TEST_VGET_LANE(q, uint, u, 32, 4, 2); + TEST_VGET_LANE(q, uint, u, 64, 2, 1); + TEST_VGET_LANE(q, poly, p, 8, 16, 14); + TEST_VGET_LANE(q, poly, p, 16, 8, 6); + TEST_VGET_LANE_FP(q, float, f, 32, 4, 3); +} + +int main (void) +{ + exec_vget_lane (); + + if (error_found) + abort(); + + return 0; +}