From patchwork Sun Nov 19 05:43:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 166714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1506808vqn; Sat, 18 Nov 2023 21:45:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFAvvnw9Tv7M7dXv6Sg42xWmdjvXeWfXEwCTBaVZ8va4qe6IvGE7S1fju59ivHqZpaTd7jE X-Received: by 2002:ac8:5a45:0:b0:41e:204b:f931 with SMTP id o5-20020ac85a45000000b0041e204bf931mr5941738qta.42.1700372703269; Sat, 18 Nov 2023 21:45:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700372703; cv=pass; d=google.com; s=arc-20160816; b=MkS2AiSyAnpm4bFYop2nQXyzcpBL3riF95S8MyXDVNXlHWFr48ebdnT/QRBSvCvh/J vfTmiOAI4mUC0zumrmKb6OFXeMEsi0pfVgWxQhOYpPeSRPe+62ga+5joDZcuLmlg+469 EelfLck087r77vhcDjj4HtBe2T2a53lwhG6aL4hZGWvbTHR3JDTnnYF35yEnVKemg47M MQthh2l7Tkc93gIDWQ39gDkCEwwSt5h6zYMhgbBO1u8w5EzEpAztUMt5ma4FuyCHixc/ aUUvFqd23X4nxKPP1w05Rmc7exDAa/VWr74OjlTt4XJwZyl7ecJ6281JiylFrLcRIooH CQuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=tEWIBFac95t6b01lycmnDI4hegZEL/OcDyksw8+EEFo=; fh=dp1z4I3tVhinwswv7IAFxpunWK+Ws/fGQfmox9vHv3I=; b=Avys/uyGN0YEUGEDe2lGKU6GVmR4S/GA7YU4bwETeK1XNKgngglVY8e/KkKLFSG1HS MOJjytEa2CoV2xvBkzFCzpGCbIqwJ9yraXrUdsdh/d500eMlNjiLl1IgFUbvOVNN+N3k iJgbXnBOXSGCBokgNHwf7bUYa9PXxohHZt57mvBKiSnFoXNKr30t22o1FNN7slIYelAw f0EKIpZuVUeaOCCUSU9Hfa5cXchA7gpfgRpqEXxBkINC71A5u2CUlOq+KzHpJ4cciIZR OP+CuortTMSYoGFtXLB5bH1F81jhXikMBgImIOefFKl9tcDM2UcOWnnToimkv6m+23Dy u8ZA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=fFUy8n67; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id n16-20020ac85a10000000b004181a080726si5098138qta.659.2023.11.18.21.45.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:45:03 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=fFUy8n67; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C1A31385AE75 for ; Sun, 19 Nov 2023 05:44:28 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by sourceware.org (Postfix) with ESMTPS id 85D39386075C for ; Sun, 19 Nov 2023 05:44:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 85D39386075C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 85D39386075C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::531 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372643; cv=none; b=B7hpMl5j3wMjud8xWNuRS2NzqpzzE1y7WxU8uMujFk3GAiktixMG2eyCkbQn2jFX3N+ONwbZ+UP4xOe07kyA0XFq9c0gZWRvKWj9RKRt81dod+C9eDNwgTmlDWFVk+zVRWYxBpUT3nAtj+NlqfARQyCsQiJsc2neJnoPv1f/q30= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372643; c=relaxed/simple; bh=8cVz95x77k3X4jGf+rNnYrnOGC9CVHbPL2Bt3ePhIJI=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=NHGuyDAOlz4G7WxVSX1OjkWg7pJQVhKbEYzxmlBRrSptI3Jw1tdMcXzGFcmLnrUnqPk5kGriMbpmIzM4R6c2UmV/cjTiOw1k4SaN/wiBcQyHtJ4FhrUNnCNnlBSnjWzsCbCnJTv99qC+ciPiwpMiXi1ToyS8fFEBUr6TTmR58S8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-53de8fc1ad8so4852326a12.0 for ; Sat, 18 Nov 2023 21:44:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1700372639; x=1700977439; darn=gcc.gnu.org; h=mime-version:user-agent:references:message-id:in-reply-to:subject :cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=tEWIBFac95t6b01lycmnDI4hegZEL/OcDyksw8+EEFo=; b=fFUy8n67lXFk5ySLdXZXEdhLV3N5fNOy9pvDHK4OtOnY8ztbbAak+1Q1L06FPVEBfa D9z0eJtQIuqw8e9AYmyG/LIRF4omDwJEyUHwbxhweiTgzDQm7VTXXYUCBLmMkI901+Cn fQi2VZHu70JbQR2N0p6jSlBmRne8bnbSMisAq7YflZCkSRT6Z2h+QDjrCXFJxUwdPljN Y4298VNbt78hPy04IZVvyLvNIMXTf8z1nEsDqLfpmE5/xXlsKrWdtNJlp0P30jWdHqMF vs3Y6UCKCWjwtGKe78MbEeqch7Kniegmua7pDEJkdmMB/nHiHGDHv2bvnbdPkcmp7QAh O0gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700372639; x=1700977439; h=mime-version:user-agent:references:message-id:in-reply-to:subject :cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=tEWIBFac95t6b01lycmnDI4hegZEL/OcDyksw8+EEFo=; b=Q6kc8RPeMZOn/idci/Hd7DrSB8VVrBVbGzc8bs2rAgH5uOw5Qalr5P7O3SYnnsjqAi 8icX9BMa6aY7t6dN0BSKgancNTuDPlhvI6c5F2a8VDfPedt8+NmeKUt+qXj9pbCzBPWl 4x7BkItbkAsRL7S/WF1/G2rEgWpMHvdIh0pWWupcJMNWOjjKxN88XzaaOqVkGjNoNnJV wsdPMRm2/iSHQg/9tj72frHr+gQY73JYLmhoi1Gurmecc6QOq9UGvlKemFmBbwZWNxRj gcDbV3VpMJaMmfp48oSGwh1CRG9ZbehpxGpkMb8bBI2eyQHUGR4h3qyUcVzoDravN+N8 n6uQ== X-Gm-Message-State: AOJu0YxAIuTxu5a0yciGTuTGKN/qHoGYRdbPX+M97O1SIW/ttoaJR8Nb MN9jnev5oFT8rKpJvK5/1T+hIgy3LvL4Wk0T8VUA/A== X-Received: by 2002:aa7:df0b:0:b0:53f:a377:7287 with SMTP id c11-20020aa7df0b000000b0053fa3777287mr3235203edy.18.1700372639234; Sat, 18 Nov 2023 21:43:59 -0800 (PST) Received: from [192.168.219.3] ([78.8.192.131]) by smtp.gmail.com with ESMTPSA id q11-20020a056402040b00b00530bc7cf377sm2249889edv.12.2023.11.18.21.43.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2023 21:43:58 -0800 (PST) Date: Sun, 19 Nov 2023 05:43:56 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: Andrew Waterman , Jim Wilson , Kito Cheng , Palmer Dabbelt Subject: [PATCH 42/44] RISC-V/testsuite: Add branched cases for FP NE cond-move operations In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, KAM_SHORT, LIKELY_SPAM_BODY, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782969990111586039 X-GMAIL-MSGID: 1782970007917814586 Verify, for the floating-point NE conditional-move operation, that if-conversion triggers via `noce_try_cmove' at the respective sufficiently high `-mbranch-cost=' settings that make branchless code sequences produced by if-conversion cheaper than their original branched equivalents, and that extraneous instructions such as SNEZ, etc. are not present in output. gcc/testsuite/ * gcc.target/riscv/movdifeq-sfb.c: New test. * gcc.target/riscv/movdifeq-thead.c: New test. * gcc.target/riscv/movdifeq-ventana.c: New test. * gcc.target/riscv/movdifeq-zicond.c: New test. * gcc.target/riscv/movdifeq.c: New test. * gcc.target/riscv/movsifeq-sfb.c: New test. * gcc.target/riscv/movsifeq-thead.c: New test. * gcc.target/riscv/movsifeq-ventana.c: New test. * gcc.target/riscv/movsifeq-zicond.c: New test. * gcc.target/riscv/movsifeq.c: New test. --- gcc/testsuite/gcc.target/riscv/movdifeq-sfb.c | 27 +++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movdifeq-thead.c | 25 +++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movdifeq-ventana.c | 28 ++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movdifeq-zicond.c | 28 ++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movdifeq.c | 28 ++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsifeq-sfb.c | 27 +++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsifeq-thead.c | 25 +++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsifeq-ventana.c | 28 ++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsifeq-zicond.c | 28 ++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsifeq.c | 28 ++++++++++++++++++++++ 10 files changed, 272 insertions(+) gcc-riscv-test-movccne-generic.diff Index: gcc/gcc/testsuite/gcc.target/riscv/movdifeq-sfb.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdifeq-sfb.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target rv64 } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-7-series -mbranch-cost=1 -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +movdifeq (double w, double x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect short forward branch assembly like: + + feq.d a5,fa0,fa1 + beq a5,zero,1f # movcc + mv a1,a0 +1: + mv a0,a1 + */ + +/* { dg-final { scan-rtl-dump-times "Conversion succeeded on pass 1\\." 1 "ce1" } } */ +/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_cmove" 1 "ce1" } } */ +/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s\[^\\s\]+\\s# movcc\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movdifeq-thead.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdifeq-thead.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target rv64 } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */ +/* { dg-options "-march=rv64gc_xtheadcondmov -mtune=thead-c906 -mbranch-cost=1 -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +movdifeq (double w, double x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect branchless assembly like: + + feq.d a5,fa0,fa1 + th.mveqz a0,a1,a5 + */ + +/* { dg-final { scan-rtl-dump-times "Conversion succeeded on pass 1\\." 1 "ce1" } } */ +/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_cmove" 1 "ce1" } } */ +/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\s(?:th\\.mveqz|th\\.mvnez)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movdifeq-ventana.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdifeq-ventana.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target rv64 } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv64gc_xventanacondops -mtune=rocket -mbranch-cost=3 -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +movdifeq (double w, double x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect branchless assembly like: + + feq.d a5,fa0,fa1 + vt.maskcn a1,a1,a5 + vt.maskc a0,a0,a5 + or a0,a0,a1 + */ + +/* { dg-final { scan-rtl-dump-times "Conversion succeeded on pass 1\\." 1 "ce1" } } */ +/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_cmove" 1 "ce1" } } */ +/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\svt\\.maskc\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\svt\\.maskcn\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movdifeq-zicond.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdifeq-zicond.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target rv64 } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv64gc_zicond -mtune=rocket -mbranch-cost=3 -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +movdifeq (double w, double x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect branchless assembly like: + + feq.d a5,fa0,fa1 + czero.nez a1,a1,a5 + czero.eqz a0,a0,a5 + or a0,a0,a1 + */ + +/* { dg-final { scan-rtl-dump-times "Conversion succeeded on pass 1\\." 1 "ce1" } } */ +/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_cmove" 1 "ce1" } } */ +/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sczero\\.eqz\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sczero\\.nez\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movdifeq.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdifeq.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target rv64 } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=5 -mmovcc -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +movdifeq (double w, double x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect branchless assembly like: + + feq.d a5,fa0,fa1 + neg a5,a5 + and a0,a5,a0 + not a5,a5 + and a5,a5,a1 + or a0,a0,a5 + */ + +/* { dg-final { scan-rtl-dump-times "Conversion succeeded on pass 1\\." 1 "ce1" } } */ +/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_cmove" 1 "ce1" } } */ +/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movsifeq-sfb.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsifeq-sfb.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-7-series -mbranch-cost=1 -fdump-rtl-ce1" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc -mtune=sifive-7-series -mbranch-cost=1 -fdump-rtl-ce1" { target { rv32 } } } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +movsifeq (double w, double x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect short forward branch assembly like: + + feq.d a5,fa0,fa1 + beq a5,zero,1f # movcc + mv a1,a0 +1: + mv a0,a1 + */ + +/* { dg-final { scan-rtl-dump-times "Conversion succeeded on pass 1\\." 1 "ce1" } } */ +/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_cmove" 1 "ce1" } } */ +/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s\[^\\s\]+\\s# movcc\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movsifeq-thead.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsifeq-thead.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */ +/* { dg-options "-march=rv64gc_xtheadcondmov -mtune=thead-c906 -mbranch-cost=1 -fdump-rtl-ce1" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_xtheadcondmov -mtune=thead-c906 -mbranch-cost=1 -fdump-rtl-ce1" { target { rv32 } } } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +movsifeq (double w, double x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect branchless assembly like: + + feq.d a5,fa0,fa1 + th.mveqz a0,a1,a5 + */ + +/* { dg-final { scan-rtl-dump-times "Conversion succeeded on pass 1\\." 1 "ce1" } } */ +/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_cmove" 1 "ce1" } } */ +/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\s(?:th\\.mveqz|th\\.mvnez)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movsifeq-ventana.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsifeq-ventana.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target rv64 } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv64gc_xventanacondops -mtune=rocket -mbranch-cost=3 -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +movsifeq (double w, double x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect branchless assembly like: + + feq.d a5,fa0,fa1 + vt.maskcn a1,a1,a5 + vt.maskc a0,a0,a5 + or a0,a0,a1 + */ + +/* { dg-final { scan-rtl-dump-times "Conversion succeeded on pass 1\\." 1 "ce1" } } */ +/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_cmove" 1 "ce1" } } */ +/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\svt\\.maskc\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\svt\\.maskcn\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movsifeq-zicond.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsifeq-zicond.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv64gc_zicond -mtune=rocket -mbranch-cost=3 -fdump-rtl-ce1" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zicond -mtune=rocket -mbranch-cost=3 -fdump-rtl-ce1" { target { rv32 } } } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +movsifeq (double w, double x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect branchless assembly like: + + feq.d a5,fa0,fa1 + czero.nez a1,a1,a5 + czero.eqz a0,a0,a5 + or a0,a0,a1 + */ + +/* { dg-final { scan-rtl-dump-times "Conversion succeeded on pass 1\\." 1 "ce1" } } */ +/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_cmove" 1 "ce1" } } */ +/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sczero\\.eqz\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sczero\\.nez\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movsifeq.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsifeq.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=5 -mmovcc -fdump-rtl-ce1" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc -mtune=sifive-5-series -mbranch-cost=5 -mmovcc -fdump-rtl-ce1" { target { rv32 } } } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +movsifeq (double w, double x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect branchless assembly like: + + feq.d a5,fa0,fa1 + neg a5,a5 + and a0,a5,a0 + not a5,a5 + and a5,a5,a1 + or a0,a0,a5 + */ + +/* { dg-final { scan-rtl-dump-times "Conversion succeeded on pass 1\\." 1 "ce1" } } */ +/* { dg-final { scan-rtl-dump-times "if-conversion succeeded through noce_try_cmove" 1 "ce1" } } */ +/* { dg-final { scan-assembler-times "\\sfeq\\.d\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:beq|bne)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */