From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28694 invoked by alias); 7 Oct 2011 19:36:48 -0000 Received: (qmail 28686 invoked by uid 22791); 7 Oct 2011 19:36:48 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ka.mail.enyo.de (HELO ka.mail.enyo.de) (87.106.162.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 Oct 2011 19:36:32 +0000 Received: from [172.17.135.4] (helo=deneb.enyo.de) by ka.mail.enyo.de with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) id 1RCGDd-0006jX-VE; Fri, 07 Oct 2011 21:36:30 +0200 Received: from fw by deneb.enyo.de with local (Exim 4.72) (envelope-from ) id 1RCGDd-0006M5-NR; Fri, 07 Oct 2011 21:36:29 +0200 From: Florian Weimer To: Ulf Magnusson Cc: gcc@gcc.gnu.org Subject: Re: Option to make unsigned->signed conversion always well-defined? References: <87sjn5g638.fsf@mid.deneb.enyo.de> <87pqi8k8mk.fsf@mid.deneb.enyo.de> Date: Fri, 07 Oct 2011 23:36:00 -0000 In-Reply-To: (Ulf Magnusson's message of "Fri, 7 Oct 2011 20:14:01 +0200") Message-ID: <87botsh9vm.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes 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: 2011-10/txt/msg00115.txt.bz2 * Ulf Magnusson: > Good machine code would be fun to see, though I might need to brush up > on my ARM. It turns out that ARM doesn't seem to have 8-bit overflow detection, so something like this has to be used (with the arguments in R1 and R2, result in the lower bit of R3): MOV R3, R1, LSL #24 ADDS R3, R2, R3, LSL #24 ADDVS R3, R3, #1 Not sure if this is correct, I don't really know ARM assembly.