------- Comment #2 from pinskia at gcc dot gnu dot org 2008-11-23 18:55 ------- This happens on i386-darwin also (-m64 -O2 -fomit-frame-pointer): movl %edi, %edx testb %dil, %dil movl $-1, %eax notl %edx cmovne %edx, %eax
Using the following source: unsigned char negate(unsigned char val) { if (val) val = ~val; else val = ~val; return val; } We should be able to just do ~val but this comes down to hoisting before applying VRP/DOM. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 GCC build triplet|i386-linux-gnu | GCC host triplet|i386-linux-gnu | GCC target triplet|avr-*-* | Last reconfirmed|0000-00-00 00:00:00 |2008-11-23 18:55:59 date| | Summary|[avr] branch optimisation |branch optimisation |generates worse code |generates worse code http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38209