From patchwork Mon Aug 7 22:33:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 798941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-459994-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="cZ3NBxxW"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xRC4J0kPTz9s76 for ; Tue, 8 Aug 2017 08:33:49 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=yK1ZBcWJw3FneO3+X +Jhtqo5WnjvVDGuzP8K+iAjCJj1Ulk9NmG2P4dfl92O85GnmZobaygGCcqKUaeRa A4ajUNNm1CBykEMbFlaZqhGEILTLqkvprby0YvzvT4/TGjlmmj1FOmpkPygTYZSo W7ozKTo7ZZFyqIPMnTTUGrKqXQ= 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:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=NEXuYKV0YYj5JBntpWpucr1 gIaQ=; b=cZ3NBxxWeQqbPIQHEhZKQGgURqgI4099XaPy2uVCNJ1KHjVbqeqsjOf EdzFxpWcPmvXDcXEiW8ZbFoFJM+ZpWcTBOEyNVOSHuAkcT6MOSbhCRV54rYmu8Nq CaeePlMDyJh4LK4iMU8OXS8DqXHn3V5kJ+F+/G28Omzq6YVLUmCs= Received: (qmail 80529 invoked by alias); 7 Aug 2017 22:33:42 -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 80511 invoked by uid 89); 7 Aug 2017 22:33:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=*exactly* X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 Aug 2017 22:33:36 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id v77MXX82004083; Mon, 7 Aug 2017 17:33:34 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id v77MXXuq004082; Mon, 7 Aug 2017 17:33:33 -0500 Date: Mon, 7 Aug 2017 17:33:33 -0500 From: Segher Boessenkool To: Jeff Law Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH 1/2] simplify-rtx: The truncation of an IOR can have all bits set (PR81423) Message-ID: <20170807223333.GJ13471@gate.crashing.org> References: <0926f163a7f91c101e34cff5cf7926506d208517.1500380707.git.segher@kernel.crashing.org> <20170724085051.GT13471@gate.crashing.org> <20170725112549.GE13471@gate.crashing.org> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170725112549.GE13471@gate.crashing.org> User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes On Tue, Jul 25, 2017 at 06:25:49AM -0500, Segher Boessenkool wrote: > On Mon, Jul 24, 2017 at 04:06:39PM -0600, Jeff Law wrote: > > > 2017-07-24 Segher Boessenkool > > > > > > gcc/testsuite/ > > > PR rtl-optimization/81423 > > > * gcc.c-torture/execute/pr81423.c: New testcase. > > I think int32plus just indicates ints are at least 32 bits. But a long > > or long long could still be just 32 bits. so int32plus && long_neq_int, > > to ensure that long/long long are 64 bits? > > Well, long long is required to be 64 bits or more by the C standard. > But some GCC targets do not follow that, with certain options at least. > > It looks like that test actually requires long long to be *exactly* > 64 bits. I'll modify the test to test for that. So I came up with the following. Is this okay for trunk? (Tested on powerpc64-linux and x86_64-linux, both with both -m32 and -m64, and tested it does fail on x86 without the patches to fix the bug). Segher diff --git a/gcc/testsuite/gcc.c-torture/execute/pr81423.c b/gcc/testsuite/gcc.c-torture/execute/pr81423.c new file mode 100644 index 0000000..731aa8f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr81423.c @@ -0,0 +1,36 @@ +extern void abort (void); + +unsigned long long int ll = 0; +unsigned long long int ull1 = 1ULL; +unsigned long long int ull2 = 12008284144813806346ULL; +unsigned long long int ull3; + +unsigned long long int __attribute__ ((noinline)) +foo (void) +{ + ll = -5597998501375493990LL; + + ll = (5677365550390624949L - ll) - (ull1 > 0); + unsigned long long int ull3; + ull3 = (unsigned int) + (2067854353L << + (((ll + -2129105131L) ^ 10280750144413668236ULL) - + 10280750143997242009ULL)) >> ((2873442921854271231ULL | ull2) + - 12098357307243495419ULL); + + return ull3; +} + +int +main (void) +{ + /* We need a long long of exactly 64 bits for this test. */ + ll--; + if (ll != 0xffffffffffffffffULL) + return 0; + + ull3 = foo (); + if (ull3 != 3998784) + abort (); + return 0; +}