From patchwork Sun Nov 19 05:38:13 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: 166691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1505554vqn; Sat, 18 Nov 2023 21:39:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpO6BVHwp85H7AIPei+O6TYlESZQaIL0J3rC8nCWETBsw1SD4yrCgGUzOHVlVRqj5POU9V X-Received: by 2002:a05:620a:6845:b0:779:e171:3356 with SMTP id ru5-20020a05620a684500b00779e1713356mr5086606qkn.53.1700372388778; Sat, 18 Nov 2023 21:39:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700372388; cv=pass; d=google.com; s=arc-20160816; b=ma230QEM6dimFn2evq4i28ZytWDn9j0SGf6+HJ0BVgV18NjdrRXtttLI3Ogm7lN18g PUgAKR33xQVVg35LgDiIZxwDi1VMNP67gsadQkEJxW99HlNcg2W2b8BVifRaXIx/++oY GWJ1Io1LHORrEcpLTH7UacOxmitbFhTnA+/p4Lu+vLFQng5SKDIgqlxq6aL2V3g7dczW FLCbpracBlFN+O2IlmaCGeV9utc4h0kzFJIkey3FYygoBIZUCbOvLTnc/1zYpti/ivw/ fHix97yqGn3ZLe+Lu3cETDzbmHsxyn7DY6CVDoO7hWPd055dYdGm+3pHInbpETtup7ms RcHw== 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=bLFWeakzIYkVBjJlZ/GL7Fo4N4ZMJyp7LayAAHzEl2Y=; fh=dp1z4I3tVhinwswv7IAFxpunWK+Ws/fGQfmox9vHv3I=; b=e/hD3elEL5j2mNO94kFBJR2B/sl5Rp87XdWRXzyAaepDxt3duBv84zp0CuXTWOQ5ui prx9VqbGtAW6X3wK+ybMHup++DMzxpBT59QKFd3id9QrSMoP0de5vMOvlul+XjNh3uLG wmnP1SSm2pXScU94zdn8CiuEkHLLoZ6bYadigAqtRWDVlVRjmReANOqJPGSludJK2jMj JPUMaLq+MM27naoqlpC7Ix9dSToRRnD3mUJNWuoDadcUY0RMre/vS/jI6QGWQAwNerRh +vYV7PTxqg28m0o3tJrcR0XXbtJpbwDV99/ib+aN8me9qtBfxfEnzQWkyXekPwjq4Sx0 jzuw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=arplbYu9; 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 c12-20020a05620a0cec00b0077a51a904easi4679003qkj.774.2023.11.18.21.39.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:39:48 -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=arplbYu9; 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 0ED3A3861821 for ; Sun, 19 Nov 2023 05:39:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by sourceware.org (Postfix) with ESMTPS id 7A11F3858427 for ; Sun, 19 Nov 2023 05:38:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7A11F3858427 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 7A11F3858427 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372299; cv=none; b=rsRPWinaos+owjEb06AzkYRuDtWdA92VLRcxW9lfRyB0R7+2+CwB872iiiZubajpI+OKCcLjZl2GEACJAnypwMOfA7U0xyE5FY64fU58OW/khCqnOalavK3ZoVFQUtO3DfIVdQjcRjFgcNBdQcZJi7qxvGtyGNOLJiOhpAPbRCE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372299; c=relaxed/simple; bh=PzVk3TVtf2i5YIUVWtxof6t6BPGUS97pipxzl5ZGat0=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=dQ4H4zpAgnSEE50s1wXVqvxtZ55gzLpJ/9oK3gGvKDD4iTY3Ob7Vc/vDajStcFOaDAaOvBC1tB0JehWUMbp5MX4JV8uk0MvUbyQnnNYUryOh4dW+iSeyaThT+xK7VQlhBPIPfQET41ZRXYIc99xzOEPNHEvoVb/5wTxtLRUJjmQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-50797cf5b69so4417169e87.2 for ; Sat, 18 Nov 2023 21:38:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1700372296; x=1700977096; 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=bLFWeakzIYkVBjJlZ/GL7Fo4N4ZMJyp7LayAAHzEl2Y=; b=arplbYu9KQ5lHMT+cklNgex7ftSZdG54/O9bw/uz1hLhNGB7jpvXi37UDD7ZES5sIm YsqIKgIAo0oHFJPhU4UoHKG1oJY+0eO+ht/h+01tIhHttfCM0EoQf7YR8mwqi4CwYJG1 4XiPE2g1dUB1yEa+0r+QDLyfQ1pzY95ldHibH31tNvvRTB/2Af9mD+bfvAGT3NC+Ol9W vNDfNfCJW10lfCKlZ2cG9R9/XI3CChukcSZAG/lISanx7+yQsO8Fj2fFuljbpYoE5u6L vPPSpE+PtYbasgJlrUisiCM6UYBB5H/SbeAVA+ca/Abv239Dw6FxbVTu5072kr07bLiR DvWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700372296; x=1700977096; 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=bLFWeakzIYkVBjJlZ/GL7Fo4N4ZMJyp7LayAAHzEl2Y=; b=a11Gdl6ODgtHJp+giXfCN5szOdoq9JbmcbkyZHgJmtZkMc+/meiLHYAe6yVo4k1rnn IG29VU8p+73GLJZ2gbAAxTga0xCoBEJ33wa/eS9vrTiIOrMxmHMGOH1/hElhWf0EDcDK l2JfHPZWUAdYW/CnyNRcIa9ctTvS9WijoHwi+/ClkcSA6qd79L8xqWIMldVlYlDvc6de 05Po521xoimOCkYBSVYG2CimKM3uXRItwV2L9yIXl9TYTVBkYTjr6ihXNFIdvSOFauLN 3j5LtNWBrqDRTbOv6eRwS9hYHANSJSCQ7qAsJlhGb6gWkrO+kO72fY75ZOAHhnItuoFz KG5Q== X-Gm-Message-State: AOJu0YztKE1eEG78OaOMaKppzGFpgR5nFs/2NDb2sYopwvNQdjIdD8qQ tA7gPU41WMQ8fYInYwVZX9iM7cY88XucDFXQfUJfUg== X-Received: by 2002:a05:6512:aca:b0:50a:a9e1:6c58 with SMTP id n10-20020a0565120aca00b0050aa9e16c58mr1669840lfu.32.1700372296020; Sat, 18 Nov 2023 21:38:16 -0800 (PST) Received: from [192.168.219.3] ([78.8.192.131]) by smtp.gmail.com with ESMTPSA id dx3-20020a170906a84300b009c5c5c2c5a4sm2512229ejb.219.2023.11.18.21.38.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2023 21:38:15 -0800 (PST) Date: Sun, 19 Nov 2023 05:38:13 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: Andrew Waterman , Jim Wilson , Kito Cheng , Palmer Dabbelt Subject: [PATCH 15/44] RISC-V/testsuite: Add branched cases for GEU and LEU 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.9 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: 1782969677676242019 X-GMAIL-MSGID: 1782969677676242019 Verify, for Ventana and Zicond targets and the GEU and LEU conditional-move operations, that if-conversion does *not* trigger at `-mbranch-cost=3' setting, which makes original branched code sequences cheaper than their branchless equivalents if-conversion would emit. gcc/testsuite/ * gcc.target/riscv/movdibgtu-ventana.c: New test. * gcc.target/riscv/movdibgtu-zicond.c: New test. * gcc.target/riscv/movdibltu-ventana.c: New test. * gcc.target/riscv/movdibltu-zicond.c: New test. * gcc.target/riscv/movsibgtu-ventana.c: New test. * gcc.target/riscv/movsibgtu-zicond.c: New test. * gcc.target/riscv/movsibltu-ventana.c: New test. * gcc.target/riscv/movsibltu-zicond.c: New test. --- gcc/testsuite/gcc.target/riscv/movdibgtu-ventana.c | 28 +++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movdibgtu-zicond.c | 28 +++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movdibltu-ventana.c | 28 +++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movdibltu-zicond.c | 28 +++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsibgtu-ventana.c | 28 +++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsibgtu-zicond.c | 28 +++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsibltu-ventana.c | 28 +++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/movsibltu-zicond.c | 28 +++++++++++++++++++++ 8 files changed, 224 insertions(+) gcc-riscv-expand-conditional-move-geu-leu-test-movcc-branch.diff Index: gcc/gcc/testsuite/gcc.target/riscv/movdibgtu-ventana.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdibgtu-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 unsigned int __attribute__ ((mode (DI))) int_t; + +int_t +movdigtu (int_t w, int_t x, int_t y, int_t z) +{ + return w > x ? y : z; +} + +/* Expect branched assembly like: + + bleu 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(?:bgeu|bgtu|bleu|bltu)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgtu|sltu)\\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/movdibgtu-zicond.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdibgtu-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 unsigned int __attribute__ ((mode (DI))) int_t; + +int_t +movdigtu (int_t w, int_t x, int_t y, int_t z) +{ + return w > x ? y : z; +} + +/* Expect branched assembly like: + + bleu 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(?:bgeu|bgtu|bleu|bltu)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgtu|sltu)\\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/movdibltu-ventana.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdibltu-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 unsigned int __attribute__ ((mode (DI))) int_t; + +int_t +movdiltu (int_t w, int_t x, int_t y, int_t z) +{ + return w < x ? y : z; +} + +/* Expect branched assembly like: + + bgeu 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(?:bgeu|bgtu|bleu|bltu)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgtu|sltu)\\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/movdibltu-zicond.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movdibltu-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 unsigned int __attribute__ ((mode (DI))) int_t; + +int_t +movdiltu (int_t w, int_t x, int_t y, int_t z) +{ + return w < x ? y : z; +} + +/* Expect branched assembly like: + + bgeu 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(?:bgeu|bgtu|bleu|bltu)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgtu|sltu)\\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/movsibgtu-ventana.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsibgtu-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 unsigned int __attribute__ ((mode (SI))) int_t; + +int_t +movsigtu (int_t w, int_t x, int_t y, int_t z) +{ + return w > x ? y : z; +} + +/* Expect branched assembly like: + + bleu 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(?:bgeu|bgtu|bleu|bltu)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgtu|sltu)\\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/movsibgtu-zicond.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsibgtu-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 unsigned int __attribute__ ((mode (SI))) int_t; + +int_t +movsigtu (int_t w, int_t x, int_t y, int_t z) +{ + return w > x ? y : z; +} + +/* Expect branched assembly like: + + bleu 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(?:bgeu|bgtu|bleu|bltu)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgtu|sltu)\\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/movsibltu-ventana.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsibltu-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 unsigned int __attribute__ ((mode (SI))) int_t; + +int_t +movsiltu (int_t w, int_t x, int_t y, int_t z) +{ + return w < x ? y : z; +} + +/* Expect branched assembly like: + + bgeu 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(?:bgeu|bgtu|bleu|bltu)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgtu|sltu)\\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/movsibltu-zicond.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/movsibltu-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 unsigned int __attribute__ ((mode (SI))) int_t; + +int_t +movsiltu (int_t w, int_t x, int_t y, int_t z) +{ + return w < x ? y : z; +} + +/* Expect branched assembly like: + + bgeu 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(?:bgeu|bgtu|bleu|bltu)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgtu|sltu)\\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" } } */