From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailrelay4-1.pub.mailoutpod1-cph3.one.com (mailrelay4-1.pub.mailoutpod1-cph3.one.com [46.30.210.185]) by sourceware.org (Postfix) with ESMTPS id 33B633858D35 for ; Fri, 7 Aug 2020 21:58:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 33B633858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=amylaar.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=gnu@amylaar.uk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amylaar.uk; s=20191106; h=content-transfer-encoding:content-type:in-reply-to:references:subject:cc:to: mime-version:from:date:message-id:from; bh=G1kjR99jWSfoSFH1vMqQgZqAK3DVOt54/Hh4zfHXMeo=; b=No765aqy/XaOWJr18Cav2tfNGbBkwlMgYPnFw9flpNB7hXnKnq5q5xSM+wm2YvtK+IW1EhKyJ44A6 QVwI71q1MiZ6DIEqnf+HvavELdmJRtUBJielB9PA02tC4G/nMVgG18/xkdc5nGGr3TjFx1VLcmOZSP DyUUOb7i643cyRH+LKmki8qcST3O+E2iJizyTUjgGVqtZRvl234CiHYz/gK/i86mFCtQO9LWDIgPeY OQLa8pI6+xn98zP3iPEbMEWi9bTqXupdTEzeB2xWVwH4D4HtNhpiMrWBcv3Io+sJK5HADTtfc1jqZk Z8RWPfhuoj4SQe62OXpnNSHoHbD+/Mw== X-HalOne-Cookie: cc41f4c1a1b9596f23c89244990c929766a94ab1 X-HalOne-ID: 291e009d-d8f9-11ea-9b1e-d0431ea8bb10 Received: from [192.168.1.129] (cust213-dsl91-135-11.idnet.net [91.135.11.213]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 291e009d-d8f9-11ea-9b1e-d0431ea8bb10; Fri, 07 Aug 2020 21:58:44 +0000 (UTC) Message-ID: <5F2DCE93.8030407@amylaar.uk> Date: Fri, 07 Aug 2020 22:58:43 +0100 From: Joern Wolfgang Rennecke User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Marc Glisse CC: GCC Patches Subject: Re: Simplify X * C1 == C2 with undefined overflow References: <5F2D51A5.3070006@amylaar.uk> <5F2DB9E5.7070104@amylaar.uk> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 21:58:47 -0000 On 07/08/20 21:57, Marc Glisse wrote: > On Fri, 7 Aug 2020, Joern Wolfgang Rennecke wrote: > > >> However, there are cases were the second division will not be >> possible without rest. >> Consider : 7*X == 3 >> 3/7 is 0 rest 3. >> 0x100000000 / 7 is 0x24924924 rest 4 >> Since 3 cannot be represented as an integer multiple of -4, we can >> conclude that the predicate >> is always false. > > 613566757*7-2^32==3 Ah, right. I thought to decompose the variable factor into a non-overflowing and an overflowing part. But now I see that the former will not always be found with a standard division. Here we'd have to consider: 3 by 7 is 1 rest -4 .. and then I get your result above. But of course it's no longer an efficient algorithm if I have to test lots of non-canonical division results.