On 12/14/23 9:57 PM, Peter Bergner wrote: > On 7/16/23 10:40 PM, P Jeevitha via Gcc-patches wrote: >> + /* For non PC-relative code, GPR2 is unavailable for register allocation. >> */ >> + if (FIXED_R2 && !rs6000_pcrel_p ()) >> + fixed_regs[2] = 1; [snip] > On a related note, Jeevitha's patch above allows using r2 for normal register > allocation if r2 is not fixed and pcrel is enabled. Given pcrel with this > patch > enables pcrel on ELFv1, that means this patch can also enable using r2 for > normal > register allocation on ELFv1.
Nevermind, I'm daft and r2 usage is not allowed on ELFv1. The rs6000_pcrel_p() call above is always false for non ELFv2 compiles, so we'll mark r2 as fixed for ELFv1. Move along, nothing to see. :-) That said, I think we need a "dg-require-effective-target powerpc_elfv2" for the first test case where we're checking that we do use r2 for normal RA. That'll only be true on ELFv2 compiles, hence the need for the extra target requirement. I've asked Jeevitha to add that to the pr111045-1.c test case and verify it fixes the failure of that test case on her BE run. Peter