From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18269 invoked by alias); 30 Jun 2009 13:36:25 -0000 Received: (qmail 18215 invoked by uid 48); 30 Jun 2009 13:36:11 -0000 Date: Tue, 30 Jun 2009 13:36:00 -0000 Message-ID: <20090630133611.18214.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/30354] -Os doesn't optimize a/CONST even if it saves size. In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "hubicka at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg02220.txt.bz2 ------- 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