On Mon, 2021-03-15 at 11:11 +0800, HAO CHEN GUI via Gcc-patches wrote: > Hi, > > This patch adds const_anchor for rs6000. The const_anchor is used > in cse pass. > > The attachment are the patch diff and change log file. > > Bootstrapped and tested on powerpc64le with no regressions. Is this > okay for trunk? Any recommendations? Thanks a lot.
Be sure to CC David and Segher to help ensure they see the arch specific patch. :-) > > * config/rs6000/rs6000.c (rs6000_option_override_internal): Set > targetm.const_anchor, targetm.min_anchor_offset > and targetm.max_anchor_offset. lgtm. > diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c > index ec068c58aa5..2b2350c53ae 100644 > --- a/gcc/config/rs6000/rs6000.c > +++ b/gcc/config/rs6000/rs6000.c > @@ -4911,6 +4911,13 @@ rs6000_option_override_internal (bool global_init_p) > warning (0, "%qs is deprecated and not recommended in any circumstances", > "-mno-speculate-indirect-jumps"); > > + if (TARGET_64BIT) > + { > + targetm.min_anchor_offset = -32768; > + targetm.max_anchor_offset = 32767; > + targetm.const_anchor = 0x8000; > + } > + The mix of decimal and hexadecimal notation catches my eye, but this matches the style I see for other architectures, mips in particular. Do we want/need to explicitly set the values for !TARGET_64BIT ? (I can't immediately tell what the default values are). lgtm. > return ret; > } >