I did debug cc1, but was not able to figure out the exact issue. Thanks for the explanation. --------------------------------- Aniket Deole 9604503495 aniket.deole@xxxxxxxxx On Tue, Jun 4, 2013 at 9:22 PM, Chung-Ju Wu <jasonwucj@xxxxxxxxx> wrote: > 2013/6/4 Aniket Deole <aniket.deole@xxxxxxxxx>: >> Hello, >> >> We are building GCC for the Mips Simulator "SPIM". >> We have previously built the same for GCC 4.6.2, and are now trying to >> build it for 4.7.2. >> >> We are experiencing an issue related to the cbranchsi4 in GCC 4.7.2, >> machine description wherein, GCC is compiled correctly and cc1 is >> generated. But while compiling an external C program having >> conditional statements using cc1, the compilation goes in an infinite >> loop. >> >> We were able to rectify this infinite loop by removing an SI from the >> instruction for the first match operator clause. >> >> But we are not sure as to why this fix is required with respect to the >> different GCC versions 4.6.2 and 4.7.2. >> >> --------------------------------------------------------------- >> GCC 4.6.2 MD: >> -------------------------- >> (define_insn "cbranchsi4" >> [(set (pc) >> (if_then_else >> >> (match_operator:SI 0 "comparison_operator" >> >> [(match_operand:SI 1 "register_operand" "") >> (match_operand:SI 2 "register_operand" "")]) >> (label_ref (match_operand 3 "" "")) >> (pc)))] >> "" >> "* return conditional_insn(GET_CODE(operands[0]),operands,0); " >> ) >> -------------------------------------------------------------- >> GCC 4.7.2 MD: >> --------------------------- >> (define_insn "cbranchsi4" >> [(set (pc) >> (if_then_else >> >> (match_operator 0 "comparison_operator" >> >> [(match_operand:SI 1 "register_operand" "") >> (match_operand:SI 2 "register_operand" "")]) >> (label_ref (match_operand 3 "" "")) >> (pc)))] >> "" >> "* return conditional_insn(GET_CODE(operands[0]),operands,0); " >> ) >> >> Thank You, >> --------------------------------- >> Aniket Deole >> aniket.deole@xxxxxxxxx > > Hi, Aniket, > > It's hard tell why your cc1 went into infinite loop. > It requires tracing gcc code by yourself. > > However, refer to to GCC Internal, 10.10 Comparison Operations: > "If the comparison operation is being tested > (e.g., the first operand of an if_then_else), > the mode must be VOIDmode." > > IIUC, the mode of cbranch pattern is determined by > the compared operands, not comparison operator. > The comparison operator is supposed to be VOIDmode and many > optimization/simplification phases are based on such principle. > > So I would guess it was just lucky that you did not suffer > any compilation problems with your 4.6.2 MD design. > > > Best regards, > jasonwucj