From patchwork Tue May 12 20:30:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 471532 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C8586140D16 for ; Wed, 13 May 2015 06:31:58 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=vFkhgPFz; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=mjgmjndrGG/0W1KdGoNPhce4Z7/2+8xsDawB6XNX8zkKadFG6p72O 4VzPyXmjXPTi3/rTUz4Nl2RiLb7OSWRoIl49sYpyiAoa95SS8oY6hQ8tjx47Jdxr dUQs9AtMRRv1/UInyT/FDNqOh4TztpdmUexJQKmOu2g1pmTuqIBHgA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:in-reply-to:references; s=default; bh=328u9Fr8sm57GS1NNrhiVC5behM=; b=vFkhgPFz8WxBXS4iu3DJAJvbC7wv 6MnelOqVk2zUxiUJCHV4lN4rSguohBt610soU/+DZk/soHmuUpNJzvC3h8L7u5cS cWfpNpMjjsPlpOxxC8to5s5V00sngyV91+Q+BuGJ6yT3vWoANK3HYBN/05sRZWl2 Pa9XVCoXrKteVLo= Received: (qmail 75596 invoked by alias); 12 May 2015 20:31:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk 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 75386 invoked by uid 89); 12 May 2015 20:31:15 -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-f176.google.com Received: from mail-wi0-f176.google.com (HELO mail-wi0-f176.google.com) (209.85.212.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 12 May 2015 20:31:14 +0000 Received: by wizk4 with SMTP id k4so170397472wiz.1 for ; Tue, 12 May 2015 13:31:11 -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=OA8buc5+w14wMuXHDTgU5heF3/oycrr00K91pNT9A8c=; b=ShCNz65gvc9k587me1owIgsOXXlo+gBaZsJfzCChA0C1prTXYh5xcnalxX95Z4ZgWn buPWx7xGLl1hOoBmFwUdnTquCNODGnk6mqeQH0RWs4ouOCMYmv//qk5sBYgQDDsO2w69 7x6zlfF4NU40FvahkqYc4pa0xZ0mLbUhemM02ybueifMp8U03o7IkRDZkoh6wVfYPvLT gu9F5tITJb22LZkEbLmB739WJeTLT3mqXSjDL+W6GCT9qVa1SGBvozWUlWfoZ0PmwHZW TNyLwkmScHb0vDb5vB1gSyX19O63VbESU+zXRr2OUaXgzErgpsyQ3zYjrPbJ9R69ZxEY KRKQ== X-Gm-Message-State: ALoCoQkKMgllUi3cjlJf0G0GJTmbvJSpBkUNEgND8PWcKxcgsQ62Y+Q/Kp2vo5UgRnaDnF8M/uBp X-Received: by 10.194.2.47 with SMTP id 15mr33747978wjr.101.1431462671301; Tue, 12 May 2015 13:31:11 -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.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 May 2015 13:31:10 -0700 (PDT) From: Christophe Lyon To: gcc-patches@gcc.gnu.org Subject: [Patch ARM-AArch64/testsuite Neon intrinsics 02/13] Add vqmovun tests. Date: Tue, 12 May 2015 22:30:50 +0200 Message-Id: <1431462661-27247-3-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 diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqmovun.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqmovun.c new file mode 100644 index 0000000..d744765 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqmovun.c @@ -0,0 +1,93 @@ +#include +#include "arm-neon-ref.h" +#include "compute-ref-data.h" + +/* Expected values of cumulative_saturation flag. */ +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,uint,8,8) [] = { 0x34, 0x34, 0x34, 0x34, + 0x34, 0x34, 0x34, 0x34 }; +VECT_VAR_DECL(expected,uint,16,4) [] = { 0x5678, 0x5678, 0x5678, 0x5678 }; +VECT_VAR_DECL(expected,uint,32,2) [] = { 0x12345678, 0x12345678 }; + +/* Expected values of cumulative_saturation flag with negative input. */ +int VECT_VAR(expected_cumulative_sat_neg,uint,8,8) = 1; +int VECT_VAR(expected_cumulative_sat_neg,uint,16,4) = 1; +int VECT_VAR(expected_cumulative_sat_neg,uint,32,2) = 1; + +/* Expected results with negative input. */ +VECT_VAR_DECL(expected_neg,uint,8,8) [] = { 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0 }; +VECT_VAR_DECL(expected_neg,uint,16,4) [] = { 0x0, 0x0, 0x0, 0x0 }; +VECT_VAR_DECL(expected_neg,uint,32,2) [] = { 0x0, 0x0 }; + +#define INSN_NAME vqmovun +#define TEST_MSG "VQMOVUN" + +#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##_s##W2(VECT_VAR(vector, int, 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) + + DECL_VARIABLE(vector, int, 16, 8); + DECL_VARIABLE(vector, int, 32, 4); + DECL_VARIABLE(vector, int, 64, 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, 0x34); + VDUP(vector, q, int, s, 32, 4, 0x5678); + VDUP(vector, q, int, s, 64, 2, 0x12345678); + + /* Apply a unary operator named INSN_NAME. */ +#define 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, 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 negative values. */ + VDUP(vector, q, int, s, 16, 8, 0x8234); + VDUP(vector, q, int, s, 32, 4, 0x87654321); + VDUP(vector, q, int, s, 64, 2, 0x8765432187654321LL); + + /* Apply a unary operator named INSN_NAME. */ +#undef CMT +#define CMT " (negative input)" + TEST_UNARY_OP(INSN_NAME, uint, u, 8, 16, 8, expected_cumulative_sat_neg, CMT); + TEST_UNARY_OP(INSN_NAME, uint, u, 16, 32, 4, expected_cumulative_sat_neg, CMT); + TEST_UNARY_OP(INSN_NAME, uint, u, 32, 64, 2, expected_cumulative_sat_neg, CMT); + + CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected_neg, CMT); + CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected_neg, CMT); + CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected_neg, CMT); +} + +int main (void) +{ + exec_vqmovun (); + return 0; +}