https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121124
Bug ID: 121124 Summary: TI PRU target doesn't seem to use constant table if address has bit31 set Product: gcc Version: 15.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: rqou at berkeley dot edu Target Milestone: --- When compiling for the TI PRU target, GCC doesn't seem to generate the expected SBCO opcode when the address in question has bit31 set. It seems to work correctly when bit31 is 0. GCC information: Using built-in specs. COLLECT_GCC=pru-gcc COLLECT_LTO_WRAPPER=/opt/pru/libexec/gcc/pru/15.1.0/lto-wrapper Target: pru Configured with: ../../gcc-15.1.0/configure --target=pru --prefix=/opt/pru --disable-nls --with-newlib --enable-languages=c,c++ --with-gmp=/opt/homebrew/Cellar/gmp/6.3.0 --with-mpfr=/opt/homebrew/Cellar/mpfr/4.2.1 --with-mpc=/opt/homebrew/Cellar/libmpc/1.3.1 Thread model: single Supported LTO compression algorithms: zlib gcc version 15.1.0 (GCC) Minimal test case: #pragma ctable_entry 30 0x00beef00 void good() { *(volatile unsigned int *)0x00beef00 = 0xdead; } #pragma ctable_entry 31 0x80beef00 void bad() { *(volatile unsigned int *)0x80beef00 = 0xf00d; } Compile using: pru-gcc -v -save-temps -Wextra -Wall -Os -c test.c Result: The function `good` uses SBCO as desired, whereas the function `bad` generates a less-efficient ldi32+SBBO.