From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by sourceware.org (Postfix) with ESMTPS id 21D8C3858C52 for ; Wed, 11 Oct 2023 12:55:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 21D8C3858C52 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-7a269637b98so240183039f.3 for ; Wed, 11 Oct 2023 05:55:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1697028944; x=1697633744; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MVIgHRDO7Yzf4JNN4XPGh6LZ/MJAB8mm2BvoK8QnY7g=; b=MQfDRq7Dbs5oNYOlzF684C1sbbGoEZAJmVCvFrkFbE3fA4waw8bPrxMznMWVFPdwUH JO6SYQf0T2rC2QfOP+/Wcezdl+sFFuiU2aIDAwe2KRNMgYeXQJ9ei+rnKDlvjK2k+0qr 9M5TJW2fx1XP4fdCgt/evSr4/sn8syRTwKAbYUkY1+XnmrAM0bJMPCXCSFzu5Ef3+o3v x6iR4MJlzNN6ridmwmjSdrugXXxQaeclKSWGR8KWhJT6sgkLruTHmQNWUaOiUKojDelq xdhnci5fN5yNK0r9XN30ewL+fqsWhBIfPi7MUW1yvQqZFFl0U6r8PCKO3ZaajUbh4ppT vl1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697028944; x=1697633744; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MVIgHRDO7Yzf4JNN4XPGh6LZ/MJAB8mm2BvoK8QnY7g=; b=ueeFCKYXP2g27B7JC78z8K+6O79fFBC8FkUDfuxyF1m7Xh4N2TSGcDlrWCwZEKb2Uf urcZ0sNDkdx5OD1g89MIFOkSmhnYUStenr5Zam6Paf6+5Nt17oAeQmLq3YGtLWrU59Cg hG3hH2Bs+56mXWnxtWYB3RJwcK0ghUekwu5qWmn3OmrHDarxTEnhReCs4ZGQrx/cxAei 0glZ5ebX0Zt+vUMZ6TF32Up25Drlg1Rf1n95g8VVdnO9m+Gwy5uPLwz+f7gXBt6HzQQI VyOLaiVFg2YvzHlda3EO48IwYKkAY6qW07nVvb4qHsp3vHMAze5RXgc+YZXN5IBhPKqD l86A== X-Gm-Message-State: AOJu0YxU3GcZ3tFfN/8kkmvWsLdpNcT4AVfaV0ROnY9z54I1qfAUiSml uBsndItF88pu9Wd2Qt7J8njjB3AUW/kT+5tnvLkxes1BgoFVi80zEreyxeJYdCjioNhZV8S0VBj +7dYcyAAC+OkiItpmlnnOiaXGyRvG4EqZkzxccgCgUFd+96VLz35Pj+PtrUAbycaOvI2Gpbz8dw == X-Google-Smtp-Source: AGHT+IEJrkrGDf/PkKpIgROhRMBZDWmN8C8BjGlUZMjtd2/9NtJpsS1Tc3erW0KIkxo1GipwpeK7gA== X-Received: by 2002:a05:6602:22c6:b0:798:26fb:ff2 with SMTP id e6-20020a05660222c600b0079826fb0ff2mr24455702ioe.10.1697028943895; Wed, 11 Oct 2023 05:55:43 -0700 (PDT) Received: from mail-io1-f45.google.com (mail-io1-f45.google.com. [209.85.166.45]) by smtp.gmail.com with ESMTPSA id j27-20020a02cb1b000000b0042b14d9be7bsm3375328jap.22.2023.10.11.05.55.42 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Oct 2023 05:55:43 -0700 (PDT) Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-7a269637b98so240182139f.3 for ; Wed, 11 Oct 2023 05:55:42 -0700 (PDT) X-Received: by 2002:a05:6602:2774:b0:795:1bbc:1fca with SMTP id l20-20020a056602277400b007951bbc1fcamr21743659ioe.7.1697028942623; Wed, 11 Oct 2023 05:55:42 -0700 (PDT) MIME-Version: 1.0 References: <001ae968-da60-4e3b-8909-d6b99980ea63@ventanamicro.com> <006feb32-ab7f-4733-a308-35dbe4077854@gmail.com> In-Reply-To: <006feb32-ab7f-4733-a308-35dbe4077854@gmail.com> From: Andrew Waterman Date: Wed, 11 Oct 2023 05:55:31 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [committed] [PR target/93062] RISC-V: Handle long conditional branches for RISC-V To: Jeff Law Cc: Jeff Law , "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 List-Id: On Tue, Oct 10, 2023 at 8:26=E2=80=AFPM Jeff Law wr= ote: > > > > On 10/10/23 18:24, Andrew Waterman wrote: > > I remembered another concern since we discussed this patch privately. > > Using ra for long calls results in a sequence that will corrupt the > > return-address stack. > Yup. We've actually got data on that internally, it's not showing up in > a significant way in practice. > > > I know nothing > > about the complexity of register scavenging, but it would be nice to > > opportunistically use a scratch register (other than t0), falling back > > to ra only when necessary. > The nice thing about making $ra fixed is some can add a register > scavenging approach, then fall back to $ra if they're unable to find a > register to reuse. > > > > > Tangentially, I noticed the patch uses `jump label, ra' for far > > branches but uses `call label' for far jumps. These corrupt the RAS > > in opposite ways (the former pops the RAS and the latter pushes it. > > Any reason for using a different sequence in one than the other? > I'd noticed it as well -- that's the way it was in the patch that was > already in Ventana's tree ;-) My plan was to address that separately > after dropping in enough infrastructure to allow me to force everything > to be far branches for testing purposes. Sounds like we're thinking many of the same thoughts... thanks for dragging this patch towards the finish line! > > jeff