From patchwork Wed Jul 17 16:16:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1961705 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=MydbqmWP; 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 4WPLfs46plz20B2 for ; Thu, 18 Jul 2024 02:16:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BF1D5385DC1B for ; Wed, 17 Jul 2024 16:16:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id D38B13858430 for ; Wed, 17 Jul 2024 16:16:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D38B13858430 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D38B13858430 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721232995; cv=none; b=dpN1zdVwOkIjY2Iqt5Pr8JBQU5c60pb9vPRCzwBCWUZ43exdRi0DUMY3uw0s4bcxpSyqYs9U/crAf6Oa0ZCdXcgy0HDvP1nNrim469J+FUtvk9MMD1kiv568Q51v8UtfzO7wLbP2VSYnDJBT361p5plpGPLT+YP0DxNHG2obwlA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721232995; c=relaxed/simple; bh=AGqdrANMuInRKQsjKRRgRC66SJr+tOYbHn0DuXWd8BI=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=IQhlZ58R7A1e76nIwk+wsd/CGdTPY/OgNnobAgtQS0Am8OgWHHzC9b2LtE+iZEnfMO9JwX++rvBOPVUXIGJJ+IQnbCV7Im41899u0BzcPIc61MkLWsqam5NtsztzTR44zl/X2CmcoxU7EzrWqnnqJ97zlW6X2formKmO+iMjIJQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2eedeca1c79so54128821fa.3 for ; Wed, 17 Jul 2024 09:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721232991; x=1721837791; darn=gcc.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=FrtZYkUcAVtf+PN4uO4eqMZSKIn9fP9gnwTWVbgzRxU=; b=MydbqmWPvxVpdnWuw3TMqhmxWRoSaC8gP3A4vymE/0V70ik9OKPZ+cmjjy669qLAYU XNdLqIpB7Ia5/KBMAAEtLU7TGm0RVjV7AfJGaB+2KZAJl2XJqqxCQD4fChAQG9Lrvg2d iZVZ4s1gj9caH1213AJcjC9L46mkmMlSbVHY5wQ1cuBUlU0JWEd8KNJpDonNDmVEh782 3HzdrgjRLS9ukTjz8X7MbVuuGMdOzOjU2CkHDdxoze/3h1aHFTl13tZPzDrGi6WRWOzr YgsRMKtNaj/iR19AMqwTXwEVIORLDOvD861K+ZknVKWTumcDdwqOrgtogoTCTSmHskqP vR0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721232991; x=1721837791; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=FrtZYkUcAVtf+PN4uO4eqMZSKIn9fP9gnwTWVbgzRxU=; b=whaQpK3NqE2V+wjU4OlzZ0wgcnvqnooxxQ+M0qrYNCJ+utus5Lks8TPru16MNYoazi UxGjfRhRrU+02WJI4/+t4rxm/73XLMmqwl0BRp4DTLV+VwEjdSAEloidqM3QBVW6sHRn Jerq6Uq8PxU9E89US427MlaHA/nNSvaGF6sdAV9v82Hl9+hXPuQwWp9alm9c6WuDXsoi /9FQuAcNLkcUX3vqdGJdVNJyq8Vc0Cfgqv35m3iG3Fglel0B8bLZVjZor4U+oau6W2l/ 9aoXF9/GM1ax46zHh39a3h1lC1UftbDFdULH/AMQew0ROqT3DkgqCXCwqt/SpY1Qmhfa 9iaQ== X-Gm-Message-State: AOJu0YydocKbDQfZfbsY5syQAbzogE4uJCwFmsNO/R2Y+qbcwiKKI5lH qilBcQh9Nx+vI6x1YLMOvunZ+BK+nOrCwMhcB6NTvFNs6TYQCa+zFGuNObQ1/LDpklWE9DmZuHR z342dkjJ8xsJjxvi/aAVD1lhNgKMy71LMyG8= X-Google-Smtp-Source: AGHT+IGgxuHwuNS8llT16fd5Gel9NLP8UDOp9X913N7MYQb7aa2FoxYgseWSMxmIu4mXnkYSclAYJGJxjZ6tIdkJsmk= X-Received: by 2002:a2e:3615:0:b0:2ec:4de9:7334 with SMTP id 38308e7fff4ca-2eefd0934d5mr17030011fa.11.1721232990646; Wed, 17 Jul 2024 09:16:30 -0700 (PDT) MIME-Version: 1.0 From: Uros Bizjak Date: Wed, 17 Jul 2024 18:16:18 +0200 Message-ID: Subject: [committed] alpha: Fix duplicate !tlsgd!62 assemble error [PR115526] To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, 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~incoming=patchwork.ozlabs.org@gcc.gnu.org Add missing "cannot_copy" attribute to instructions that have to stay in 1-1 correspondence with another insn. PR target/115526 gcc/ChangeLog: * config/alpha/alpha.md (movdi_er_high_g): Add cannot_copy attribute. (movdi_er_tlsgd): Ditto. (movdi_er_tlsldm): Ditto. (call_value_osf_): Ditto. gcc/testsuite/ChangeLog: * gcc.target/alpha/pr115526.c: New test. Tested by Maciej on Alpha/Linux target and reported in the PR. Uros. diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md index 1e2de5a4d15..bd92392878e 100644 --- a/gcc/config/alpha/alpha.md +++ b/gcc/config/alpha/alpha.md @@ -3902,7 +3902,8 @@ (define_insn "movdi_er_high_g" else return "ldq %0,%2(%1)\t\t!literal!%3"; } - [(set_attr "type" "ldsym")]) + [(set_attr "type" "ldsym") + (set_attr "cannot_copy" "true")]) (define_split [(set (match_operand:DI 0 "register_operand") @@ -3926,7 +3927,8 @@ (define_insn "movdi_er_tlsgd" return "lda %0,%2(%1)\t\t!tlsgd"; else return "lda %0,%2(%1)\t\t!tlsgd!%3"; -}) +} + [(set_attr "cannot_copy" "true")]) (define_insn "movdi_er_tlsldm" [(set (match_operand:DI 0 "register_operand" "=r") @@ -3939,7 +3941,8 @@ (define_insn "movdi_er_tlsldm" return "lda %0,%&(%1)\t\t!tlsldm"; else return "lda %0,%&(%1)\t\t!tlsldm!%2"; -}) +} + [(set_attr "cannot_copy" "true")]) (define_insn "*movdi_er_gotdtp" [(set (match_operand:DI 0 "register_operand" "=r") @@ -5908,6 +5911,7 @@ (define_insn "call_value_osf_" "HAVE_AS_TLS" "ldq $27,%1($29)\t\t!literal!%2\;jsr $26,($27),%1\t\t!lituse_!%2\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*" [(set_attr "type" "jsr") + (set_attr "cannot_copy" "true") (set_attr "length" "16")]) ;; We must use peep2 instead of a split because we need accurate life diff --git a/gcc/testsuite/gcc.target/alpha/pr115526.c b/gcc/testsuite/gcc.target/alpha/pr115526.c new file mode 100644 index 00000000000..2f57903fec3 --- /dev/null +++ b/gcc/testsuite/gcc.target/alpha/pr115526.c @@ -0,0 +1,46 @@ +/* PR target/115526 */ +/* { dg-do assemble } */ +/* { dg-options "-O2 -Wno-attributes -fvisibility=hidden -fPIC -mcpu=ev4" } */ + +struct _ts { + struct _dtoa_state *interp; +}; +struct Bigint { + int k; +} *_Py_dg_strtod_bs; +struct _dtoa_state { + struct Bigint p5s; + struct Bigint *freelist[]; +}; +extern _Thread_local struct _ts _Py_tss_tstate; +typedef struct Bigint Bigint; +int pow5mult_k; +long _Py_dg_strtod_ndigits; +void PyMem_Free(); +void Bfree(Bigint *v) { + if (v) + { + if (v->k) + PyMem_Free(); + else { + struct _dtoa_state *interp = _Py_tss_tstate.interp; + interp->freelist[v->k] = v; + } + } +} +static Bigint *pow5mult(Bigint *b) { + for (;;) { + if (pow5mult_k & 1) { + Bfree(b); + if (b == 0) + return 0; + } + if (!(pow5mult_k >>= 1)) + break; + } + return 0; +} +void _Py_dg_strtod() { + if (_Py_dg_strtod_ndigits) + pow5mult(_Py_dg_strtod_bs); +}