Problems in pr26180.c with own backend

Georg-Johann Lay gjl@gcc.gnu.org
Wed Nov 14 23:15:00 GMT 2012


Andreas Geißler schrieb:
> Hi. I need your help again. I wrote my own backend for the gcc-4.6.2
> and with your help it works nearly perfectly.
> But i have a problem with the test case pr26180.c. The compiler does
> not load the register, which
> is used for the comparison. And i don't get why.
> 
> C-Code:
> ...
> x2 = (x > 0 ? x : (-x));
> ...
> 
> Wrong translated assembler code:
> ...

Assembler don't tell anything; look at TL dump with -da, -fdump-rtl-all 
or -fdump-rtl-all-details.

You might also want so set -dp and / or -dP and / or -fverbose-asm to 
see insns along with assembly.

> The translation works also correctly if i use "if else" instead of "?:".
> So i you would like to ask you, which pattern is related to "x2 = (x >
> 0 ? x : (-x));"

Who knows if not you? That depends on your backend: Maybe absXX2, maybe 
movXXcc, maybe jumping around and movXX and negXX2, ...

> or where i should search for this problem.

Look at .expand dump and track until where it gets wrong.  Presumably a 
wrong expander, wrong constraints (missing early clobber), wrong 
peephole, whatever.

Johann



More information about the Gcc-help mailing list