From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 0B7913848016 for ; Tue, 27 Apr 2021 12:13:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0B7913848016 Received: by mail-pf1-x42e.google.com with SMTP id 10so5804182pfl.1 for ; Tue, 27 Apr 2021 05:13:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=m7RJM7nzCyB3zO0KsyIdGAIGjwMi5/oPMLt8itKB2QI=; b=McaOC6rXuUFfnzAlsTPIuDfNven0XKyrNNWLyBs+EYJN9WyzE/Qnqs7w48R69BRkHc SMQqRo52dtxDLj3y/T7kwziATwUmrMbvEREMZfxDHtMSfWtXMnTr1nJlLKNNOn3JpzXC GuHiFZkjBkIgVt2ZZliCTlVtb53W5THNgDwPMcMQbEPQ78lzLpxKp8kt3+Q/tva9mLwB LUtpAzv4UhMwblR9tFfd+9YVWoUVrw2H30FcYIlrqdJKk/mj6Eu6H9SC+CF27+oOw3tO bumeTl40yGzKn3B16XBJL9WJqzAOHHhanIE4GVKJO0dPEEEHJKTNBP4jJhTLj69WCHSQ Ye4w== X-Gm-Message-State: AOAM5314bCYQVY2O31ZLlFq8aueuapQQ3KjEBQT8Ux/lG0j8BNoW7sZS TJXRCigszdzDzF5veMKihxRxRuRHdIcfeiL3IRJfSA== X-Google-Smtp-Source: ABdhPJx85FNHwSYTXyIoH6AlO4H0YqJBOSZ7k3x387dyzZdFoDUNqUygHwfy47f8m8N5SKHChpHVf9CTFfXu3OspcLY= X-Received: by 2002:a62:ac08:0:b029:25d:642e:8201 with SMTP id v8-20020a62ac080000b029025d642e8201mr22848730pfe.59.1619525612028; Tue, 27 Apr 2021 05:13:32 -0700 (PDT) MIME-Version: 1.0 References: <1619523128-14792-1-git-send-email-christophe.lyon@linaro.org> <1619523128-14792-4-git-send-email-christophe.lyon@linaro.org> In-Reply-To: From: Christophe Lyon Date: Tue, 27 Apr 2021 14:13:21 +0200 Message-ID: Subject: Re: [PATCH] testsuite/arm: Add mve-vadd-1.c test To: Prathamesh Kulkarni Cc: gcc Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Apr 2021 12:13:34 -0000 On Tue, 27 Apr 2021 at 14:04, Prathamesh Kulkarni wrote: > > On Tue, 27 Apr 2021 at 17:02, Christophe Lyon via Gcc-patches > wrote: > > > > Support for vadd has been present for a while, but it was lacking a > > test. > > > > 2021-04-22 Christophe Lyon > > > > gcc/testsuite/ > > * gcc.target/arm/simd/mve-vadd-1.c: New. > > --- > > gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c | 43 ++++++++++++++++++++++++++ > > 1 file changed, 43 insertions(+) > > create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c > > > > diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c > > new file mode 100644 > > index 0000000..15a9daa > > --- /dev/null > > +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-1.c > > @@ -0,0 +1,43 @@ > > +/* { dg-do compile } */ > > +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */ > > +/* { dg-add-options arm_v8_1m_mve_fp } */ > > +/* { dg-additional-options "-O3" } */ > > + > > +#include > > + > > +#define FUNC(SIGN, TYPE, BITS, NB, OP, NAME) \ > > + void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \ > > + TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \ > > + int i; \ > > + for (i=0; i > + dest[i] = a[i] OP b[i]; \ > > + } \ > > +} > > + > > +/* 128-bit vectors. */ > > +FUNC(s, int, 32, 4, +, vadd) > > +FUNC(u, uint, 32, 4, +, vadd) > > +FUNC(s, int, 16, 8, +, vadd) > > +FUNC(u, uint, 16, 8, +, vadd) > > +FUNC(s, int, 8, 16, +, vadd) > > +FUNC(u, uint, 8, 16, +, vadd) > Sorry to nitpick -- just wondering if it'd be slightly better to add > another macro that will generate calls to FUNC with s, u variants ? > > Sth like: > #define FUNC2(BITS, NB, OP, NAME) \ > FUNC(s, int, BITS, NB, OP, NAME) \ > FUNC(u, uint, BITS, NB, OP, NAME) > > and use: > FUNC2(int, 32, 4, +, vadd) > FUNC2(int, 16, 8, + vadd) > FUNC2(int, 8, 16, +, vadd) > Indeed we could do that, but several other mve-* tests use the same pattern I used here. Well, the ones I committed some time ago :-) The advantage is that when suitable we can use the same FUNC to expand the fp16 version. I tend to prefer my proposal because it's more obvious to me which types are used. Christophe > Thanks, > Prathamesh > > + > > +/* { dg-final { scan-assembler-times {vadd\.i32 q[0-9]+, q[0-9]+, q[0-9]+} 2 } } */ > > +/* { dg-final { scan-assembler-times {vadd\.i16 q[0-9]+, q[0-9]+, q[0-9]+} 2 } } */ > > +/* { dg-final { scan-assembler-times {vadd\.i8 q[0-9]+, q[0-9]+, q[0-9]+} 2 } } */ > > + > > +void test_vadd_f32 (float * dest, float * a, float * b) { > > + int i; > > + for (i=0; i<4; i++) { > > + dest[i] = a[i] + b[i]; > > + } > > +} > > +/* { dg-final { scan-assembler-times {vadd\.f32 q[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ > > + > > +void test_vadd_f16 (__fp16 * dest, __fp16 * a, __fp16 * b) { > > + int i; > > + for (i=0; i<8; i++) { > > + dest[i] = a[i] + b[i]; > > + } > > +} > > +/* { dg-final { scan-assembler-times {vadd\.f16 q[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ > > -- > > 2.7.4 > >