Noticed that gcc/g++ generate a branching sequence instead of straight-line code
for expressions of the form ABS(x-y). Changing the operator to something else
(+, *, /) resutls in straight-line code.
#define ABS(value) ( (value)>=0 ? (value) : -(value) )
int i,j,k,l,m,n;
void f1()
{
l = ABS(m+n);
i = ABS(j-k);
}
--
Summary: Branching sequence generated for ABS(x-y)
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pthaugen at us dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc*-*-*
GCC host triplet: powerpc*-*-*
GCC target triplet: powerpc*-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20470