------- Comment #13 from hubicka at gcc dot gnu dot org 2009-06-30 13:36 ------- Hmm, looking at the cases it seems that main reason for the win is the fact that idiv needs integer load instruction that has long immediate and we don't optimize these for -Os well.
I suppose for -Os following is wrong: case CONST_INT: case CONST: case LABEL_REF: case SYMBOL_REF: if (TARGET_64BIT && !x86_64_immediate_operand (x, VOIDmode)) *total = 3; else if (TARGET_64BIT && !x86_64_zext_immediate_operand (x, VOIDmode)) *total = 2; else if (flag_pic && SYMBOLIC_CONST (x) && (!TARGET_64BIT || (!GET_CODE (x) != LABEL_REF && (GET_CODE (x) != SYMBOL_REF || !SYMBOL_REF_LOCAL_P (x))))) *total = 1; else *total = 0; return true; It probably should return actual size of load instruction with full sized immediate and the individual cases matching RTL codes should know where instruction allows cheap immediate operand encoding and prevent recursion counting operand size itself. I will look into this but won't complain if someone beats me :)) Honza -- hubicka at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |hubicka at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2009-06-06 13:41:23 |2009-06-30 13:36:11 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30354