From patchwork Mon Aug 29 08:37:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 111977 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 8174FB6F7F for ; Mon, 29 Aug 2011 18:37:55 +1000 (EST) Received: (qmail 14899 invoked by alias); 29 Aug 2011 08:37:50 -0000 Received: (qmail 14829 invoked by uid 22791); 29 Aug 2011 08:37:49 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 29 Aug 2011 08:37:29 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4502B2BB136; Mon, 29 Aug 2011 04:37:29 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id LyREFd9CozD4; Mon, 29 Aug 2011 04:37:29 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 2ECB42BB12F; Mon, 29 Aug 2011 04:37:29 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 254773FEE8; Mon, 29 Aug 2011 04:37:29 -0400 (EDT) Date: Mon, 29 Aug 2011 04:37:29 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Geert Bosch Subject: [Ada] Use subtraction to negate VAX float on Alpha VMS Message-ID: <20110829083729.GA1449@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 Using "cpysn" just flips the sign bit, but that will generate an invalid VAX Float for an input value of 0.0, as VAX float formats do not allow signed zeros. The following should compile and execute successfully. procedure test1 is XX, YY, ZZ : Long_Float; begin XX := 0.0; YY := 1.1; ZZ := -XX * YY; if ZZ /= 0.0 then raise Program_Error; end if; end; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-08-29 Geert Bosch * s-vaflop-vms-alpha.adb (Neg_F): Use subtraction instead of negation instruction, as the latter may produce -0.0, which is not a valid VAX F float number. (Neg_G): Likewise for VAX F float. Index: s-vaflop-vms-alpha.adb =================================================================== --- s-vaflop-vms-alpha.adb (revision 178160) +++ s-vaflop-vms-alpha.adb (working copy) @@ -536,7 +536,7 @@ C : F; begin Asm ("ldf %0,%1", S'Asm_Output ("=f", A), F'Asm_Input ("m", X)); - Asm ("cpysn %1,%1,%0", S'Asm_Output ("=f", B), S'Asm_Input ("f", A)); + Asm ("subf $f31,%1,%0", S'Asm_Output ("=f", B), S'Asm_Input ("f", A)); Asm ("stf %1,%0", F'Asm_Output ("=m", C), S'Asm_Input ("f", B)); return C; end Neg_F; @@ -550,7 +550,7 @@ C : G; begin Asm ("ldg %0,%1", T'Asm_Output ("=f", A), G'Asm_Input ("m", X)); - Asm ("cpysn %1,%1,%0", T'Asm_Output ("=f", B), T'Asm_Input ("f", A)); + Asm ("subg $f31,%1,%0", T'Asm_Output ("=f", B), T'Asm_Input ("f", A)); Asm ("stg %1,%0", G'Asm_Output ("=m", C), T'Asm_Input ("f", B)); return C; end Neg_G;