From patchwork Thu Apr 18 13:49:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chung-Lin Tang X-Patchwork-Id: 237645 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 "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id BF8412C0199 for ; Thu, 18 Apr 2013 23:50:50 +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:cc:subject:content-type; q=dns; s=default; b=s8WJ50wMrTaXEBTF72MoPjkRw0DRUg0hU4adPZuAtWS TQZi6io5BAM4GHrkjIb717ahm1aWqBaAgPEmyz8bH9Uyd0evQAbrsezMYa3Olyey vAuT3fI+6LkKAA5+iTo0uyHZcr/yCtBpYQQQXvM0SAhdvM1SVawD0ccX3sdAH8NM = 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:cc:subject:content-type; s=default; bh=dlqgm6TvMDIZoCivfZEiR+E7ZR0=; b=grxkbmeC8lLxySGBT /WdHKAzdanOuGK+cBGFV81x8dgIChzbsX+mCB4VoXM85Dw4t5Wx1jQnhBaDZW+CY nFeid63tEsrHDhFdGGgiCI0pq3iopjHBfbEmB6iFkPvpF26tdruKkm8vDV2C+07B cJT36I7pVWKrvoPAD4wFPmhx0Y= Received: (qmail 1261 invoked by alias); 18 Apr 2013 13:50:07 -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 1243 invoked by uid 89); 18 Apr 2013 13:50:07 -0000 X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 18 Apr 2013 13:50:04 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1USpDv-00040k-Ag from ChungLin_Tang@mentor.com for gcc-patches@gcc.gnu.org; Thu, 18 Apr 2013 06:50:03 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 18 Apr 2013 06:50:02 -0700 Received: from [0.0.0.0] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Thu, 18 Apr 2013 06:50:02 -0700 Message-ID: <516FFA02.3020405@codesourcery.com> Date: Thu, 18 Apr 2013 21:49:54 +0800 From: Chung-Lin Tang User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: gcc-patches CC: Sandra Loosemore Subject: [PATCH 5/5] Altera Nios II: hexadecimal numbers in options X-Virus-Found: No Altera has defined an FPU instruction set on top of the custom instruction space provided in Nios II, but without specifying the exact binary opcode mapping within the [0,255] space; that mapping is specified by the user, through compiler options or target pragmas. For ease of use in specifying the code on the command line, we are proposing the attached patch to allow, for example '-mcustom-fadds=255' to be written as '-mcustom-fadds=0xff' 2013-04-18 Chung-Lin Tang * opts-common.c (integral_argument): Add support for hexadecimal command option integer arguments. Update comments. Index: gcc/opts-common.c =================================================================== --- gcc/opts-common.c (revision 407083) +++ gcc/opts-common.c (revision 409063) @@ -147,7 +147,7 @@ return match_wrong_lang; } -/* If ARG is a non-negative integer made up solely of digits, return its +/* If ARG is a non-negative decimal or hexadecimal integer, return its value, otherwise return -1. */ int @@ -161,6 +161,15 @@ if (*p == '\0') return atoi (arg); + /* It wasn't a decimal number - try hexadecimal. */ + if (arg[0]=='0' && (arg[1]=='x' || arg[1]=='X')) + { + char *endp; + int val = strtol (arg, &endp, 16); + if (*endp == '\0') + return val; + } + return -1; }