Hello all,

I am involved in the porting of GCC 4.1.2 for a 16 bit target. The
target doenst have any SImode comparisons. Most of the time SImode
comparisons are synthesized using HImode comparisons. But some in some
instances SImode patterns are generated like that, where the code is
expanded in the pattern template. During the regression i got a ICE
related to SImode comparisons, more specifically in
unroll_and_peel_loops().

In unroll_loop_runtime_iterations called from unroll_and_peel_loops ()
the following piece of code

"
  for (i = 0; i < n_peel; i++)
    {
      /* Peel the copy.  */
      sbitmap_zero (wont_exit);
      if (i != n_peel - 1 || !last_may_exit)
        SET_BIT (wont_exit, 1);
      ok = duplicate_loop_to_header_edge (loop, loop_preheader_edge (loop),
                                          loops, 1,
                                          wont_exit, desc->out_edge,
                                          remove_edges, &n_remove_edges,
                                          DLTHE_FLAG_UPDATE_FREQ);
      gcc_assert (ok);

      /* Create item for switch.  */
      j = n_peel - i - (extra_zero_check ? 0 : 1);
      p = REG_BR_PROB_BASE / (i + 2);

      preheader = loop_split_edge_with (loop_preheader_edge (loop), NULL_RTX);
      branch_code = compare_and_jump_seq (copy_rtx (niter), GEN_INT (j), EQ,
                                          block_label (preheader), p,
                                          NULL_RTX);

      swtch = loop_split_edge_with (single_pred_edge (swtch), branch_code);
      set_immediate_dominator (CDI_DOMINATORS, preheader, swtch);
      single_pred_edge (swtch)->probability = REG_BR_PROB_BASE - p;
      e = make_edge (swtch, preheader,
                     single_succ_edge (swtch)->flags & EDGE_IRREDUCIBLE_LOOP);
      e->probability = p;
    }

"

generated SImode comparisons from 'compare_and_jump_seq()'. This
SImode comparisons are synthesized using HImode comparisons. This
results is the generation of two jump instructions and the ICE is
because both jump instructions end up in the same basic block.

>From  bug.c.21.loop2_unroll
"
;; Start of basic block 26, registers live: (nil)
(note 248 174 245 26 [bb 26] NOTE_INSN_BASIC_BLOCK)

(jump_insn 245 248 246 26 (set (pc)
        (if_then_else (ne:CC (subreg:HI (reg:SI 113) 0)
                (const_int 0 [0x0]))
            (label_ref 247)
            (pc))) -1 (nil)
    (nil))

(jump_insn 246 245 247 26 (set (pc)
        (if_then_else (eq:CC (subreg:HI (reg:SI 113) 2)
                (const_int 0 [0x0]))
            (label_ref 244)
            (pc))) -1 (nil)
    (nil))

(code_label 247 246 224 26 18 "" [0 uses])
;; End of basic block 26, registers live:
 (nil)
"

Note that if i compile a code which has SImode EQ comparisons the
basic blocks and code is generated properly. Right now i am stuck in
debugging.
Could anybody please provide me with any pointers?

Regards,
Shafi

Reply via email to