From patchwork Sun Nov 19 05:41:33 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: 166700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1506094vqn; Sat, 18 Nov 2023 21:42:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEqzxMbrgrI1cNHwwd0bzIPQ6nWEIeQQIMKr5hDA0fgfa6RqoDZ8yfnimQ70WxOHA+aHf1F X-Received: by 2002:ac8:7c4d:0:b0:400:a2b8:1c97 with SMTP id o13-20020ac87c4d000000b00400a2b81c97mr5415746qtv.17.1700372525764; Sat, 18 Nov 2023 21:42:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700372525; cv=pass; d=google.com; s=arc-20160816; b=lw/pFtqYrUbNnGR/JQsu2DhH3mZE6YBV8KvHnWCjIQwhe9DYtaOBSsg1m8IYU/zohy EjAR2SOOYU8/HWP82KDJ7iIhtCRSsOWtFQj9NqbhIKF7ZA/3kEktfWSR/lO14rLk82gL /v7nlNjbmMcTFDEJhJMaeeXRh500N/TSabzSBih0cNRLV80O4U26uq0xRj/WAXT4oLFx LHKMaE2RWUFP+UF3C8gY/z0CZNE46KbQTeKqKWfPSCyBeOfohRJGEAgmyUGQA+DolxEJ g/eUQv0HSH1JFw2Vz8zxiB5j0VNezzMfYWII10y4zkEOmiZScZOAHJtfD0eD3R1EX10Y 1Kbg== 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=z1u1EolHyezT3Rj/p1S6KCWedsg36rnuPa2xYDe7iDw=; fh=dp1z4I3tVhinwswv7IAFxpunWK+Ws/fGQfmox9vHv3I=; b=ts/YO+XJBfiXnVPwrnDs6DTNWkOU+pP1sYH14Xn/wxq0ZI5uclHX0ZoRcCjOyfFDyJ 4B9zlbObuYsi5DgUgseWDLWHmmF+yjiNsVmg1fbYqpK7wa0G5SBFbuMeP5RK2j/rdUwn ohkXKqa2PPjSWY5OC9PYhc7cHLl09XFs9sqQSe+4QXV3GqewutmvObx/tftP8Y1oK4xa PIW41asfxxtz810psF9OAATPrqi8PZSB0sOsk8ygcTfcI46a24SFWXZHtUwVixI57rzs VjuT55rO517bbNHtu7p/QBC5cxd71gAWiekIbKaAPWOWBshclwVdahC1HJ7uzWV6dqBN DUAQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=YzuesD6d; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id 14-20020ac8590e000000b0041cde9ed1adsi5024131qty.742.2023.11.18.21.42.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:42:05 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=YzuesD6d; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 74CD33858437 for ; Sun, 19 Nov 2023 05:42:05 +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 5FED63858281 for ; Sun, 19 Nov 2023 05:41:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5FED63858281 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 5FED63858281 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=1700372502; cv=none; b=c9nam9Lh1Dml6gqsScfpsAxGCbkc0c/XCnpIxuJgpGpTT1ywlwgH6mmTMj7+mQbuS+JLSr4pCCicMbZ3cf8YlvcBR5OJ16Z7uCguhwwkGwlz5bv1k1jDjZVbgX10XEyFPB17gKHCxawuJJVmzotgRtQoTg4EPumXjRb99LwWjTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372502; c=relaxed/simple; bh=3GhgT2LVv5D5GMpPUMpC0k7VKD1t9L2YxXZ6ci/ZRb8=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=kNG7FQFmiKveajOrNKeczTdbKv5Qy5JGRlJQcn5r011Mnt10h217zbZ01GgCzNr8eTAkPX8QhyQFnIkSJAg7rR8i2DMTpsNlWB3fWjXUMtt8H00RCHPwsk/1I5KTL0gbI66HNZNCj9moEGwl4G5jANaS9ISGTvIbRXmm4w2UfyY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-544455a4b56so4568198a12.1 for ; Sat, 18 Nov 2023 21:41:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1700372497; x=1700977297; 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=z1u1EolHyezT3Rj/p1S6KCWedsg36rnuPa2xYDe7iDw=; b=YzuesD6dbOBkRGRQEv8WpHg288uG5ogFlQMgtfly+huQH04gujHIc6X5sY32IDIfwp gMyMxCham3xX/Kv7ulrDPFAf66PLa2LbdjqFCq2T72GTcbN982qoLWdzhWTlLcTCoKie 3paqPjJ0L2GGYMlXdxCYAkhPv7xENYKiV1JeBwmuGYJ/AO1hrjRBCwfYbaGLjSzbWWHd 1dFi6/Qmp5sMs+Cl6Sz+h8GCDgRxB08NbRtxWzDe/tvDqWWEm9cd5B7WO9lMxUVNk9e2 Mw0QqlTBZXEKp50jmK8lPdL2vKyM8epzHKrz0j3vOyQQdad+2T2JXJldU9ovMXhL3wwq GvhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700372497; x=1700977297; 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=z1u1EolHyezT3Rj/p1S6KCWedsg36rnuPa2xYDe7iDw=; b=cT7IX+wdVRY9VhO5qbnqjdbZeiZjgsTlyiI8rZrT2dOc/XxvlKf3Snk+d41Go6gY3s 2b/Y0yNKDEKmEIDnah8WwVnp2Griw6/feZgToRFTY0GUowyYMStEECAD5WxcY1YkdTrM OT10ycHp8/Sob7pGcuW5PuxCe3yThCRGKTuODGiyRW3vMRYzRDyL6pfGAgOvhf2ehdRM cinq0r52wDe746NHzqIgVk/qLccxqUgnntew9vb0IVzhYR1w2as1k/ZtJ8Q1VUsXLSo0 mr3VrNyf2cQrx5Fd3HgfT2fAd+6vNhacdoJDS1XupSmHF2gMJQrN/Ed4ajVqGqfejuAT IMBA== X-Gm-Message-State: AOJu0YzGlqWXTspWAIVzxTdorjLk/Tp/A5364zG3KNe8YAoXAXZmoNFB Hh2R2S26TkDZ5RMlISRvIjxUUKrVDdIfpwVkMcankg== X-Received: by 2002:a05:6402:2044:b0:532:bc4d:9076 with SMTP id bc4-20020a056402204400b00532bc4d9076mr2767094edb.19.1700372496991; Sat, 18 Nov 2023 21:41:36 -0800 (PST) Received: from [192.168.219.3] ([78.8.192.131]) by smtp.gmail.com with ESMTPSA id s13-20020a056402014d00b00548a185fe5esm295718edu.24.2023.11.18.21.41.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2023 21:41:36 -0800 (PST) Date: Sun, 19 Nov 2023 05:41:33 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: Andrew Waterman , Jim Wilson , Kito Cheng , Palmer Dabbelt Subject: [PATCH 30/44] RISC-V/testsuite: Add branched cases for generic integer cond adds 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_10_SHORT_WORD_LINES, 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: 1782969821775204988 X-GMAIL-MSGID: 1782969821775204988 Verify, for generic integer conditional-add operations, if-conversion *not* to trigger at the respective sufficiently low `-mbranch-cost=' settings that make original branched code sequences cheaper than their branchless equivalents if-conversion would emit. Cover all integer relational operations to make sure no corner case escapes. gcc/testsuite/ * gcc.target/riscv/adddibeq.c: New test. * gcc.target/riscv/adddibge.c: New test. * gcc.target/riscv/adddibgeu.c: New test. * gcc.target/riscv/adddibgt.c: New test. * gcc.target/riscv/adddibgtu.c: New test. * gcc.target/riscv/adddible.c: New test. * gcc.target/riscv/adddibleu.c: New test. * gcc.target/riscv/adddiblt.c: New test. * gcc.target/riscv/adddibltu.c: New test. * gcc.target/riscv/adddibne.c: New test. * gcc.target/riscv/addsibeq.c: New test. * gcc.target/riscv/addsibge.c: New test. * gcc.target/riscv/addsibgeu.c: New test. * gcc.target/riscv/addsibgt.c: New test. * gcc.target/riscv/addsibgtu.c: New test. * gcc.target/riscv/addsible.c: New test. * gcc.target/riscv/addsibleu.c: New test. * gcc.target/riscv/addsiblt.c: New test. * gcc.target/riscv/addsibltu.c: New test. * gcc.target/riscv/addsibne.c: New test. --- gcc/testsuite/gcc.target/riscv/adddibeq.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/adddibge.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/adddibgeu.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/adddibgt.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/adddibgtu.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/adddible.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/adddibleu.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/adddiblt.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/adddibltu.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/adddibne.c | 28 ++++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/addsibeq.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/addsibge.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/addsibgeu.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/addsibgt.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/addsibgtu.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/addsible.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/addsibleu.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/addsiblt.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/addsibltu.c | 26 ++++++++++++++++++++++++++ gcc/testsuite/gcc.target/riscv/addsibne.c | 28 ++++++++++++++++++++++++++++ 20 files changed, 524 insertions(+) gcc-riscv-test-addcc-branch-generic.diff Index: gcc/gcc/testsuite/gcc.target/riscv/adddibeq.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/adddibeq.c @@ -0,0 +1,26 @@ +/* { 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=4 -mmovcc -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +adddieq (int_t w, int_t x, int_t y, int_t z) +{ + return w == x ? y + z : y; +} + +/* Expect branched assembly like: + + bne a0,a1,.L2 + add a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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 "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/adddibge.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/adddibge.c @@ -0,0 +1,26 @@ +/* { 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=3 -mmovcc -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +adddige (int_t w, int_t x, int_t y, int_t z) +{ + return w >= x ? y + z : y; +} + +/* Expect branched assembly like: + + blt a0,a1,.L2 + add a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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(?:bge|bgt|ble|blt)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgt|slt)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/adddibgeu.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/adddibgeu.c @@ -0,0 +1,26 @@ +/* { 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=3 -mmovcc -fdump-rtl-ce1" } */ + +typedef unsigned int __attribute__ ((mode (DI))) int_t; + +int_t +adddigeu (int_t w, int_t x, int_t y, int_t z) +{ + return w >= x ? y + z : y; +} + +/* Expect branched assembly like: + + bltu a0,a1,.L2 + add a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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 "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/adddibgt.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/adddibgt.c @@ -0,0 +1,26 @@ +/* { 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=3 -mmovcc -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +adddigt (int_t w, int_t x, int_t y, int_t z) +{ + return w > x ? y + z : y; +} + +/* Expect branched assembly like: + + ble a0,a1,.L2 + add a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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(?:bge|bgt|ble|blt)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgt|slt)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/adddibgtu.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/adddibgtu.c @@ -0,0 +1,26 @@ +/* { 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=3 -mmovcc -fdump-rtl-ce1" } */ + +typedef unsigned int __attribute__ ((mode (DI))) int_t; + +int_t +adddigtu (int_t w, int_t x, int_t y, int_t z) +{ + return w > x ? y + z : y; +} + +/* Expect branched assembly like: + + bleu a0,a1,.L2 + add a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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 "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/adddible.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/adddible.c @@ -0,0 +1,26 @@ +/* { 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=3 -mmovcc -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +adddile (int_t w, int_t x, int_t y, int_t z) +{ + return w <= x ? y + z : y; +} + +/* Expect branched assembly like: + + bgt a0,a1,.L2 + add a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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(?:bge|bgt|ble|blt)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgt|slt)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/adddibleu.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/adddibleu.c @@ -0,0 +1,26 @@ +/* { 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=3 -mmovcc -fdump-rtl-ce1" } */ + +typedef unsigned int __attribute__ ((mode (DI))) int_t; + +int_t +adddileu (int_t w, int_t x, int_t y, int_t z) +{ + return w <= x ? y + z : y; +} + +/* Expect branched assembly like: + + bgtu a0,a1,.L2 + add a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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 "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/adddiblt.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/adddiblt.c @@ -0,0 +1,26 @@ +/* { 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=3 -mmovcc -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +adddilt (int_t w, int_t x, int_t y, int_t z) +{ + return w < x ? y + z : y; +} + +/* Expect branched assembly like: + + bge a0,a1,.L2 + add a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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(?:bge|bgt|ble|blt)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgt|slt)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/adddibltu.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/adddibltu.c @@ -0,0 +1,26 @@ +/* { 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=3 -mmovcc -fdump-rtl-ce1" } */ + +typedef unsigned int __attribute__ ((mode (DI))) int_t; + +int_t +adddiltu (int_t w, int_t x, int_t y, int_t z) +{ + return w < x ? y + z : y; +} + +/* Expect branched assembly like: + + bgeu a0,a1,.L2 + add a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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 "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/adddibne.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/adddibne.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=3 -mmovcc -fdump-rtl-ce1" } */ + +typedef int __attribute__ ((mode (DI))) int_t; + +int_t +adddine (int_t w, int_t x, int_t y, int_t z) +{ + return w != x ? y + z : y; +} + +/* Expect branched assembly like: + + beq a0,a1,.L3 + add a0,a2,a3 + ret +.L3: + mv a0,a2 + 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 "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/addsibeq.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/addsibeq.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv32gc -mtune=sifive-5-series -mbranch-cost=4 -mmovcc -fdump-rtl-ce1" { target { rv32 } } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=4 -mmovcc -fdump-rtl-ce1" { target { rv64 } } } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +addsieq (int_t w, int_t x, int_t y, int_t z) +{ + return w == x ? y + z : y; +} + +/* Expect branched assembly like: + + bne a0,a1,.L2 + addw a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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 "\\s(?:sub|subw)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/addsibge.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/addsibge.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv32gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv32 } } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv64 } } } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +addsige (int_t w, int_t x, int_t y, int_t z) +{ + return w >= x ? y + z : y; +} + +/* Expect branched assembly like: + + blt a0,a1,.L2 + add[w] a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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(?:bge|bgt|ble|blt)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgt|slt)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/addsibgeu.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/addsibgeu.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv32gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv32 } } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv64 } } } */ + +typedef unsigned int __attribute__ ((mode (SI))) int_t; + +int_t +addsigeu (int_t w, int_t x, int_t y, int_t z) +{ + return w >= x ? y + z : y; +} + +/* Expect branched assembly like: + + bltu a0,a1,.L2 + add[w] a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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 "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/addsibgt.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/addsibgt.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv32gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv32 } } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv64 } } } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +addsigt (int_t w, int_t x, int_t y, int_t z) +{ + return w > x ? y + z : y; +} + +/* Expect branched assembly like: + + ble a0,a1,.L2 + add[w] a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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(?:bge|bgt|ble|blt)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgt|slt)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/addsibgtu.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/addsibgtu.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv32gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv32 } } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv64 } } } */ + +typedef unsigned int __attribute__ ((mode (SI))) int_t; + +int_t +addsigtu (int_t w, int_t x, int_t y, int_t z) +{ + return w > x ? y + z : y; +} + +/* Expect branched assembly like: + + bleu a0,a1,.L2 + add[w] a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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 "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/addsible.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/addsible.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv32gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv32 } } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv64 } } } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +addsile (int_t w, int_t x, int_t y, int_t z) +{ + return w <= x ? y + z : y; +} + +/* Expect branched assembly like: + + bgt a0,a1,.L2 + add[w] a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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(?:bge|bgt|ble|blt)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgt|slt)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/addsibleu.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/addsibleu.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv32gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv32 } } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv64 } } } */ + +typedef unsigned int __attribute__ ((mode (SI))) int_t; + +int_t +addsileu (int_t w, int_t x, int_t y, int_t z) +{ + return w <= x ? y + z : y; +} + +/* Expect branched assembly like: + + bgtu a0,a1,.L2 + add[w] a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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 "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/addsiblt.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/addsiblt.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv32gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv32 } } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv64 } } } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +addsilt (int_t w, int_t x, int_t y, int_t z) +{ + return w < x ? y + z : y; +} + +/* Expect branched assembly like: + + bge a0,a1,.L2 + add[w] a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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(?:bge|bgt|ble|blt)\\s" 1 } } */ +/* { dg-final { scan-assembler-not "\\s(?:sgt|slt)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/addsibltu.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/addsibltu.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv32gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv32 } } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv64 } } } */ + +typedef unsigned int __attribute__ ((mode (SI))) int_t; + +int_t +addsiltu (int_t w, int_t x, int_t y, int_t z) +{ + return w < x ? y + z : y; +} + +/* Expect branched assembly like: + + bgeu a0,a1,.L2 + add[w] a2,a2,a3 +.L2: + mv a0,a2 + */ + +/* { 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 "\\s(?:seqz|snez)\\s" } } */ Index: gcc/gcc/testsuite/gcc.target/riscv/addsibne.c =================================================================== --- /dev/null +++ gcc/gcc/testsuite/gcc.target/riscv/addsibne.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" "-Os" "-Oz" } } */ +/* { dg-options "-march=rv32gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv32 } } } */ +/* { dg-options "-march=rv64gc -mtune=sifive-5-series -mbranch-cost=3 -mmovcc -fdump-rtl-ce1" { target { rv64 } } } */ + +typedef int __attribute__ ((mode (SI))) int_t; + +int_t +addsine (int_t w, int_t x, int_t y, int_t z) +{ + return w != x ? y + z : y; +} + +/* Expect branched assembly like: + + beq a0,a1,.L3 + add[w] a0,a2,a3 + ret +.L3: + mv a0,a2 + 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 "\\s(?:sub|subw)\\s" } } */ +/* { dg-final { scan-assembler-not "\\s(?:seqz|snez)\\s" } } */