From: Eric Botcazou Date: Wed, 12 Mar 2003 09:08:34 +0000 (+0100) Subject: re PR rtl-optimization/9888 (-mcpu=k6 -Os produces out of range loop instructions) X-Git-Tag: releases/gcc-3.2.3~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=523e9dd9baa6e2101990e176b485a76c645cec2b;p=thirdparty%2Fgcc.git re PR rtl-optimization/9888 (-mcpu=k6 -Os produces out of range loop instructions) PR optimization/9888 Backport patch from mainline: Tue Nov 19 23:50:56 CET 2002 Jan Hubicka * i386.md (length_immediate): Do not refer to insn address. (jcc*, jmp patterns): Compute length explicitly. (doloop_end_internal pattern): Unconditionally set the type to "ibr". From-SVN: r64229 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 114aff6c458f..972e5abb40a3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2003-03-12 Eric Botcazou + + PR optimization/9888 + Backport patch from mainline: + + Tue Nov 19 23:50:56 CET 2002 Jan Hubicka + + * i386.md (length_immediate): Do not refer to insn address. + (jcc*, jmp patterns): Compute length explicitly. + (doloop_end_internal pattern): Unconditionally set the type to "ibr". + 2003-03-12 Eric Botcazou PR optimization/9888 diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index a159fa536e0d..ed497f0b0e08 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -147,13 +147,10 @@ (if_then_else (match_operand 1 "constant_call_address_operand" "") (const_int 4) (const_int 0)) + ;; We don't know the size before shorten_branches. Expect + ;; the instruction to fit for better scheduling. (eq_attr "type" "ibr") - (if_then_else (and (ge (minus (match_dup 0) (pc)) - (const_int -128)) - (lt (minus (match_dup 0) (pc)) - (const_int 124))) - (const_int 1) - (const_int 4)) + (const_int 1) ] (symbol_ref "/* Update immediate_length and other attributes! */ abort(),1"))) @@ -12956,13 +12953,13 @@ "%+j%C1\t%l0" [(set_attr "type" "ibr") (set_attr "modrm" "0") - (set (attr "prefix_0f") + (set (attr "length") (if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -128)) (lt (minus (match_dup 0) (pc)) (const_int 124))) - (const_int 0) - (const_int 1)))]) + (const_int 2) + (const_int 6)))]) (define_insn "*jcc_2" [(set (pc) @@ -12974,13 +12971,13 @@ "%+j%c1\t%l0" [(set_attr "type" "ibr") (set_attr "modrm" "0") - (set (attr "prefix_0f") + (set (attr "length") (if_then_else (and (ge (minus (match_dup 0) (pc)) (const_int -128)) (lt (minus (match_dup 0) (pc)) (const_int 124))) - (const_int 0) - (const_int 1)))]) + (const_int 2) + (const_int 6)))]) ;; In general it is not safe to assume too much about CCmode registers, ;; so simplify-rtx stops when it sees a second one. Under certain @@ -13241,6 +13238,13 @@ "" "jmp\t%l0" [(set_attr "type" "ibr") + (set (attr "length") + (if_then_else (and (ge (minus (match_dup 0) (pc)) + (const_int -128)) + (lt (minus (match_dup 0) (pc)) + (const_int 124))) + (const_int 2) + (const_int 5))) (set_attr "modrm" "0")]) (define_expand "indirect_jump" @@ -13362,14 +13366,9 @@ (const_int 124)))) (const_int 2) (const_int 16))) - (set (attr "type") - (if_then_else (and (eq_attr "alternative" "0") - (and (ge (minus (match_dup 0) (pc)) - (const_int -128)) - (lt (minus (match_dup 0) (pc)) - (const_int 124)))) - (const_string "ibr") - (const_string "multi")))]) + ;; We don't know the type before shorten branches. Optimistically expect + ;; the loop instruction to match. + (set (attr "type") (const_string "ibr"))]) (define_split [(set (pc)