[Bug middle-end/35509] [4.3/4.4 Regression] builtin isinf() mismatch to compile-time substitution
--- Comment #7 from dmixm at marine dot febras dot ru 2008-04-14 10:55 --- Possible the (isgreater(fabs(x), DBL_MAX) ? (signbit(x) ? -1 : 1) : 0) will be fast with common finite numbers? Question: in case of AVR target, is it possible to call extern isinf() function regardless of language dialect? Inline code is very undesirable with small memory. Thanks. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35509
[Bug target/35634] New: [avr] result of char promotion comes out of CHAR_MIN/MAX
/* The next program is aborted with avr-gcc 4.1.2, 4.2.3, 4.3.0: result of char promotion comes out of CHAR_MIN/MAX. Options: -W -Wall -Os Know to work: 3.3.6, 3.4.6 - good code 4.0.4 - correct, but not the best 4.1.2, 4.2.3, 4.3.0 - without optimization only */ #include limits.h void abort (void); void exit (int); void foo (int i) { static int n; if (i CHAR_MIN || i CHAR_MAX) abort (); if (++n 1000) exit (0); } int main () { char c; for (c = 0; ; c++) foo (c); } -- Summary: [avr] result of char promotion comes out of CHAR_MIN/MAX Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dmixm at marine dot febras dot ru http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35634
[Bug target/35506] New: [avr] 4.3.0 buid error: illegal opcode movw for mcu avr3
The building for AVR target is aborted at compilation libgcc stage with error: Illegal opcode movw for mcu avr3. The lastest official release of binutils is used: 2.18. The reason of error is an attempt to assemble MOVW command for avr3 architecture which permits only classic instruction set historically. The workaround is to add '-mall-opcodes' avr-as option for this case. Replace into 'config/avr/avr.h' the string: #define ASM_SPEC %{mmcu=avr25:-mmcu=avr2; mmcu=avr35:-mmcu=avr3; mmcu=avr31:-mmcu=avr3;mmcu=avr51:-mmcu=avr5;mmcu=*:-mmcu=%*} to: #define ASM_SPEC %{mmcu=avr25:-mmcu=avr2; mmcu=avr35:-mmcu=avr3 -mall-opcodes; mmcu=avr31:-mmcu=avr3;mmcu=avr51:-mmcu=avr5;mmcu=*:-mmcu=%*} After this edition the build and installation are fine. -- Summary: [avr] 4.3.0 buid error: illegal opcode movw for mcu avr3 Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dmixm at marine dot febras dot ru http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35506
[Bug target/35507] New: [avr] 4.3.0: size of small funcion increases from 2 to 29 words
For funcion: long mult (long x, long y) { return x * y; } the avr-gcc 4.3.0 produces 29 words of code (-Os option): mult: push r14 push r15 push r16 push r17 /* prologue: function */ /* frame size = 0 */ mov r14,r18 mov r15,r19 mov r16,r20 mov r17,r21 mov r18,r22 mov r19,r23 mov r20,r24 mov r21,r25 mov r25,r17 mov r24,r16 mov r23,r15 mov r22,r14 rcall __mulsi3 mov r18,r22 mov r19,r23 mov r20,r24 mov r21,r25 mov r23,r19 mov r24,r20 mov r25,r21 /* epilogue start */ pop r17 pop r16 pop r15 pop r14 ret The result of avr-gcc 4.1.2 is 2 words: mult: /* prologue: frame size=0 */ /* prologue end (size=0) */ rcall __mulsi3 /* epilogue: frame size=0 */ ret -- Summary: [avr] 4.3.0: size of small funcion increases from 2 to 29 words Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dmixm at marine dot febras dot ru http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35507
[Bug target/35508] New: [avr] 4.3.0: undefined reference to `__ffshi2'
The next program is not linked (-Os option): int ffs (int); int main (int argc, char *argv[]) { (void)argv; return ffs (argc); } with undefined link to '__ffshi2'. The used libc library (Avr-libc project) contains the ffs() funcion. -- Summary: [avr] 4.3.0: undefined reference to `__ffshi2' Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dmixm at marine dot febras dot ru http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35508
[Bug target/35509] New: [avr] 4.3.0: builtin isinf() mismatch to compile-time substitution
The next program is aborted in execution (avr-gcc 4.3.0, -Os): int isinf (double); void abort (void); volatile double x = -1.0/0.0; int main () { if (isinf (x) != isinf (-__builtin_inf ())) abort (); return 0; } The second comparison argument is evaluated at compile time: -1 value is substituted. This is traditional result for isinf(-Inf). The first call of isinf() is replaced to inline code, which evaluates the -Inf to +1 value. The early avr-gcc versions are fine: the extern isinf() function was called. -- Summary: [avr] 4.3.0: builtin isinf() mismatch to compile-time substitution Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dmixm at marine dot febras dot ru http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35509
[Bug target/11180] [avr-gcc] Optimization decrease performance of struct assignment.
--- Comment #14 from dmixm at marine dot febras dot ru 2007-09-16 03:22 --- It was: (define_insn movdi [(set (match_operand:DI 0 nonimmediate_operand ) (match_operand:DI 1 general_operand ))] #) (define_split [(set (match_operand:DI 0 nonimmediate_operand ) (match_operand:DI 1 general_operand ))] reload_completed [(set (match_dup 2) (match_dup 4)) (set (match_dup 3) (match_dup 5))] { operands[2] = simplify_gen_subreg (SImode, operands[0], DImode, 0); operands[3] = simplify_gen_subreg (SImode, operands[0], DImode, 4); operands[4] = simplify_gen_subreg (SImode, operands[1], DImode, 0); operands[5] = simplify_gen_subreg (SImode, operands[1], DImode, 4); }) Alas, this elementary addition has appeared erroneous. The following program leads to emergency end of compilation: int main () { volatile long long x = 0x0102030405060708LL; if (x != 0x0102030405060708LL) exit (__LINE__); exit (0); } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11180
[Bug target/11180] [avr-gcc] Optimization decrease performance of struct assignment.
--- Comment #12 from dmixm at marine dot febras dot ru 2007-09-09 21:59 --- Andy Hutchinson wrote (comment #6) that addition a 'movdi' instruction improves the result. I have try to add a very simple 'movdi' (which split into 2 SImode instuctions). In result: -O0 -- 85 words, -O1,2,3,s -- 50 words. Version is 4.2.1 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11180
[Bug target/11180] [avr-gcc] Optimization decrease performance of struct assignment.
--- Comment #10 from dmixm at marine dot febras dot ru 2007-07-27 01:24 --- Yes, results are: avr-gcc-3.3.6: O0 -- 75, O1,O2,O3,Os -- 79 avr-gcc-4.2.1: O0 -- 109, O1,O2,O3,Os -- 79 The mistake is corrected? It is possible to tell and so as now application of keys of optimization shortens a code. However, correction does not improve quality of optimization, it only worsens not optimized code. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11180
[Bug target/30289] New: avr-gcc: builtin memset(): wrong code
Thanks to Tom [EMAIL PROTECTED]. Program: void * memset (void *buf, int val, unsigned int n); void foo (void) { memset ((char *)0x4000, 0, 0x4000); } is compiled into wrong code, where pointer and counter use 1 register pair: ldi r30,lo8(16384) ldi r31,hi8(16384) st Z+,__zero_reg__ sbiw r30,1 brne .-6 Compiler: 4.1.1 Options: -W -Wall -Os -S I have try a set of versions: avr-gcc 3.3.5 - OK, loop counter is separate register pair avr-gcc 3.4.4, 4.0.2, 4.1.1 - wrong code. Possible, the reason is in absence of '' in clobber statement 'avr.md': ... (use (match_operand:HI 1 register_operand !w,d)) (use (match_operand:HI 2 const_int_operand n,n)) (clobber (match_scratch:HI 3 =0,0)) (clobber (match_scratch:HI 4 =1,1))] ... -- Summary: avr-gcc: builtin memset(): wrong code Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dmixm at marine dot febras dot ru http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30289
[Bug target/30243] New: avr-gcc 4.1.1: signbit() causes an internal compiler error
avr-gcc (GCC) 4.1.1 Compilation of next program (-W -Wall -Os -S): extern int signbit (double); int foo (double x) { return signbit (x); } causes an compilation abort with message: internal compiler error: in gen_lowpart_general, at rtlhooks.c:51 Older versions are work: 3.3.5, 3.4.4 - call of external signbit() function 4.0.2- inline-code -- Summary: avr-gcc 4.1.1: signbit() causes an internal compiler error Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dmixm at marine dot febras dot ru http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30243
[Bug target/19684] New: avr-gcc 4.0 (and 3.3.4): wrong size in asm comment
Comment about function `foo' size: 27/* function foo size 10 (9) */ show wrong value. (Compare it with next function.) Compiler: avr-gcc (GCC) 4.0.0 20050109 (experimental) Options: -W -Wall -Os -Wa,-ahl The same error (for `foo') in 3.3.4 . Certainly, it is nonsense. But, maybe, this display of more serious mistake? Program: int foo (int x) { int i; for (i= 10; i; i--) x *= 2; return x; } int foo_with_true_size (int x) { x += 100; do { x *= 2; } while (x 0); return x; } Listing: GAS LISTING /tmp/ccJGSrye.s page 1 1.file foo.c 2.arch avr2 3__SREG__ = 0x3f 4__SP_H__ = 0x3e 5__SP_L__ = 0x3d 6__tmp_reg__ = 0 7__zero_reg__ = 1 8.global __do_copy_data 9.global __do_clear_bss 10.text 11.global foo 12.type foo, @function 13foo: 14/* prologue: frame size=0 */ 15/* prologue end (size=0) */ 16 2AE0 ldi r18,lo8(10) 17 0002 30E0 ldi r19,hi8(10) 18.L2: 19 0004 880F add r24,r24 20 0006 991F adc r25,r25 21 0008 2150 subi r18,lo8(-(-1)) 22 000a 3040 sbci r19,hi8(-(-1)) 23 000c D9F7 brne .L2 24/* epilogue: frame size=0 */ 25 000e 0895 ret 26/* epilogue end (size=1) */ 27/* function foo size 10 (9) */ 28.size foo, .-foo 29.global foo_with_true_size 30.type foo_with_true_size, @function 31foo_with_true_size: 32/* prologue: frame size=0 */ 33/* prologue end (size=0) */ 34 0010 8C59 subi r24,lo8(-(100)) 35 0012 9F4F sbci r25,hi8(-(100)) 36.L8: 37 0014 880F add r24,r24 38 0016 991F adc r25,r25 39 0018 1816 cp __zero_reg__,r24 40 001a 1906 cpc __zero_reg__,r25 41 001c DCF3 brlt .L8 42/* epilogue: frame size=0 */ 43 001e 0895 ret 44/* epilogue end (size=1) */ 45/* function foo_with_true_size size 8 (7) */ 46.size foo_with_true_size, .-foo_with_true_size 47/* File foo.c: code 18 = 0x0012 ( 16), prologues 0, epilogues 2 */ -- Summary: avr-gcc 4.0 (and 3.3.4): wrong size in asm comment Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dmixm at marine dot febras dot ru CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19684
[Bug target/19686] New: avr-gcc 4.0: loop performance decrease (extra conversion)
Program: int foo (int x) { int i= x; do { x *= 2; } while (--i); return x; } avr-gcc 4.0 (20050116) with `-Os' option: foo: /* prologue: frame size=0 */ /* prologue end (size=0) */ ldi r18,lo8(0) ldi r19,hi8(0) clr r20 clr r21 sub r20,r24 sbc r21,r25 .L2: add r24,r24 adc r25,r25 subi r18,lo8(-(-1)) sbci r19,hi8(-(-1)) cp r18,r20 cpc r19,r21 brne .L2 /* epilogue: frame size=0 */ ret avr-gcc 3.3.4: foo: /* prologue: frame size=0 */ /* prologue end (size=0) */ mov r18,r24 mov r19,r25 .L2: add r24,r24 adc r25,r25 subi r18,lo8(-(-1)) sbci r19,hi8(-(-1)) brne .L2 /* epilogue: frame size=0 */ ret -- Summary: avr-gcc 4.0: loop performance decrease (extra conversion) Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dmixm at marine dot febras dot ru CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19686
[Bug rtl-optimization/19597] New: avr-gcc 4.0, multiplication by constant, very long code
avr-gcc 4.0 (20050116) replaces multiplication by a constant to a combination of more simple operations. Thus it does not pay attention to efficiency of such replacement. For example: int foo (int x) { return 24011 * x; } produce 49 words (-mmcu=atmega8 -Os). Older GCC branches -- only 11 words in this case. -- Summary: avr-gcc 4.0, multiplication by constant, very long code Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dmixm at marine dot febras dot ru CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19597
[Bug middle-end/18424] 3.4.3 ~6x+ performance regression vs 3.3.1, constant trees not being computed.
--- Additional Comments From dmixm at marine dot febras dot ru 2004-11-16 23:58 --- In March, 2004 Richard Sandiford has offered a patch for elimination of this problem. See: http://gcc.gnu.org/ml/gcc/2004-03/msg01456.html This patch modifies function do_jump (a file dojump.c). This change now is present at a branch 4.0, but does not enter in 3.4.x. I have tried to apply this patch to 3.4.3. It has earned only after change of a line if (TREE_CODE (TREE_OPERAND (exp, 0)) == RSHIFT_EXPR ... to tree arg_nops = TREE_OPERAND (exp, 0); /* and below the same subst. */ STRIP_NOPS (arg_nops); if (TREE_CODE (arg_nops) == RSHIFT_EXPR ... and only for function foo_i. foo_i() before patch: ... mov r24,r25 ldi r25,6 1: lsr r24 dec r25 brne 1b sbrs r24,0 rjmp .L2 foo_i() after patch: ... sbrs r25,6 rjmp .L8 But foo_ll (shift loop with count 62!) and foo_l have remained on old - through shift of the left argument. Source file: ~~~ int foo_ll (long long x) { return (x 0x4000LL) ? 1 : 3; } int foo_l (long x) { return (x 0x4000) ? 5 : 7; } int foo_i (int x) { return (x 0x4000) ? 9 : 11; } int foo_c (char x) { return (x 0x40) ? 13 : 15; } P.S. The code for foo_c was and remains beautiful due to work `gcc/combine.c' . -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18424