From patchwork Thu Oct 12 13:06:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christoph_M=C3=BCllner?= X-Patchwork-Id: 152009 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1214973vqb; Thu, 12 Oct 2023 06:07:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPz17CtmcWMsh5ruhJ/N7RVh+UfGxy6J+15neTnigAG1f5VzFaPu3E2DvpxLkg3eoJfcr2 X-Received: by 2002:a05:622a:11d0:b0:417:b746:8dec with SMTP id n16-20020a05622a11d000b00417b7468decmr28070877qtk.58.1697116046327; Thu, 12 Oct 2023 06:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697116046; cv=none; d=google.com; s=arc-20160816; b=k04coKXaBDzzyjCj0692x67kvKmH18m6e43nLNAf2LUvRS2yxTZR25tzI3z8isjhVF obPjs6By2YZY+bEThTBhfXPmVdp/LhdpQfuCgr9UPP+kLA+Fnas0KqPgOkpG6e0dDegP 5FCchN2Pi+InNjk0GHTfNoLz4WX5R0dDqBKBLWbKfHD0HIV3SPW2Tn4d1SNb07CSLy+6 urBmPLQTkurhEmKt/qmMkRB5awPDvMgxhW0jlnyxLcc2spRLGcq4+YcMeJx4KXF1L+gL mxJ4viPenhzC10T8NbZWab01p/r2jWQ3XljRUVZzb1phTcYwBKP8eU6RBiB5B0gYoh/9 CJ3A== ARC-Message-Signature: i=1; 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:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=9px3B0s0uvi4Ti6riMJ9fc/tJ9G91bLb+EDV13Uc6/A=; fh=WebLxJ9eMvJy02Drt/lVJibbcW7z1ancBRH4+WKwUvA=; b=DOm3Bv7KabNSy/olGJ/Qe5WzvIxDh5y5YPxStCHotNvRx0BASEdF03M2ykW/fOiGno ElKchM1aaIcn3MTILMG8Qbply0fHvs5oiRTw4c5+pHdJ8AWIv5+DuMyFO+66bl3KBH0t 0OocCcZhu5Kz6W7IxcI1DAcUUZxxsgha3/3kzjHdoNX4nTDUyf4sgbHs18NwD7rOUMnh y801+2t3XlUWe5JBQxIDEMKbr96eLtoWAxvO2v/5kZn7Sb45DsVOHEEyMxbz6TxRMFp6 uKoEXp4Kfb/4P1RawgApZQhKaHm4WpmEQ3ftfFVuaeQSqHKkV8sZYjb6VxOY8PdvApmU dNuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vrull.eu header.s=google header.b=m9vTA4Ew; 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 4-20020ac85704000000b0041817300e0dsi10964555qtw.58.2023.10.12.06.07.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 06:07:26 -0700 (PDT) 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=@vrull.eu header.s=google header.b=m9vTA4Ew; 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 7A0E538555B9 for ; Thu, 12 Oct 2023 13:07:25 +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 DE9FA38582A1 for ; Thu, 12 Oct 2023 13:06:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DE9FA38582A1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-522bd411679so1678088a12.0 for ; Thu, 12 Oct 2023 06:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1697116008; x=1697720808; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9px3B0s0uvi4Ti6riMJ9fc/tJ9G91bLb+EDV13Uc6/A=; b=m9vTA4EwoemHERj5vgYyAqQnMd01TNIeplPSL593m/IggXQYmPSrBqQvmNdSPndOh7 bQBoNsbWKb0uwyql8MgJc0gGVq+85913E6A+ilY3bsTC0fCUVeLp89/duuG7Xm3pxCDp 6ndfsi1ievfTXJKmN+uvpapM3gjPe/MgdKYjSg4Mt7VtpveBwL89CselRkIDzhxMtX6L +pSbFnwyzuFBV2D6+r4msrtvvIOPcT/dkcTc8xosvQpBtyNVuU0PRnji2eJ2TMUi7SCV tpAjQQ6YuP+EYOZgF1N+skNTDqCaeLtFmAh1WHCkWk0YkPwOqw/rWuhKbrGwsjEm+Sg4 75Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697116008; x=1697720808; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9px3B0s0uvi4Ti6riMJ9fc/tJ9G91bLb+EDV13Uc6/A=; b=KAJ7YkObyvyi95OXMwSVnNTBNOgUstZuV7c7hsUGxHZYJBp2mThFkwBBnXcCSmWGMM g9i5QParCf6pa6SuR+hcYpUQq9J5B9rgkqW2FYe+Mzj3HalEoOkuVnoskZCs2XmJ0ALY CXvER3RZK/8E6pCgp7hX/r8hXdsEN4Pcrh6u56KQy7uaVtrCN4w4EVApuYVfF3sn7VXw oxG9UpmwfNfHOtBMl8gCGLgZ9U94Uqq8SUiU09qsz5vNbuP8P1cnIxFK6yW4PG9tcMS7 qSOdVxgalQjN3tbo+FdCyuXN4Zvyktk9/SjaVr4Ha4z977iliVJ3cocGDNa502HcIVQs i/nw== X-Gm-Message-State: AOJu0YyKl1bHLpFZNn9x36TlNH0qegIi4WJG+0tPYi3U69jAc9ALQxb1 SBk8qikBi4EfOc9zArbrD7cyRHa5atPWlKI1R58= X-Received: by 2002:a05:6402:27ca:b0:53e:1825:d547 with SMTP id c10-20020a05640227ca00b0053e1825d547mr1427719ede.24.1697116008131; Thu, 12 Oct 2023 06:06:48 -0700 (PDT) Received: from beast.fritz.box (62-178-148-172.cable.dynamic.surfer.at. [62.178.148.172]) by smtp.gmail.com with ESMTPSA id ev5-20020a056402540500b0053b67aba57bsm7304477edb.17.2023.10.12.06.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 06:06:47 -0700 (PDT) From: Christoph Muellner To: gcc-patches@gcc.gnu.org, Kito Cheng , Jim Wilson , Palmer Dabbelt , Andrew Waterman , Philipp Tomsich , Jeff Law , Patrick O'Neill , Vineet Gupta Cc: =?utf-8?q?Christoph_M=C3=BCllner?= Subject: [PATCH v2] RISC-V: Make xtheadcondmov-indirect tests robust against instruction reordering Date: Thu, 12 Oct 2023 15:06:44 +0200 Message-ID: <20231012130644.561301-1-christoph.muellner@vrull.eu> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_MANYTO, KAM_SHORT, LIKELY_SPAM_BODY, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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: 1779555155169640969 X-GMAIL-MSGID: 1779555155169640969 From: Christoph Müllner Fixes: c1bc7513b1d7 ("RISC-V: const: hide mvconst splitter from IRA") A recent change broke the xtheadcondmov-indirect tests, because the order of emitted instructions changed. Since the test is too strict when testing for a fixed instruction order, let's change the tests to simply count instruction, like it is done for similar tests. Reported-by: Patrick O'Neill Signed-off-by: Christoph Müllner gcc/testsuite/ChangeLog: * gcc.target/riscv/xtheadcondmov-indirect.c: Make robust against instruction reordering. Signed-off-by: Christoph Müllner --- .../gcc.target/riscv/xtheadcondmov-indirect.c | 89 ++++++------------- 1 file changed, 29 insertions(+), 60 deletions(-) diff --git a/gcc/testsuite/gcc.target/riscv/xtheadcondmov-indirect.c b/gcc/testsuite/gcc.target/riscv/xtheadcondmov-indirect.c index c3253ba5239..427c9c1a41e 100644 --- a/gcc/testsuite/gcc.target/riscv/xtheadcondmov-indirect.c +++ b/gcc/testsuite/gcc.target/riscv/xtheadcondmov-indirect.c @@ -1,16 +1,11 @@ /* { dg-do compile } */ -/* { dg-options "-march=rv32gc_xtheadcondmov -fno-sched-pressure" { target { rv32 } } } */ -/* { dg-options "-march=rv64gc_xtheadcondmov -fno-sched-pressure" { target { rv64 } } } */ +/* { dg-options "-march=rv32gc_xtheadcondmov" { target { rv32 } } } */ +/* { dg-options "-march=rv64gc_xtheadcondmov" { target { rv64 } } } */ /* { dg-skip-if "" { *-*-* } {"-O0" "-Os" "-Og" "-Oz" "-flto" } } */ -/* { dg-final { check-function-bodies "**" "" } } */ -/* -** ConEmv_imm_imm_reg: -** addi a[0-9]+,a[0-9]+,-1000 -** li a[0-9]+,10 -** th\.mvnez a[0-9]+,a[0-9]+,a[0-9]+ -** ret -*/ +/* addi aX, aX, -1000 + li aX, 10 + th.mvnez aX, aX, aX */ int ConEmv_imm_imm_reg(int x, int y) { if (x == 1000) @@ -18,13 +13,8 @@ int ConEmv_imm_imm_reg(int x, int y) return y; } -/* -** ConEmv_imm_reg_reg: -** addi a[0-9]+,a[0-9]+,-1000 -** th.mveqz a[0-9]+,a[0-9]+,a[0-9]+ -** mv a[0-9]+,a[0-9]+ -** ret -*/ +/* addi aX, aX, -1000 + th.mveqz aX, aX, aX */ int ConEmv_imm_reg_reg(int x, int y, int z) { if (x == 1000) @@ -32,13 +22,9 @@ int ConEmv_imm_reg_reg(int x, int y, int z) return z; } -/* -** ConEmv_reg_imm_reg: -** sub a[0-9]+,a[0-9]+,a[0-9]+ -** li a[0-9]+,10 -** th.mvnez a[0-9]+,a[0-9]+,a[0-9]+ -** ret -*/ +/* sub aX, aX, aX + li aX, 10 + th.mvnez aX, aX, aX */ int ConEmv_reg_imm_reg(int x, int y, int z) { if (x == y) @@ -46,13 +32,8 @@ int ConEmv_reg_imm_reg(int x, int y, int z) return z; } -/* -** ConEmv_reg_reg_reg: -** sub a[0-9]+,a[0-9]+,a[0-9]+ -** th.mveqz a[0-9]+,a[0-9]+,a[0-9]+ -** mv a[0-9]+,a[0-9]+ -** ret -*/ +/* sub aX, aX, aX + th.mveqz aX, aX, aX */ int ConEmv_reg_reg_reg(int x, int y, int z, int n) { if (x == y) @@ -60,14 +41,10 @@ int ConEmv_reg_reg_reg(int x, int y, int z, int n) return n; } -/* -** ConNmv_imm_imm_reg: -** addi a[0-9]+,a[0-9]+,-1000+ -** li a[0-9]+,9998336+ -** addi a[0-9]+,a[0-9]+,1664+ -** th.mveqz a[0-9]+,a[0-9]+,a[0-9]+ -** ret -*/ +/* addi aX, aX, -1000 + li aX, 9998336 + addi aX, aX, 1664 + th.mveqz aX, aX, aX */ int ConNmv_imm_imm_reg(int x, int y) { if (x != 1000) @@ -75,13 +52,8 @@ int ConNmv_imm_imm_reg(int x, int y) return y; } -/* -**ConNmv_imm_reg_reg: -** addi a[0-9]+,a[0-9]+,-1000+ -** th.mvnez a[0-9]+,a[0-9]+,a[0-9]+ -** mv a[0-9]+,a[0-9]+ -** ret -*/ +/* addi aX, aX, 1000 + th.mvnez aX, aX, aX */ int ConNmv_imm_reg_reg(int x, int y, int z) { if (x != 1000) @@ -89,13 +61,9 @@ int ConNmv_imm_reg_reg(int x, int y, int z) return z; } -/* -**ConNmv_reg_imm_reg: -** sub a[0-9]+,a[0-9]+,a[0-9]+ -** li a[0-9]+,10+ -** th.mveqz a[0-9]+,a[0-9]+,a[0-9]+ -** ret -*/ +/* sub aX, aX, aX + li aX, 10 + th.mveqz aX, aX, aX */ int ConNmv_reg_imm_reg(int x, int y, int z) { if (x != y) @@ -103,16 +71,17 @@ int ConNmv_reg_imm_reg(int x, int y, int z) return z; } -/* -**ConNmv_reg_reg_reg: -** sub a[0-9]+,a[0-9]+,a[0-9]+ -** th.mvnez a[0-9]+,a[0-9]+,a[0-9]+ -** mv a[0-9]+,a[0-9]+ -** ret -*/ +/* sub aX, aX, aX + th.mvnez aX, aX, aX */ int ConNmv_reg_reg_reg(int x, int y, int z, int n) { if (x != y) return z; return n; } + +/* { dg-final { scan-assembler-times "addi\t" 5 } } */ +/* { dg-final { scan-assembler-times "li\t" 4 } } */ +/* { dg-final { scan-assembler-times "sub\t" 4 } } */ +/* { dg-final { scan-assembler-times "th.mveqz\t" 4 } } */ +/* { dg-final { scan-assembler-times "th.mvnez\t" 4 } } */