From patchwork Sun Nov 19 05:38:47 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: 166689 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1505486vqn; Sat, 18 Nov 2023 21:39:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDU97Qhhv/pGj6culV0zqLwI1SpZzfiFFRq1EwLL78QeTHDnYjOT+NVNXJ+S4vQJ+ZyvVH X-Received: by 2002:a05:620a:2803:b0:774:1d7f:2730 with SMTP id f3-20020a05620a280300b007741d7f2730mr4029961qkp.46.1700372366836; Sat, 18 Nov 2023 21:39:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700372366; cv=pass; d=google.com; s=arc-20160816; b=xw5PMSDX3gZhOEEwNhH1p2PtXlxYfTt31v8m+unANrwlgiWQ0IhavxuFvn7vZV1C55 513+bu5+ldYprVjqnb6VPidV/SpC89VvVABU/mtVR9XyPq3qzJakAwi+HRQjKh+iqTkU bD2LeXwdZz4WZldao6jgUHa/+q42DsChA7NFEffX5/u8wJfptRrNBY7fezcEaIJww09H 5w/ZKpshqrT/1AszT9ni84ExOpGx2YkJLstT6iN66OIpEFFdmdzWFl+zdr2IAq6Rq7qg Rmfd59ZGKGLUUAQrD2kSp125FHSG+YtVHB5md4n4TyD7nBEOu9YyJA++Ok08WDhzxJyK 5Kgw== 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=XAdU8hiffwdVRAIsugX42yU9+0+DiXlDSHo25thmMpA=; fh=dp1z4I3tVhinwswv7IAFxpunWK+Ws/fGQfmox9vHv3I=; b=sm4yMj/vgie//wOQzhPqTABDxROeYHKaPGeLutLjesayYQgT3OeK0DUz36ACdxSDOb hyg6hwYLhsXPColEWy7vpTZIYfSbjHOqCAd9+4hiKzRb8pkOizNSk12v41UqfU9kk8kc 9dBKWWDQEtkOt2yTtec0LH7b7YtpupZ84TaMEWDgU0wU7zGAD2ihDF2q1h7YKbu6siD7 /6KFHH0gwlBuQtdKcig20SkWPNIOUljon0IWZ2vmG4jR4nEAQ0bBurzxI0RO2mj7Hndt tTYToV5dts21Pa2vjCSYsglyg7rF8G+TC7nuZa/PHwbF/RmRa4c1jDRe2uevBeem4wbI f75w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=eRZLInnT; 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 rv13-20020a05620a688d00b007672b5d6f96si5274771qkn.17.2023.11.18.21.39.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:39:26 -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=eRZLInnT; 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 C4C683861838 for ; Sun, 19 Nov 2023 05:39:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id D6544385BC13 for ; Sun, 19 Nov 2023 05:38:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D6544385BC13 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 D6544385BC13 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372334; cv=none; b=Q/CKIjXA9v0w1dE6G3VuCYHGgkEnRExCN2nxM0kD/ZxVtTzep8Z1OVztPNaRpbwSw/zbYQHnA5nKukw81JQKc3sg8lXiMGZmm0rUAEVaFPsjhek31jUBAuhdFAyblPgB02e+MF4xsJAc1ut8oUtmPfG96Y+fAclyVsCGc84m1Sw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372334; c=relaxed/simple; bh=uA+jsEOSgD8i1ZHq1RRa7RXHZYdBkCFPckKhA/d7bfM=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=e3Kmip7TT3vdoiBnEVATjYmpgy4KaB03vMUBxwDFaEZh/ZB5ow00CTayglP3a9a+T2J26QlZTPzpXs0oHQ4DxyVxFxYeHvokVTMlPMBy6AsxqL5MUoWdEtPhDB6LP+xU1mM+ekss/oCYNuZaX1ZIqGEh3lSyUZRfx1SaqfXoqKo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-9d10972e63eso450480066b.2 for ; Sat, 18 Nov 2023 21:38:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1700372330; x=1700977130; 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=XAdU8hiffwdVRAIsugX42yU9+0+DiXlDSHo25thmMpA=; b=eRZLInnT43IMhJYnPiTHXR4vRbUnusccw1Brly3R8HymCaUp3hNgFf/+nF+szH9eX5 0Y5Qii1HhNQuHriRMuVNoG+YEcwIvWOJo7e3lWdzNjMn0VaSo9h4ruDSl4xK13uNXuu3 9SHaReXIPbHo9K2eEYkvYjdvpOJ1ZZUqR+ge2aCNn5XjZS7PkTrwmG/ffyi1oHL11a6n oLBw6kvom1vnqN3PTrLPnnZ+DcZSOJJ/TLE/7pVicXaCYpleq8K66hTeipJhURFI/k9P G9elhJGTDPlPewaB0Qwkqujv/jk/Xs/d4mnXOJKeENPY4Od4XsRCcJ2v5ZV2qDIIaKnQ C58w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700372330; x=1700977130; 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=XAdU8hiffwdVRAIsugX42yU9+0+DiXlDSHo25thmMpA=; b=vOy2MN/hzM8scNwPk0uEoTtxYHCtgOjVPBGWnO8zUrDgvy6yfUTgnuRlsbCrWPQ77y 4OJWURgPJHLMgyuRBLc2boLXJSRqmXIN/Kc1zfnG/A8S+ZtmoSyZu2jMxU3iU6AWUR5s RSxw7qtWh3EOOlyfw2gK7cEC3za3c75+wZqmLNj4eszy/GFuwdnKCmupyP0VpX33NwDg ea0XR+A7OwdGokzr+vQTAaAUcv8Qwl665mdvuy1zW8gtwQyyRISMvDKXx3nC3UtZ3pWT tgWbe6NmR5GiH0/RK6FgMyQ1X0p6IEzIc2C060npDMytAeO3cc8VHfK0dFGZzMQZqoaf Mq1A== X-Gm-Message-State: AOJu0YyMJ+ehu+ihBXuOyj+kYhScv44rD/XteYfG2SU8U2L+RThyfi14 AexxReW6uY1aCsSwInBFuiSglw8XLYgU+ogO74KFvA== X-Received: by 2002:a17:907:3c05:b0:9e5:3033:87b4 with SMTP id gh5-20020a1709073c0500b009e5303387b4mr2113972ejc.27.1700372330527; Sat, 18 Nov 2023 21:38:50 -0800 (PST) Received: from [192.168.219.3] ([78.8.192.131]) by smtp.gmail.com with ESMTPSA id bo14-20020a170906d04e00b009c3f8f46c22sm2550228ejb.77.2023.11.18.21.38.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2023 21:38:49 -0800 (PST) Date: Sun, 19 Nov 2023 05:38:47 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: Andrew Waterman , Jim Wilson , Kito Cheng , Palmer Dabbelt Subject: [PATCH 18/44] RISC-V/testsuite: Add branched cases for equality 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, SCC_5_SHORT_WORD_LINES, 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: 1782969654682635678 X-GMAIL-MSGID: 1782969654682635678 Verify, for Ventana and Zicond targets and the equality conditional-move operations, that if-conversion does *not* trigger at the respective sufficiently low `-mbranch-cost=' settings that make original branched code sequences cheaper than their branchless equivalents if-conversion would emit. gcc/testsuite/ * gcc.target/riscv/movdibeq-ventana.c: New test. * gcc.target/riscv/movdibeq-zicond.c: New test. * gcc.target/riscv/movdibne-ventana.c: New test. * gcc.target/riscv/movdibne-zicond.c: New test. * gcc.target/riscv/movsibeq-ventana.c: New test. * gcc.target/riscv/movsibeq-zicond.c: New test. * gcc.target/riscv/movsibne-ventana.c: New test. * gcc.target/riscv/movsibne-zicond.c: New test. --- gcc/testsuite/gcc.target/riscv/movdibeq-ventana.c | 28 ++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movdibeq-zicond.c | 28 ++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movdibne-ventana.c | 30 ++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movdibne-zicond.c | 30 ++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsibeq-ventana.c | 28 ++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsibeq-zicond.c | 28 ++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsibne-ventana.c | 30 ++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsibne-zicond.c | 30 ++++++++++++++++++++++ 8 files changed, 232 insertions(+) gcc-riscv-expand-conditional-move-zicond-equality-test-movcc-branch.diff Index: gcc/gcc/testsuite/gcc.target/riscv/movdibeq-ventana.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdibeq-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 +movdieq (int_t w, int_t x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect branched assembly like: + + bne a0,a1,.L2 + mv a3,a2 +.L2: + mv a0,a3 + */ + +/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */ +/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */ +/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\ssub\\s" } } */ +/* { dg-final { scan-assembler-not "\\svt\\.maskc\\s" } } */ +/* { dg-final { scan-assembler-not "\\svt\\.maskcn\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movdibeq-zicond.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdibeq-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 +movdieq (int_t w, int_t x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect branched assembly like: + + bne a0,a1,.L2 + mv a3,a2 +.L2: + mv a0,a3 + */ + +/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */ +/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */ +/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\ssub\\s" } } */ +/* { dg-final { scan-assembler-not "\\sczero\\.eqz\\s" } } */ +/* { dg-final { scan-assembler-not "\\sczero\\.nez\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movdibne-ventana.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdibne-ventana.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target rv64 } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv64gc_xventanacondops -mtune=rocket -mbranch-cost=2 -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +movdine (int_t w, int_t x, int_t y, int_t z) +{ + return w != x ? y : z; +} + +/* Expect branched assembly like: + + beq a0,a1,.L3 + mv a0,a2 + ret +.L3: + mv a0,a3 + ret + */ + +/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */ +/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */ +/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\ssub\\s" } } */ +/* { dg-final { scan-assembler-not "\\svt\\.maskc\\s" } } */ +/* { dg-final { scan-assembler-not "\\svt\\.maskcn\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movdibne-zicond.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdibne-zicond.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target rv64 } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv64gc_zicond -mtune=rocket -mbranch-cost=2 -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +movdine (int_t w, int_t x, int_t y, int_t z) +{ + return w != x ? y : z; +} + +/* Expect branched assembly like: + + beq a0,a1,.L3 + mv a0,a2 + ret +.L3: + mv a0,a3 + ret + */ + +/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */ +/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */ +/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\ssub\\s" } } */ +/* { dg-final { scan-assembler-not "\\sczero\\.eqz\\s" } } */ +/* { dg-final { scan-assembler-not "\\sczero\\.nez\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movsibeq-ventana.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsibeq-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 +movsieq (int_t w, int_t x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect branched assembly like: + + bne a0,a1,.L2 + mv a3,a2 +.L2: + mv a0,a3 + */ + +/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */ +/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */ +/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\ssub\\s" } } */ +/* { dg-final { scan-assembler-not "\\svt\\.maskc\\s" } } */ +/* { dg-final { scan-assembler-not "\\svt\\.maskcn\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movsibeq-zicond.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsibeq-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 +movsieq (int_t w, int_t x, int_t y, int_t z) +{ + return w == x ? y : z; +} + +/* Expect branched assembly like: + + bne a0,a1,.L2 + mv a3,a2 +.L2: + mv a0,a3 + */ + +/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */ +/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */ +/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\ssub\\s" } } */ +/* { dg-final { scan-assembler-not "\\sczero\\.eqz\\s" } } */ +/* { dg-final { scan-assembler-not "\\sczero\\.nez\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movsibne-ventana.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsibne-ventana.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target rv64 } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv64gc_xventanacondops -mtune=rocket -mbranch-cost=2 -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +movsine (int_t w, int_t x, int_t y, int_t z) +{ + return w != x ? y : z; +} + +/* Expect branched assembly like: + + beq a0,a1,.L3 + mv a0,a2 + ret +.L3: + mv a0,a3 + ret + */ + +/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */ +/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */ +/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\ssub\\s" } } */ +/* { dg-final { scan-assembler-not "\\svt\\.maskc\\s" } } */ +/* { dg-final { scan-assembler-not "\\svt\\.maskcn\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/movsibne-zicond.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsibne-zicond.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv64gc_zicond -mtune=rocket -mbranch-cost=2 -fdump-rtl-ce1" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_zicond -mtune=rocket -mbranch-cost=2 -fdump-rtl-ce1" { target { rv32 } } } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +movsine (int_t w, int_t x, int_t y, int_t z) +{ + return w != x ? y : z; +} + +/* Expect branched assembly like: + + beq a0,a1,.L3 + mv a0,a2 + ret +.L3: + mv a0,a3 + ret + */ + +/* { dg-final { scan-rtl-dump-not "Conversion succeeded on pass \[0-9\]+\\." "ce1" } } */ +/* { dg-final { scan-rtl-dump-not "if-conversion succeeded through" "ce1" } } */ +/* { dg-final { scan-assembler-times "\\s(?:beq|bne)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\ssub\\s" } } */ +/* { dg-final { scan-assembler-not "\\sczero\\.eqz\\s" } } */ +/* { dg-final { scan-assembler-not "\\sczero\\.nez\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */