From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 439733858C41 for ; Wed, 11 Oct 2023 03:26:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 439733858C41 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-690ce3c55f1so4851131b3a.0 for ; Tue, 10 Oct 2023 20:26:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696994785; x=1697599585; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=BQXcewpOHTxAlo3beFL25Cr3T4qzURHruAezZuM1vtk=; b=PPuWb4pVK8Wmz/p60phVTJECjaprqVn4oVGgdqk1NC7P5Uj+OMqmlp5+3elTlO0YV+ yTXIpkrhF42EamL6M3C4PwWn3+sww7tyWLhlcG8UruKpuejBEW72GKg1B6h4bHkL0d21 TFNLRfDJi3GCsarC0W50NZ7HxHQi6n6mqIF4pGnACeSjZr5cCzR5p8XT6DbkskM5aE5F knyfgqvX6b3i2us5P9CT1+cGi2tgZwlA4hgfvwoJHolL+msQdwQcuPC0vRIvVYUaPfNT 4OHbOkQ8CS2xQrnfQJGbFBGzBdWbE4igfG7oF0E1EFecWPIADeyzV3R+ff1eWHgrTJ1G blbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696994785; x=1697599585; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BQXcewpOHTxAlo3beFL25Cr3T4qzURHruAezZuM1vtk=; b=VnTmKO5FpK6aesQFWfhdlUWaStP7HnMx6r1Xc+Z0eiOca2VUfzG2RoOX9j7F7H1kSA WNq0oYsAGCeVL+cdtFe/COUfOcslKBeMXXfQLnaZnl+FqAMh8YbheBkdeuPGOWO8NS3S ToDMSWI+0Ulb2TN5Zs/neSQ9j9qAj3tKB20m4C/jALMh7nn5AR7pqmHqOIHVHojdVBNd VhAwhN05so0JJn2ZEA630jNMTf1nVlp2RrNEAGPZV3OdVD/9rY/H5/5xAUudihzc9H8T MlIeH7RXYJTjgBxms5f3YV9JfHeCVxCIrSMUcNeYghHiRdkLxn4/D4rrQSYRqNxqnvbk jBSg== X-Gm-Message-State: AOJu0YzPPaQJHBf84Q9mZpubdPmeOAzalRSKXlwkcVd1kcKiDujSzDwz w7JADq+owjqTwsJpf1egGf4= X-Google-Smtp-Source: AGHT+IFuwuFkjIctVy6iKwdHNX+jM58AFDFZjui8Ng4miR2y3ritPq5VyouFh8B19iVWYkZI0QRSnQ== X-Received: by 2002:a05:6a00:1886:b0:68f:f38d:f76c with SMTP id x6-20020a056a00188600b0068ff38df76cmr21379390pfh.6.1696994784937; Tue, 10 Oct 2023 20:26:24 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id r5-20020aa78b85000000b00690bd3c0723sm9232477pfd.99.2023.10.10.20.26.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Oct 2023 20:26:24 -0700 (PDT) Message-ID: <006feb32-ab7f-4733-a308-35dbe4077854@gmail.com> Date: Tue, 10 Oct 2023 21:26:20 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [committed] [PR target/93062] RISC-V: Handle long conditional branches for RISC-V Content-Language: en-US To: Andrew Waterman , Jeff Law Cc: "gcc-patches@gcc.gnu.org" References: <001ae968-da60-4e3b-8909-d6b99980ea63@ventanamicro.com> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 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. jeff