From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id 8A8643861012 for ; Sat, 17 Aug 2024 13:53:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A8643861012 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8A8643861012 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::634 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723902841; cv=none; b=j3mfKIu4pvtWirEETvlScOUDEYhJmRT2Wv3zakbXKLDUTPWXmnvy3P4ybouCRx4Y3/WiawUsF+3+8CzFAQ4OTwEvLz3/GJ306BoGXLRoE1/pawaK2mfzrcuqDtyghXFKbGlVIpCQRrkDwGrg9uUzMiwOiwbfS8u8yqDbYEeJK20= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723902841; c=relaxed/simple; bh=7AucFbHCdI01Pqc6TUX9VvXD6xNvD6EbWwDp36HAUBc=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=MwNrKzdAbu7n7U3NUdlS/PR7U89JG5ER1hVJvTfSQaQf4rEYE/LMOlCfT6j/EB1xrMpTU6I7T/kgb9PFMZlTHQ0leW6IDOiRqIXeCGDPTEXV2GlvGjruTch/fnsgP7LkiiWetqsr+6seSA5TnjkrwFg8WtDy94MFM31RRLgtXBk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a7a8a4f21aeso365356766b.2 for ; Sat, 17 Aug 2024 06:53:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723902836; x=1724507636; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=4Vhnhl86zS7mTReWBUnePMClDGVO/jGuVHiJPCxDJns=; b=HeBgzwi/Cej5K/KV7wrUd2hmTDrmZiMd0ogKzHy68hkeOzyMYPkdiY6fqrAuWbIn8t bAaUsdqytm/2fJuWVSPBMXyIVh9a/mxpC4coGbXmRkSmvYxr4HV3gtZmZvrORnYxt0Ln ffjFklPaEfD73BQ7jO3ywY8KXXfpvn9398pmiwCh3ynLuamOoo8m+zlBR2zt/drlZ25N iF9FkMR6Mhqlxo+CaDKO8MvMKOCNRFcTbhRtNsB5e3HiRpDxDDBpsx83zSfBJHzYtE2/ PXEI9A22vAulrRX8gUZmj54H7GBIURdnj3UU4NwQ67ZlF2ArCgfbQlJQMEh6E4Wdicge zJJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723902836; x=1724507636; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4Vhnhl86zS7mTReWBUnePMClDGVO/jGuVHiJPCxDJns=; b=EDRTpoh9DlY0nBliMukdjuh9mf/rMeo7HqHoEHZy22FzdC0QOPZVeA4YgrdwXrqzif xQMnRuL49Evafx7MUFOrmceULIYBh9ioUf8Ac2tylBjx0bHrSzC99CpHfz5rGasInRCZ 0wZBg7CvJDfpl80Hq2xa8ukqgwrvOWRr2SJAvNM0/nvyPce6eyCl7rFg+PmGzwtKnhf4 /iDoZcQzucmup2BKXG3a5lCsbhNPDRPdftIH2dsMSg1wthcXRGnF6gO4lS3LMQH0LvAs UN5H/YnL3z7KTJJpXt256o7ZYGJonGePreqRv97yocbHTT2fJm3jriB0YRTqcAQRo0dE Bthw== X-Gm-Message-State: AOJu0YzgUir6QHK1ocvSu5d3r35yww8EdUVX90QJyMpj/QlGbgij6K1z yPJyVOScMB7jg4WRn5ewR9UtXjmHH+pDqa4vC0mQyyR4W9dZgX4/7yd0ErjhriNGktsNyHdCWhS E8KroWd2VZeHDCgZ7QOSPbFkNTUk= X-Google-Smtp-Source: AGHT+IEoBbmsKSZLAXYdZwdco+seadEZBb+CevG2oAYHOEvimOkgEi/sBO2TBG3PXsw4+suba1K4ajJ3NcqXss+EE1Q= X-Received: by 2002:a17:907:86a4:b0:a7d:34bf:600e with SMTP id a640c23a62f3a-a8392a4a586mr381361966b.60.1723902835490; Sat, 17 Aug 2024 06:53:55 -0700 (PDT) MIME-Version: 1.0 References: <20240817113641.73334-1-pan2.li@intel.com> In-Reply-To: <20240817113641.73334-1-pan2.li@intel.com> From: Kito Cheng Date: Sat, 17 Aug 2024 21:53:43 +0800 Message-ID: Subject: Re: [PATCH v1 1/2] RISC-V: Add testcases for unsigned scalar .SAT_TRUNC form 2 To: pan2.li@intel.com Cc: gcc-patches@gcc.gnu.org, juzhe.zhong@rivai.ai, jeffreyalaw@gmail.com, rdapp.gcc@gmail.com Content-Type: multipart/alternative; boundary="0000000000002308d9061fe16878" X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,HTML_MESSAGE,KAM_NUMSUBJECT,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000002308d9061fe16878 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable LGTM =E6=96=BC 2024=E5=B9=B48=E6=9C=8817=E6=97=A5 =E9=80=B1= =E5=85=AD 19:37 =E5=AF=AB=E9=81=93=EF=BC=9A > From: Pan Li > > This patch would like to add test cases for the unsigned scalar > .SAT_TRUNC form 2. Aka: > > Form 2: > #define DEF_SAT_U_TRUC_FMT_2(NT, WT) \ > NT __attribute__((noinline)) \ > sat_u_truc_##WT##_to_##NT##_fmt_2 (WT x) \ > { \ > WT max =3D (WT)(NT)-1; \ > return x > max ? (NT) max : (NT)x; \ > } > > DEF_SAT_U_TRUC_FMT_2 (uint32_t, uint64_t) > > The below test is passed for this patch. > * The rv64gcv regression test. > > gcc/testsuite/ChangeLog: > > * gcc.target/riscv/sat_arith.h: Add test helper macros. > * gcc.target/riscv/sat_u_trunc-7.c: New test. > * gcc.target/riscv/sat_u_trunc-8.c: New test. > * gcc.target/riscv/sat_u_trunc-9.c: New test. > * gcc.target/riscv/sat_u_trunc-run-7.c: New test. > * gcc.target/riscv/sat_u_trunc-run-8.c: New test. > * gcc.target/riscv/sat_u_trunc-run-9.c: New test. > > Signed-off-by: Pan Li > --- > gcc/testsuite/gcc.target/riscv/sat_arith.h | 12 +++++++++++ > .../gcc.target/riscv/sat_u_trunc-7.c | 17 ++++++++++++++++ > .../gcc.target/riscv/sat_u_trunc-8.c | 20 +++++++++++++++++++ > .../gcc.target/riscv/sat_u_trunc-9.c | 19 ++++++++++++++++++ > .../gcc.target/riscv/sat_u_trunc-run-7.c | 16 +++++++++++++++ > .../gcc.target/riscv/sat_u_trunc-run-8.c | 16 +++++++++++++++ > .../gcc.target/riscv/sat_u_trunc-run-9.c | 16 +++++++++++++++ > 7 files changed, 116 insertions(+) > create mode 100644 gcc/testsuite/gcc.target/riscv/sat_u_trunc-7.c > create mode 100644 gcc/testsuite/gcc.target/riscv/sat_u_trunc-8.c > create mode 100644 gcc/testsuite/gcc.target/riscv/sat_u_trunc-9.c > create mode 100644 gcc/testsuite/gcc.target/riscv/sat_u_trunc-run-7.c > create mode 100644 gcc/testsuite/gcc.target/riscv/sat_u_trunc-run-8.c > create mode 100644 gcc/testsuite/gcc.target/riscv/sat_u_trunc-run-9.c > > diff --git a/gcc/testsuite/gcc.target/riscv/sat_arith.h > b/gcc/testsuite/gcc.target/riscv/sat_arith.h > index 37e0a60f21b..576a4926d1f 100644 > --- a/gcc/testsuite/gcc.target/riscv/sat_arith.h > +++ b/gcc/testsuite/gcc.target/riscv/sat_arith.h > @@ -227,7 +227,19 @@ sat_u_truc_##WT##_to_##NT##_fmt_1 (WT x) \ > } > #define DEF_SAT_U_TRUC_FMT_1_WRAP(NT, WT) DEF_SAT_U_TRUC_FMT_1(NT, WT) > > +#define DEF_SAT_U_TRUC_FMT_2(NT, WT) \ > +NT __attribute__((noinline)) \ > +sat_u_truc_##WT##_to_##NT##_fmt_2 (WT x) \ > +{ \ > + WT max =3D (WT)(NT)-1; \ > + return x > max ? (NT) max : (NT)x; \ > +} > +#define DEF_SAT_U_TRUC_FMT_2_WRAP(NT, WT) DEF_SAT_U_TRUC_FMT_2(NT, WT) > + > #define RUN_SAT_U_TRUC_FMT_1(NT, WT, x) sat_u_truc_##WT##_to_##NT##_fmt_1 > (x) > #define RUN_SAT_U_TRUC_FMT_1_WRAP(NT, WT, x) RUN_SAT_U_TRUC_FMT_1(NT, WT, > x) > > +#define RUN_SAT_U_TRUC_FMT_2(NT, WT, x) sat_u_truc_##WT##_to_##NT##_fmt_2 > (x) > +#define RUN_SAT_U_TRUC_FMT_2_WRAP(NT, WT, x) RUN_SAT_U_TRUC_FMT_2(NT, WT, > x) > + > #endif > diff --git a/gcc/testsuite/gcc.target/riscv/sat_u_trunc-7.c > b/gcc/testsuite/gcc.target/riscv/sat_u_trunc-7.c > new file mode 100644 > index 00000000000..95d513a15fb > --- /dev/null > +++ b/gcc/testsuite/gcc.target/riscv/sat_u_trunc-7.c > @@ -0,0 +1,17 @@ > +/* { dg-do compile } */ > +/* { dg-options "-march=3Drv64gc -mabi=3Dlp64d -O3 -fdump-rtl-expand-det= ails > -fno-schedule-insns -fno-schedule-insns2" } */ > +/* { dg-final { check-function-bodies "**" "" } } */ > + > +#include "sat_arith.h" > + > +/* > +** sat_u_truc_uint16_t_to_uint8_t_fmt_2: > +** sltiu\s+[atx][0-9]+,\s*a0,\s*255 > +** addi\s+[atx][0-9]+,\s*[atx][0-9]+,\s*-1 > +** or\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ > +** andi\s+[atx][0-9]+,\s*[atx][0-9]+,\s*0xff > +** ret > +*/ > +DEF_SAT_U_TRUC_FMT_2(uint8_t, uint16_t) > + > +/* { dg-final { scan-rtl-dump-times ".SAT_TRUNC " 2 "expand" } } */ > diff --git a/gcc/testsuite/gcc.target/riscv/sat_u_trunc-8.c > b/gcc/testsuite/gcc.target/riscv/sat_u_trunc-8.c > new file mode 100644 > index 00000000000..f168912293d > --- /dev/null > +++ b/gcc/testsuite/gcc.target/riscv/sat_u_trunc-8.c > @@ -0,0 +1,20 @@ > +/* { dg-do compile } */ > +/* { dg-options "-march=3Drv64gc -mabi=3Dlp64d -O3 -fdump-rtl-expand-det= ails > -fno-schedule-insns -fno-schedule-insns2" } */ > +/* { dg-final { check-function-bodies "**" "" } } */ > + > +#include "sat_arith.h" > + > +/* > +** sat_u_truc_uint32_t_to_uint16_t_fmt_2: > +** li\s+[atx][0-9]+,\s*65536 > +** addi\s+[atx][0-9]+,\s*[atx][0-9]+,\s*-1 > +** sltu\s+[atx][0-9]+,\s*a0,\s*[atx][0-9]+ > +** addi\s+[atx][0-9]+,\s*[atx][0-9]+,\s*-1 > +** or\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ > +** slli\s+a0,\s*a0,\s*48 > +** srli\s+a0,\s*a0,\s*48 > +** ret > +*/ > +DEF_SAT_U_TRUC_FMT_2(uint16_t, uint32_t) > + > +/* { dg-final { scan-rtl-dump-times ".SAT_TRUNC " 2 "expand" } } */ > diff --git a/gcc/testsuite/gcc.target/riscv/sat_u_trunc-9.c > b/gcc/testsuite/gcc.target/riscv/sat_u_trunc-9.c > new file mode 100644 > index 00000000000..d82363d6aef > --- /dev/null > +++ b/gcc/testsuite/gcc.target/riscv/sat_u_trunc-9.c > @@ -0,0 +1,19 @@ > +/* { dg-do compile } */ > +/* { dg-options "-march=3Drv64gc -mabi=3Dlp64d -O3 -fdump-rtl-expand-det= ails > -fno-schedule-insns -fno-schedule-insns2" } */ > +/* { dg-final { check-function-bodies "**" "" } } */ > + > +#include "sat_arith.h" > + > +/* > +** sat_u_truc_uint64_t_to_uint32_t_fmt_2: > +** li\s+[atx][0-9]+,\s*-1 > +** srli\s+[atx][0-9]+,\s*[atx][0-9]+,\s*32 > +** sltu\s+[atx][0-9]+,\s*a0,\s*[atx][0-9]+ > +** addi\s+[atx][0-9]+,\s*[atx][0-9]+,\s*-1 > +** or\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ > +** sext.w\s+a0,\s*a0 > +** ret > +*/ > +DEF_SAT_U_TRUC_FMT_2(uint32_t, uint64_t) > + > +/* { dg-final { scan-rtl-dump-times ".SAT_TRUNC " 2 "expand" } } */ > diff --git a/gcc/testsuite/gcc.target/riscv/sat_u_trunc-run-7.c > b/gcc/testsuite/gcc.target/riscv/sat_u_trunc-run-7.c > new file mode 100644 > index 00000000000..b98d40fa7ec > --- /dev/null > +++ b/gcc/testsuite/gcc.target/riscv/sat_u_trunc-run-7.c > @@ -0,0 +1,16 @@ > +/* { dg-do run { target { riscv_v } } } */ > +/* { dg-additional-options "-std=3Dc99" } */ > + > +#include "sat_arith.h" > +#include "sat_arith_data.h" > + > +#define T1 uint8_t > +#define T2 uint16_t > + > +DEF_SAT_U_TRUC_FMT_2_WRAP(T1, T2) > + > +#define DATA TEST_UNARY_DATA_WRAP(T1, T2) > +#define T TEST_UNARY_STRUCT_DECL(T1, T2) > +#define RUN_UNARY(x) RUN_SAT_U_TRUC_FMT_2_WRAP(T1, T2, x) > + > +#include "scalar_sat_unary.h" > diff --git a/gcc/testsuite/gcc.target/riscv/sat_u_trunc-run-8.c > b/gcc/testsuite/gcc.target/riscv/sat_u_trunc-run-8.c > new file mode 100644 > index 00000000000..486585df7b8 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/riscv/sat_u_trunc-run-8.c > @@ -0,0 +1,16 @@ > +/* { dg-do run { target { riscv_v } } } */ > +/* { dg-additional-options "-std=3Dc99" } */ > + > +#include "sat_arith.h" > +#include "sat_arith_data.h" > + > +#define T1 uint16_t > +#define T2 uint32_t > + > +DEF_SAT_U_TRUC_FMT_2_WRAP(T1, T2) > + > +#define DATA TEST_UNARY_DATA_WRAP(T1, T2) > +#define T TEST_UNARY_STRUCT_DECL(T1, T2) > +#define RUN_UNARY(x) RUN_SAT_U_TRUC_FMT_2_WRAP(T1, T2, x) > + > +#include "scalar_sat_unary.h" > diff --git a/gcc/testsuite/gcc.target/riscv/sat_u_trunc-run-9.c > b/gcc/testsuite/gcc.target/riscv/sat_u_trunc-run-9.c > new file mode 100644 > index 00000000000..2099304a0be > --- /dev/null > +++ b/gcc/testsuite/gcc.target/riscv/sat_u_trunc-run-9.c > @@ -0,0 +1,16 @@ > +/* { dg-do run { target { riscv_v } } } */ > +/* { dg-additional-options "-std=3Dc99" } */ > + > +#include "sat_arith.h" > +#include "sat_arith_data.h" > + > +#define T1 uint32_t > +#define T2 uint64_t > + > +DEF_SAT_U_TRUC_FMT_2_WRAP(T1, T2) > + > +#define DATA TEST_UNARY_DATA_WRAP(T1, T2) > +#define T TEST_UNARY_STRUCT_DECL(T1, T2) > +#define RUN_UNARY(x) RUN_SAT_U_TRUC_FMT_2_WRAP(T1, T2, x) > + > +#include "scalar_sat_unary.h" > -- > 2.43.0 > > --0000000000002308d9061fe16878--