From patchwork Fri Jul 1 17:42:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 102940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 8A7BDB6F00 for ; Sat, 2 Jul 2011 03:42:31 +1000 (EST) Received: (qmail 3492 invoked by alias); 1 Jul 2011 17:42:28 -0000 Received: (qmail 3463 invoked by uid 22791); 1 Jul 2011 17:42:27 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jul 2011 17:42:13 +0000 Received: (qmail 13768 invoked from network); 1 Jul 2011 17:42:12 -0000 Received: from unknown (HELO ?84.152.209.23?) (bernds@127.0.0.2) by mail.codesourcery.com with ESMTPA; 1 Jul 2011 17:42:12 -0000 Message-ID: <4E0E06EC.3050709@codesourcery.com> Date: Fri, 01 Jul 2011 19:42:04 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110505 Lightning/1.0b3pre Thunderbird/3.1.10 MIME-Version: 1.0 To: GCC Patches Subject: [11/11] Fix get_mode_bounds References: <4E0E0310.60406@codesourcery.com> In-Reply-To: <4E0E0310.60406@codesourcery.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org get_mode_bounds should also use GET_MODE_PRECISION, but this exposes a problem on ia64 - BImode needs to be handled specially here to work around another preexisting special case in gen_int_mode. Bernd * stor-layout.c (get_mode_bounds): Use GET_MODE_PRECISION. Special case BImode. Index: gcc/stor-layout.c =================================================================== --- gcc/stor-layout.c.orig +++ gcc/stor-layout.c @@ -2439,11 +2439,26 @@ get_mode_bounds (enum machine_mode mode, enum machine_mode target_mode, rtx *mmin, rtx *mmax) { - unsigned size = GET_MODE_BITSIZE (mode); + unsigned size = GET_MODE_PRECISION (mode); unsigned HOST_WIDE_INT min_val, max_val; gcc_assert (size <= HOST_BITS_PER_WIDE_INT); + /* gen_int_mode performs an unwanted canonicalization for BImode. */ + if (mode == BImode) + { + if (sign) + { + *mmin = constm1_rtx; + *mmax = const0_rtx; + } + else + { + *mmin = const0_rtx; + *mmax = const1_rtx; + } + return; + } if (sign) { min_val = -((unsigned HOST_WIDE_INT) 1 << (size - 1));