Interesting that the GCC testsuite didn't catch this. Maybe we should add a testcase.
-Pete On Fri, May 25, 2012 at 12:02 PM, Olof Kindgren <[email protected]> wrote: > > > 2012/5/25 Stefan Kristiansson <[email protected]> >> >> compiling code like: >> >> int foo(int a, int b) >> { >> if (a > b) >> return a; >> else >> return b; >> } >> >> with: >> >> or1k-elf-gcc -O2 -mcmov -c -S cmov.c -o - >> >> caused an internal compiler error >> due to the fact that or1k_compare_op0 and or1k_compare_op1 >> never get assigned with anything >> --- >> >> Note! >> I'm not at all confident about this... >> Feedback or better suggestions are appreciated. >> >> --- >> gcc/config/or1k/or1k.c | 11 ++++++----- >> 1 file changed, 6 insertions(+), 5 deletions(-) >> >> diff --git a/gcc/config/or1k/or1k.c b/gcc/config/or1k/or1k.c >> index 16238fe..2a6bb96 100644 >> --- a/gcc/config/or1k/or1k.c >> +++ b/gcc/config/or1k/or1k.c >> @@ -381,18 +381,19 @@ or1k_emit_int_cmove (rtx dest, >> rtx false_cond) >> { >> rtx condition_rtx, cr; >> + rtx op0 = XEXP (op, 0); >> + rtx op1 = XEXP (op, 1); >> >> - if ((GET_MODE (or1k_compare_op0) != SImode) && >> - (GET_MODE (or1k_compare_op0) != HImode) && >> - (GET_MODE (or1k_compare_op0) != QImode)) >> + if ((GET_MODE (op0) != SImode) && >> + (GET_MODE (op0) != HImode) && >> + (GET_MODE (op0) != QImode)) >> { >> return 0; >> } >> >> /* We still have to do the compare, because cmov doesn't do a compare, >> it >> just looks at the FLAG bit set by a previous compare instruction. */ >> - condition_rtx = or1k_expand_compare (GET_CODE (op), >> - or1k_compare_op0, >> or1k_compare_op1); >> + condition_rtx = or1k_expand_compare (GET_CODE (op), op0, op1); >> >> cr = XEXP (condition_rtx, 0); >> >> -- >> 1.7.9.5 >> >> _______________________________________________ >> Openrisc mailing list >> [email protected] >> http://lists.opencores.org/listinfo/openrisc > > > Hmm... is this related to good ol' bug bug 27? Would be interesting to see > if your changes affect that one too. > > -- > Olof Kindgren > ______________________________________________ > ORSoC > Website: www.orsoc.se > Email: [email protected] > ______________________________________________ > FPGA, ASIC, DSP - embedded SoC design _______________________________________________ OpenRISC mailing list [email protected] http://lists.openrisc.net/listinfo/openrisc
