From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31395 invoked by alias); 13 Feb 2014 11:51:57 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 31383 invoked by uid 89); 13 Feb 2014 11:51:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Feb 2014 11:51:56 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 13 Feb 2014 11:51:53 +0000 Received: from [10.1.208.24] ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 13 Feb 2014 11:51:53 +0000 Message-ID: <52FCB1D7.6000602@arm.com> Date: Thu, 13 Feb 2014 11:51:00 -0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-Version: 1.0 To: Fabian Oboril CC: "gcc-help@gcc.gnu.org" Subject: Re: Excluding parts of the instruction set during compilation References: <52FC9CB3.1040604@kit.edu> In-Reply-To: <52FC9CB3.1040604@kit.edu> X-MC-Unique: 114021311515302301 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-02/txt/msg00078.txt.bz2 On 13/02/14 10:21, Fabian Oboril wrote: > Hello everybody, > > I am currently working on a project for which I need to compile C-code > using only a small subset of the available instruction set. So for > example, instead of using add, addi, addiu and addu, I would like that > the compiler is using just one of them. Is there a way, that this can be > handled with gcc, for example by giving a list of not-to-use > instructions at compile time? > > Can anyone help? Hi Fabian, It's not really possible to give gcc a list of instructions not to use. Wha= t if=20 some operations in your source code can only be performed by those instruct= ions=20 that you excluded? Getting the compiler to synthesise any operation using a= ny=20 arbitrary subset of instructions is not realistic. Some targets, for example arm, can generate code for multiple revisions of = the=20 architecture and newer revisions might allow instructions that are not pres= ent=20 in previous ones. In that case gcc will know not to generate those instruct= ions=20 if asked to compile for the old instruction by having -march set appropriat= ely,=20 but the list of instructions available for use is defined by the architectu= re,=20 not the user. HTH, Kyrill