From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12216 invoked by alias); 19 Mar 2010 12:23:56 -0000 Received: (qmail 12205 invoked by uid 22791); 19 Mar 2010 12:23:55 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_FAIL X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 19 Mar 2010 12:23:50 +0000 Received: from mail.gnu.org ([199.232.76.166]:48493 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NsbEz-0003rP-20 for gcc@gnu.org; Fri, 19 Mar 2010 08:23:49 -0400 Received: from eggs.gnu.org ([140.186.70.92]:50192) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NsbEy-0006Jk-Qi for gcc@gnu.org; Fri, 19 Mar 2010 08:23:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NsbEw-0000Mk-G0 for gcc@gnu.org; Fri, 19 Mar 2010 08:23:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26009) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NsbEw-0000MY-7I for gcc@gnu.org; Fri, 19 Mar 2010 08:23:46 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2JCNh1m022089 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 19 Mar 2010 08:23:43 -0400 Received: from fche.csb (vpn-234-246.phx2.redhat.com [10.3.234.246]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2JCNhJB001699; Fri, 19 Mar 2010 08:23:43 -0400 Received: by fche.csb (Postfix, from userid 2569) id A78AB5810B; Fri, 19 Mar 2010 08:23:42 -0400 (EDT) To: Jae Hyuk Kwak Cc: Michael Meissner , gcc@gnu.org Subject: Re: Hash Function for "switch statement" References: <8ac33cd71003141343g7ae78185s378fd52205e2deb1@mail.gmail.com> <20100317200410.GA13807@hungry-tiger.westford.ibm.com> <8ac33cd71003172222i3be31fbah209f49bd83dfa9b3@mail.gmail.com> <20100318151753.GA4065@hungry-tiger.westford.ibm.com> <8ac33cd71003181710k263f6a8do6abd49d80e5213f8@mail.gmail.com> From: fche@redhat.com (Frank Ch. Eigler) Date: Fri, 19 Mar 2010 12:26:00 -0000 In-Reply-To: <8ac33cd71003181710k263f6a8do6abd49d80e5213f8@mail.gmail.com> (Jae Hyuk Kwak's message of "Thu, 18 Mar 2010 17:10:18 -0700") Message-ID: User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2010-03/txt/msg00284.txt.bz2 Jae Hyuk Kwak writes: > [...] > Is that true that current implementation of gcc on i386 optimizes > switch statement with decision tree? > I was expecting somebody who can confirm this. You can see for yourself by writing a variety of switch{} statements and observing the assembly code (-fverbose-asm) and/or dump intermediate output (-d). To see more of the spectrum of possibilities, make tables large/small, sparse/clustered/dense, case blocks small/large/fallthrough, > I tried to find the specific implementation on the file, i386.c. > But it is very big file and I have only limited knowledge of gcc yet. > If you can point more specific implementation part, I may be able to > catch up what you meant. See gcc/stmt.c for starters. - FChE