Re: [committed] [PR target/93062] RISC-V: Handle long conditional branches for RISC-V

2023-10-11 Thread Andrew Waterman
On Tue, Oct 10, 2023 at 8:26 PM Jeff Law wrote: > > > > 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 d

Re: [committed] [PR target/93062] RISC-V: Handle long conditional branches for RISC-V

2023-10-10 Thread Jeff Law
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

Re: [committed] [PR target/93062] RISC-V: Handle long conditional branches for RISC-V

2023-10-10 Thread Andrew Waterman
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. Corrupting the RAS is potentially more costly than mispredicting a branch, since it can result in a cascading sequence of mispredictions a

[committed] [PR target/93062] RISC-V: Handle long conditional branches for RISC-V

2023-10-10 Thread Jeff Law
Ventana has had a variant of this patch from Andrew W. in its tree for at least a year. I'm dusting it off and submitting it on Andrew's behalf. There's multiple approaches we could be using here. First we could make $ra fixed and use it as the scratch register for the long branch sequence