http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54418
--- Comment #2 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-08-30 22:18:34 UTC --- Unfortunately I was not able to reproduce this case without the -fopenmp option, and that option requires threads, which are not available on the sh-sim config I've got here for testing. Kaz, could you please try out the following? Index: gcc/config/sh/sh.md =================================================================== --- gcc/config/sh/sh.md (revision 190781) +++ gcc/config/sh/sh.md (working copy) @@ -1043,13 +1043,19 @@ ;; SImode unsigned integer comparisons ;; ------------------------------------------------------------------------- +;; Usually comparisons of 'unsigned int >= 0' are optimized away completely. +;; However, especially when optimizations are off (e.g. -O0) such comparisons +;; might remain and we have to handle them. If the '>= 0' case wasn't +;; handled here, something else would just load a '0' into the second operand +;; and do the comparison. We can do slightly better by just setting the +;; T bit to '1'. (define_insn_and_split "cmpgeusi_t" [(set (reg:SI T_REG) (geu:SI (match_operand:SI 0 "arith_reg_operand" "r") - (match_operand:SI 1 "arith_reg_or_0_operand" "rN")))] + (match_operand:SI 1 "arith_reg_or_0_operand" "r")))] "TARGET_SH1" "cmp/hs %1,%0" - "&& satisfies_constraint_Z (operands[0])" + "&& satisfies_constraint_Z (operands[1])" [(set (reg:SI T_REG) (const_int 1))] "" [(set_attr "type" "mt_group")]) Just in case, I'll also test this as usually on sh-sim.