Eric Botcazou wrote: >> A comment before the SETs and a testcase would be nice. IIRC >> we do have stack size testcases via using -fstack-usage. > >Or -Wstack-usage, which might be more appropriate here.
Yes. good idea. I was not aware that we already have that kind of tests. When trying to write this test. I noticed, that I did not try -Os so far. But for -Os the stack is still the unchanged 3500 bytes. However for embedded targets I am often inclined to use -Os, and would certainly not expect the stack to explode... I see in arm.md there are places like /* If we're optimizing for size, we prefer the libgcc calls. */ if (optimize_function_for_size_p (cfun)) FAIL; /* Expand operation using core-registers. 'FAIL' would achieve the same thing, but this is a bit smarter. */ scratch1 = gen_reg_rtx (SImode); scratch2 = gen_reg_rtx (SImode); arm_emit_coreregs_64bit_shift (LSHIFTRT, operands[0], operands[1], operands[2], scratch1, scratch2); .. that explains why this happens. I think it would be better to use the emit_coreregs for shift count >= 32, because these are effectively 32-bit shifts. Will try if that can be improved, and come back with the results. Thanks Bernd.