From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19459 invoked by alias); 11 Apr 2005 19:40:20 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19369 invoked by uid 48); 11 Apr 2005 19:40:14 -0000 Date: Mon, 11 Apr 2005 19:40:00 -0000 Message-ID: <20050411194014.19368.qmail@sourceware.org> From: "sabre at nondot dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040717215713.16611.falk@debian.org> References: <20040717215713.16611.falk@debian.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug tree-optimization/16611] Terrible code generated for vector X-Bugzilla-Reason: CC X-SW-Source: 2005-04/txt/msg01430.txt.bz2 List-Id: ------- Additional Comments From sabre at nondot dot org 2005-04-11 19:40 ------- This code from stl_bvector.h is the problem: void _M_incr(ptrdiff_t __i) { difference_type __n = __i + _M_offset; _M_p += __n / _M_word_bit; __n = __n % _M_word_bit; if (__n < 0) { _M_offset = (unsigned int) __n + _M_word_bit; --_M_p; } else _M_offset = (unsigned int) __n; } Note that the division and mod is performed on a signed __n value. If it were unsigned, the optimizer could trivially turn it into shift/and ops. -Chris -- What |Removed |Added ---------------------------------------------------------------------------- CC| |sabre at nondot dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16611