From patchwork Thu Aug 29 22:02:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kenneth Zadeck X-Patchwork-Id: 270967 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id B39F42C007C for ; Fri, 30 Aug 2013 08:02:25 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=UV+XOtmwG3QOg0PuIXUebN3+NzUahD8tGAkGySx1pPjaat guZet4NxXdwR7GeDQGPxAn2eFbWP7T6h1aMFTyN7qCfkYB273lWcVLltpzDfZ13i BuRHCG6hPfI3SPO+Dt46s+zSsrxMS/WGLBGnujZvQw4w0kfhfeggW4MWKLpWI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=/+ddEU7HRIf47xTcvjFKBNeLp8U=; b=b3yO49E+Tcw+y+lIywGc 4LqBzlaUJdebxwm5U1Ut0s8TMRuLKWZH/o0zku+Us2M5lwqHlbx+2Zl4PmYFsLP6 e0TJT2tSS7n7Pe7v5ll5VDrk/QMF9Yv7pdLGRBkApkBqnZp/QMLUHCGg6rpfE5V0 wSTTlqMHJ+QO+zLnDaaTp8U= Received: (qmail 31455 invoked by alias); 29 Aug 2013 22:02:16 -0000 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 Received: (qmail 31422 invoked by uid 89); 29 Aug 2013 22:02:15 -0000 Received: from mail-oa0-f52.google.com (HELO mail-oa0-f52.google.com) (209.85.219.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 29 Aug 2013 22:02:15 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED, AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: mail-oa0-f52.google.com Received: by mail-oa0-f52.google.com with SMTP id f4so1378807oah.39 for ; Thu, 29 Aug 2013 15:02:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:content-type; bh=8KJuxom879wibgaHCJxFpOYGas0zxn0vKarWhdjJxrs=; b=duSmF64jS7CiuHy+lEvmn1HW+IEJFqT8UR1owJe80yf1efx7GMdazuX5V+R4snITZD c9GEJDUTI0Twb39uGDcr05SzsC6PzBOJALNt8WDnxwWcVCKoLmTzBj9RwbiWitqKv0+9 eslybMlouYQxAIEZornLBJ/eDWlxne9NQACfF0sHQH053jcv0Z+m5Ex3z2U3RfI8NCIt N5IjtAmmjrGhHA5HseSP0xykwhKBSKFNn2TDzeEoDkm0BS6f9ztaMyqZhTm4rPXDMSLH XRLlu+FPJ6BJT66Qt4ig8xgmTegigtjP5Jm7E6vF3aWtwAQ6Vs4CMy/2az6QFnTujOX0 lbuQ== X-Gm-Message-State: ALoCoQmqyNj16NmAFzKpxGQ6odKyUPYNUbEc7uyL6BGbPXJSDeRc9Uwog4uNm6KC8Ow10HStGWCY X-Received: by 10.182.129.201 with SMTP id ny9mr4313717obb.0.1377813733023; Thu, 29 Aug 2013 15:02:13 -0700 (PDT) Received: from moria.site (pool-98-113-157-218.nycmny.fios.verizon.net. [98.113.157.218]) by mx.google.com with ESMTPSA id s9sm30448651obu.4.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Aug 2013 15:02:12 -0700 (PDT) Message-ID: <521FC4E3.3080502@naturalbridge.com> Date: Thu, 29 Aug 2013 18:02:11 -0400 From: Kenneth Zadeck User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: gcc-patches , Richard Biener , Richard Sandiford , Mike Stump Subject: wide-int branch: fixed mips regression Fixed FAIL: gcc.dg/fixed-point/int-warning.c (test for warnings, line 12) on mips64-unknown-linux-gnu Index: gcc/tree.c =================================================================== --- gcc/tree.c (revision 202088) +++ gcc/tree.c (working copy) @@ -8531,11 +8531,11 @@ bool int_fits_type_p (const_tree c, const_tree type) { tree type_low_bound, type_high_bound; - bool ok_for_low_bound, ok_for_high_bound, unsc; + bool ok_for_low_bound, ok_for_high_bound; wide_int wc, wd; + signop sgn_c = TYPE_SIGN (TREE_TYPE (c)); wc = c; - unsc = TYPE_UNSIGNED (TREE_TYPE (c)); retry: type_low_bound = TYPE_MIN_VALUE (type); @@ -8555,17 +8555,17 @@ retry: if (type_low_bound && TREE_CODE (type_low_bound) == INTEGER_CST) { wd = type_low_bound; - if (unsc != TYPE_UNSIGNED (TREE_TYPE (type_low_bound))) + if (sgn_c != TYPE_SIGN (TREE_TYPE (type_low_bound))) { - int c_neg = (!unsc && wc.neg_p ()); - int t_neg = (unsc && wd.neg_p ()); + int c_neg = (sgn_c == SIGNED && wc.neg_p ()); + int t_neg = (sgn_c == UNSIGNED && wd.neg_p ()); if (c_neg && !t_neg) return false; if ((c_neg || !t_neg) && wc.ltu_p (wd)) return false; } - else if (wc.lt_p (wd, TYPE_SIGN (TREE_TYPE (type_low_bound)))) + else if (wc.lt_p (wd, sgn_c)) return false; ok_for_low_bound = true; } @@ -8576,17 +8576,17 @@ retry: if (type_high_bound && TREE_CODE (type_high_bound) == INTEGER_CST) { wd = type_high_bound; - if (unsc != TYPE_UNSIGNED (TREE_TYPE (type_high_bound))) + if (sgn_c != TYPE_SIGN (TREE_TYPE (type_high_bound))) { - int c_neg = (!unsc && wc.neg_p ()); - int t_neg = (unsc && wd.neg_p ()); + int c_neg = (sgn_c == SIGNED && wc.neg_p ()); + int t_neg = (sgn_c == UNSIGNED && wd.neg_p ()); if (t_neg && !c_neg) return false; if ((t_neg || !c_neg) && wc.gtu_p (wd)) return false; } - else if (wc.gt_p (wd, TYPE_SIGN (TREE_TYPE (type_high_bound)))) + else if (wc.gt_p (wd, sgn_c)) return false; ok_for_high_bound = true; } @@ -8600,7 +8600,7 @@ retry: /* Perform some generic filtering which may allow making a decision even if the bounds are not constant. First, negative integers never fit in unsigned types, */ - if (TYPE_UNSIGNED (type) && !unsc && wc.neg_p ()) + if (TYPE_UNSIGNED (type) && sgn_c == SIGNED && wc.neg_p ()) return false; /* Second, narrower types always fit in wider ones. */ @@ -8608,7 +8608,7 @@ retry: return true; /* Third, unsigned integers with top bit set never fit signed types. */ - if (! TYPE_UNSIGNED (type) && unsc && wc.neg_p ()) + if (!TYPE_UNSIGNED (type) && sgn_c == UNSIGNED && wc.neg_p ()) return false; /* If we haven't been able to decide at this point, there nothing more we Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c (revision 202088) +++ gcc/fold-const.c (working copy) @@ -1690,7 +1690,7 @@ fold_convert_const_int_from_fixed (tree /* Given a fixed-point constant, make new constant with new type, appropriately sign-extended or truncated. */ t = force_fit_type (type, wide_int::from_double_int (temp, - TYPE_PRECISION (type)), + HOST_BITS_PER_DOUBLE_INT), -1, (temp.is_negative () && (TYPE_UNSIGNED (type)