[Bug middle-end/86680] possible gcc optimization

2018-11-29 Thread florian.laroche at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86680 --- Comment #11 from Florian La Roche --- Below my current code that disables optimization for this one function and thus generates ok code length. best regards, Florian La Roche #if __GNUC__ > 4 #define __gcc_no_ivopts __attribute__ ((opt

[Bug middle-end/86680] possible gcc optimization

2018-07-27 Thread florian.laroche at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86680 --- Comment #10 from Florian La Roche --- In my optionion the result of "end = (__bss_end - __bss_start) * sizeof (unsigned long)" in my last testcase should show that the compile should be able to optimize the test code of the original submitte

[Bug middle-end/86680] possible gcc optimization

2018-07-27 Thread florian.laroche at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86680 --- Comment #9 from Florian La Roche --- Puh, even introduced an error here. This one works, but is getting complex compared to the original code: extern unsigned long __bss_start[]; extern unsigned long __bss_end[]; void clear_bss(void) {

[Bug middle-end/86680] possible gcc optimization

2018-07-27 Thread florian.laroche at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86680 --- Comment #8 from Florian La Roche --- I've found something the compiler optimized quite nicely: (Good for the compiler, but I'd be happy to stay with the original code that was much easier to read for humans.) extern unsigned long __bss_sta

[Bug middle-end/86680] possible gcc optimization

2018-07-27 Thread florian.laroche at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86680 --- Comment #7 from Florian La Roche --- Hello Andrew Pinski, shouldn't the compiler see that both must be aligned to 8 bytes and thus also their difference must be a multiple of 8 bytes? I haven't looked into gcc sources, but maybe this inform

[Bug c/86680] possible gcc optimization

2018-07-26 Thread florian.laroche at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86680 --- Comment #4 from Florian La Roche --- Right, compiling with "-O2 -fno-ivopts" resolves my issues. best regards, Florian La Roche

[Bug c/86680] possible gcc optimization

2018-07-26 Thread florian.laroche at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86680 --- Comment #3 from Florian La Roche --- Hello Martin, I assume the two functions clear_bss1() and clear_bss2() to work on identical aligned data and produce similar assembler output. Yet looking at the assembler output, the first function produ

[Bug c/86680] New: possible gcc optimization

2018-07-26 Thread florian.laroche at googlemail dot com
: unassigned at gcc dot gnu.org Reporter: florian.laroche at googlemail dot com Target Milestone: --- Created attachment 4 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=4&action=edit testcase I can see this on x86_64 and aarch64. The first function is compiled wi