https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102169
Carl Love <carll at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |carll at gcc dot gnu.org --- Comment #5 from Carl Love <carll at gcc dot gnu.org> --- With no optimization, GCC generates a three instruction sequence to store to the stack frame rather than using a single stw instruction. Adding this for informational purposes per Segher's request. The test program #include <stdio.h> #include <stdlib.h> int marker2 (int a) { return (1); } int main (int argc, char **argv, char **envp) { marker2 (43); return argc; } Generates the three instruction sequence in both the main and marker2 function. Just cutting and pasting the marker2 code for P9 and P10. On Power 9 carll@marlin:~$ gcc -g stfiwx-bug.c -o stfiwx-bug carll@marlin:~$ objdump -S -d stfiwx-bug > stfiwx-bug.dump carll@marlin:~$ which gcc /usr/bin/gcc carll@marlin:~$ gcc --version gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 int marker2 (int a) { return (1); } 7bc: f8 ff e1 fb std r31,-8(r1) 7c0: c1 ff 21 f8 stdu r1,-64(r1) 7c4: 78 0b 3f 7c mr r31,r1 7c8: 78 1b 69 7c mr r9,r3 7cc: 2c 00 3f 91 stw r9,44(r31) << here 7d0: 01 00 20 39 li r9,1 7d4: 78 4b 23 7d mr r3,r9 7d8: 40 00 3f 38 addi r1,r31,64 7dc: f8 ff e1 eb ld r31,-8(r1) 7e0: 20 00 80 4e blr on Power 10 carll@ltcd97-lp1:~$ gcc -g stfiwx-bug.c -o stfiwx-bug carll@ltcd97-lp1:~$ objdump -S -d stfiwx-bug > stfiwx-bug.dump carll@ltcd97-lp1:~$ which gcc /usr/bin/gcc carll@ltcd97-lp1:~$ gcc --version gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0 int marker2 (int a) { return (1); } 7bc: f8 ff e1 fb std r31,-8(r1) 7c0: c1 ff 21 f8 stdu r1,-64(r1) 7c4: 78 0b 3f 7c mr r31,r1 7c8: 78 1b 69 7c mr r9,r3 7cc: e6 01 09 7c mtfprwz f0,r9 << here 7d0: 2c 00 3f 39 addi r9,r31,44 << here 7d4: ae 4f 00 7c stfiwx f0,0,r9 << here 7d8: 01 00 20 39 li r9,1 7dc: 78 4b 23 7d mr r3,r9 7e0: 40 00 3f 38 addi r1,r31,64 7e4: f8 ff e1 eb ld r31,-8(r1) 7e8: 20 00 80 4e blr