From patchwork Fri Jun 28 08:19:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YunQiang Su X-Patchwork-Id: 1953825 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=tQjc15tI; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W9Szk50WFz20X6 for ; Fri, 28 Jun 2024 18:20:16 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 33D0B382EF01 for ; Fri, 28 Jun 2024 08:20:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 33D0B382EF01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1719562812; bh=D/P2n+5zmQNo+ibjnh37vnnKwWaJsnS9qnyD1twWhoQ=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=tQjc15tIdqD3mkvSaU++/THXq2DPB46zxJn1W3+WnQapJl2ajtZ5xslm7H94y/9uR T8JtKzIMzgcYE1MhsS/UuX9FzKt8EITZQNEAHMv5i5UgQym25etnQYJ5bu77wS3mjT coj9aNM1gy/ISY/Gf8MtBE4WWDKxOXhmn4soJ0cw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by sourceware.org (Postfix) with ESMTPS id DA8E6382FADF; Fri, 28 Jun 2024 08:19:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DA8E6382FADF Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DA8E6382FADF Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719562765; cv=none; b=sWZOV5aVP4FgvxagR0akBIFU26VyN+hrWNxKt2zG6ZVWuSwbaZnC+zYZHTNl8xyliIvy+vss8lY1U/A0aJblRmK6ygO/WwR/OumvDRYsznla2+I4ldJLQs8d+1TNnnDrAm7/fnPI4sblg1FpGF4LqYD/hDe56GWC3Z1ETGdarC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719562765; c=relaxed/simple; bh=YMrW5VfJ2OWLulf8d1jkBpLaNYy7jzykTBMdSdnJngo=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=IXZFuRjhOcrjXQzTtRbwPiPDTZheGK8eBckAdjhdxf96AK40FkT4H4+1qxPijeuFOs6M7NmKEFNimZ5oMNGWKiQgTyqK5YM5q948ZHS5PqCV3GF6ufYZyBMaHnk7pqHpEVcZ8uLx/ckH42t5fYZBaeGl1+RoH+Tv6tDvwj1johI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1fa75f53f42so1624125ad.0; Fri, 28 Jun 2024 01:19:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719562750; x=1720167550; 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=D/P2n+5zmQNo+ibjnh37vnnKwWaJsnS9qnyD1twWhoQ=; b=Y7TMtSyrz7TLfeNPFGyIC3IUEY0dp/StBOy8jq2ngx8baWvwa0evCrnx4pdKzq+LCV RQTiB4XuR1Z8OWIfQDhqZZQjA53N4GPsIfPz8rsInrj9n1FVYx/ImlZ7TJiTqNrEum6m MAVNM80J1zDnKEhbwhxRglITVLRRmnkGZUIeE/3glKMaidspcgsu53G6zVvaf/9xXKpc Cwa5cYzTuu+0Kxv9IxI9qPpZF8+TapmPdsyCMOYHsGG/I6KXKBi+UymyeGarj98Qs0eK NYvEqILX1CwcM0Z+jQWiIXoBa66kX2eL2D6h6mINTvLHLq09Uidk20UrMRxMKGC0Qkho JLew== X-Gm-Message-State: AOJu0YxTfgMu9+1QNF5dtX5NIYBQe0HkGvTBI45aDsc3CzK6+YzdqsTu VAn19m+gG6PqsWnRIKOGBqL8MA/WOxeSSlZfv5op1SQXBnIfqTsTMmRdhba1 X-Google-Smtp-Source: AGHT+IG8DDecvIBAI+R51TDe1tQy5Qcorca1gue7GlgreX28U0HfiUKFqX/jLVk1BuLtogwvrYjnDA== X-Received: by 2002:a17:902:daca:b0:1f9:e0e5:cda0 with SMTP id d9443c01a7336-1fa24084525mr166963215ad.55.1719562749765; Fri, 28 Jun 2024 01:19:09 -0700 (PDT) Received: from localhost.localdomain ([194.169.55.179]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac153774bsm9654715ad.167.2024.06.28.01.19.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 28 Jun 2024 01:19:09 -0700 (PDT) From: YunQiang Su To: gcc-patches@gcc.gnu.org Cc: YunQiang Su Subject: [PATCH] MIPS/testsuite: Fix umips-save-restore-1.c Date: Fri, 28 Jun 2024 16:19:03 +0800 Message-Id: <20240628081903.17992-1-syq@gcc.gnu.org> X-Mailer: git-send-email 2.39.3 (Apple Git-146) MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org With some recent optimization, -O1/-O2/-O3 can archive almost same performace/size by stack load/store. Thus lwm/swm will save/store less callee-saved register. In fact only $16 is saved with swm. To be sure that this optimization does exist, let's add 2 more function calls. So that lwm/swm can be much more profitable. If we add only once more, -O1 will still use stack load/store. gcc/testsuite * gcc.target/mips/umips-save-restore-1.c: Be sure lwm/swm are used for more callee-saved registers with addtional 2 more function calls. --- gcc/testsuite/gcc.target/mips/umips-save-restore-1.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/gcc.target/mips/umips-save-restore-1.c b/gcc/testsuite/gcc.target/mips/umips-save-restore-1.c index ff1ea4b339a..0e2c4dcc844 100644 --- a/gcc/testsuite/gcc.target/mips/umips-save-restore-1.c +++ b/gcc/testsuite/gcc.target/mips/umips-save-restore-1.c @@ -7,12 +7,14 @@ int bar (int, int, int, int, int); MICROMIPS int foo (int n, int a, int b, int c, int d) { - int i, j; + int i, j, k, l; i = bar (n, a, b, c, d); j = bar (n, a, b, c, d); - return i + j; + k = bar (n, a, b, c, d); + l = bar (n, a, b, c, d); + return i + j + k + l; } -/* { dg-final { scan-assembler "\tswm\t\\\$16-\\\$2(0|1),\\\$31" } } */ -/* { dg-final { scan-assembler "\tlwm\t\\\$16-\\\$2(0|1),\\\$31" } } */ +/* { dg-final { scan-assembler "\tswm\t\\\$16-\\\$2(2|3),\\\$31" } } */ +/* { dg-final { scan-assembler "\tlwm\t\\\$16-\\\$2(2|3),\\\$31" } } */