On Wed, Jan 10, 2018 at 02:55:07PM +0000, Segher Boessenkool wrote: > In various of our 32-bit load_toc patterns we take the difference of > two immediates (labels) as a term to something bigger; but this isn't > canonical RTL, it needs to be wrapped in CONST. > > This fixes it. Tested on powerpc64-linux {-m32,-m64}. Committing.
I backported this (and its followup tweak, adding ilp32 to the new testcase) to the GCC 7 branch. Segher > 2018-01-10 Segher Boessenkool <seg...@kernel.crashing.org> > > PR target/83629 > * config/rs6000/rs6000.md (load_toc_v4_PIC_2, load_toc_v4_PIC_3b, > load_toc_v4_PIC_3c): Wrap const term in CONST RTL. > > testsuite/ > PR target/83629 > * gcc.target/powerpc/pr83629.c: New testcase.