From patchwork Fri Aug 18 18:35:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 1823133 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; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=deG282Ub; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (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 4RS9Z10txJz1yfn for ; Sat, 19 Aug 2023 04:36:25 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DDA5D38432CD for ; Fri, 18 Aug 2023 18:36:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDA5D38432CD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1692383781; bh=wDF1YlpHyHxDKdFAblEt5N/6BDDNCBDc5eBBwwAV90E=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=deG282UbtusypD80waFptrHLcrqle23XOBHGt5NArVfoBxJXvm4jcZLAi8sxZGdUh 5Ese5a9CsyqnKBC7J0jGAMIslRu7Pjwa6hGiTBXBo+g/Lvk7g9RrRRcwatQSGjhwLF akJDHYT/hKdeH4yJLhtov9qajIKsvzvDyw+O0Knw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 9FFAA38708B4 for ; Fri, 18 Aug 2023 18:36:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9FFAA38708B4 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6bcb15aa074so677488a34.0 for ; Fri, 18 Aug 2023 11:36:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692383764; x=1692988564; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wDF1YlpHyHxDKdFAblEt5N/6BDDNCBDc5eBBwwAV90E=; b=D1uVb6ZphNpzHpiJyliyXG0Zvh6+c5rs8qSplSQVWTtTUVpvKmI/KFDjGjkEHsFKHp 9TE9263+YdOWtMWJ1iTaHXvPqBzR0/NPw91hIN2/6WGZm/QrfGH/YUMv1dCS7u1SHgp3 6Gk0IYz2I+goWKsmx0GhANfo9wTCpTOyu2SBTM53rUJFH2R61qjudK1rDf9/F+i5VldJ T7Ryn+5hp7Vn2KJp2/78bsJNtYpINz7q7ZBnHe1GuhicGuUO2t357nYWxakUlLmUlaue MhRlEGyLYjRZEst+VXmkjN8vva5orNR/5rfUnATpB8vCSVZBb/JlA9/FN75m/BCJNkgH wbUA== X-Gm-Message-State: AOJu0Yy1xvcwlkxGSk2YgM2oeQU5ORZSinaI7hp6dpNTdCjJkg3dw1cO EU/4Pj5OPG7C5YQsCODwJhCFzGNvLTTcxo++8q4= X-Google-Smtp-Source: AGHT+IG1bU14YjtIVWnQ4Ln6VpenVSQxK6mWcb/BsBQjplM2GlyP3SHLHb2coWZJol5q/8J5j5e/Dg== X-Received: by 2002:a9d:7112:0:b0:6bd:7a0f:5c52 with SMTP id n18-20020a9d7112000000b006bd7a0f5c52mr4414otj.12.1692383763939; Fri, 18 Aug 2023 11:36:03 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:c275:7563:d0a5:7f5d:1313]) by smtp.gmail.com with ESMTPSA id p25-20020a9d6959000000b006af9d8af435sm1095584oto.50.2023.08.18.11.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Aug 2023 11:36:03 -0700 (PDT) To: libc-alpha@sourceware.org, Andreas Schwab Subject: [PATCH] m68k: Use M68K_SCALE_AVAILABLE on __mpn_lshift and __mpn_rshift Date: Fri, 18 Aug 2023 15:35:59 -0300 Message-Id: <20230818183559.2081164-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" This patch adds a new macro, M68K_SCALE_AVAILABLE, similar to gmp scale_available_p (mpn/m68k/m68k-defs.m4) that expand to 1 if a scale factor can be used in addressing modes. This is used instead of __mc68020__ for some optimization decisions. Checked on a build for m68k-linux-gnu target mc68020 and mc68040. --- sysdeps/m68k/m680x0/lshift.S | 6 +++--- sysdeps/m68k/m680x0/rshift.S | 8 ++++---- sysdeps/m68k/sysdep.h | 7 +++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/sysdeps/m68k/m680x0/lshift.S b/sysdeps/m68k/m680x0/lshift.S index 4240738959..74de90380b 100644 --- a/sysdeps/m68k/m680x0/lshift.S +++ b/sysdeps/m68k/m680x0/lshift.S @@ -57,9 +57,9 @@ ENTRY(__mpn_lshift) bne L(Lnormal) cmpl R(s_ptr),R(res_ptr) bls L(Lspecial) /* jump if s_ptr >= res_ptr */ -#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) +#if M68K_SCALE_AVAILABLE lea MEM_INDX1(s_ptr,s_size,l,4),R(a2) -#else /* not mc68020 */ +#else movel R(s_size),R(d0) asll #2,R(d0) lea MEM_INDX(s_ptr,d0,l),R(a2) @@ -71,7 +71,7 @@ L(Lnormal:) moveql #32,R(d5) subl R(cnt),R(d5) -#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) +#if M68K_SCALE_AVAILABLE lea MEM_INDX1(s_ptr,s_size,l,4),R(s_ptr) lea MEM_INDX1(res_ptr,s_size,l,4),R(res_ptr) #else /* not mc68000 */ diff --git a/sysdeps/m68k/m680x0/rshift.S b/sysdeps/m68k/m680x0/rshift.S index d56a2b4a44..d398d0287e 100644 --- a/sysdeps/m68k/m680x0/rshift.S +++ b/sysdeps/m68k/m680x0/rshift.S @@ -56,9 +56,9 @@ ENTRY(__mpn_rshift) bne L(Lnormal) cmpl R(res_ptr),R(s_ptr) bls L(Lspecial) /* jump if res_ptr >= s_ptr */ -#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) +#if M68K_SCALE_AVAILABLE lea MEM_INDX1(res_ptr,s_size,l,4),R(a2) -#else /* not mc68020 */ +#else movel R(s_size),R(d0) asll #2,R(d0) lea MEM_INDX(res_ptr,d0,l),R(a2) @@ -121,10 +121,10 @@ L(Lend:) cfi_restore_state L(Lspecial:) -#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) +#if M68K_SCALE_AVAILABLE lea MEM_INDX1(s_ptr,s_size,l,4),R(s_ptr) lea MEM_INDX1(res_ptr,s_size,l,4),R(res_ptr) -#else /* not mc68000 */ +#else movel R(s_size),R(d0) asll #2,R(d0) addl R(d0),R(s_ptr) diff --git a/sysdeps/m68k/sysdep.h b/sysdeps/m68k/sysdep.h index dfc8aebc3a..a1e89b87d5 100644 --- a/sysdeps/m68k/sysdep.h +++ b/sysdeps/m68k/sysdep.h @@ -72,3 +72,10 @@ # endif #endif /* __ASSEMBLER__ */ + +# if defined __mc68020__ || defined __mc68030__ || defined __mc68040__ \ + || defined __mc68060__ +# define M68K_SCALE_AVAILABLE 1 +# else +# define M68K_SCALE_AVAILABLE 0 +# endif