From patchwork Wed Oct 15 21:00:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 400087 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 482C81400B5 for ; Thu, 16 Oct 2014 08:01:13 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:cc:in-reply-to:subject:references; q=dns; s= default; b=ufeRqsXvLKvpRE+5+uKe9d0Kf3DjayKqA3/ldTfFfnzeZHSzeg34b W6LvC75Oc+mGZrqSA/UczDeFdwqmOggoxJTQbn5LScJYCmPzIrtfxCBGy7hGUahx nV+iT8FKAnLwKkcSC0QniMDKM/ePClADffkEMi2OgWDbelVecIW52k= 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:date :message-id:from:to:cc:in-reply-to:subject:references; s= default; bh=8sAcJojAsY91bw61FZTvq3Rf+kw=; b=KiwEc3xefHBhU7z0DMQ5 xOC0/FP+wzLcszqJkJRJUJHF9ic5W3q/kXm2mWKvKmxAOKW5AgaCufC26wBd5ZMB cHHvAHL1edmlBnMb7acFmRmozInhxAEmFSk03NFULa/WMTeImzKvPlgI66B4B7qI m4m/baiBDdB0CgyD+5O8AKA= Received: (qmail 10535 invoked by alias); 15 Oct 2014 21:01:06 -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 10524 invoked by uid 89); 15 Oct 2014 21:01:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 15 Oct 2014 21:01:04 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9FL11C0019454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 15 Oct 2014 17:01:01 -0400 Received: from greed.delorie.com (ovpn-113-33.phx2.redhat.com [10.3.113.33]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9FL0xFa002533 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 15 Oct 2014 17:01:00 -0400 Received: from greed.delorie.com (greed.delorie.com [127.0.0.1]) by greed.delorie.com (8.14.4/8.14.4) with ESMTP id s9FL0wnw009993; Wed, 15 Oct 2014 17:00:58 -0400 Received: (from dj@localhost) by greed.delorie.com (8.14.4/8.14.4/Submit) id s9FL0wvR009992; Wed, 15 Oct 2014 17:00:58 -0400 Date: Wed, 15 Oct 2014 17:00:58 -0400 Message-Id: <201410152100.s9FL0wvR009992@greed.delorie.com> From: DJ Delorie To: Markus Trippelsdorf CC: joseph@codesourcery.com, gcc-patches@gcc.gnu.org In-reply-to: <20141015081401.GA339@x4> (message from Markus Trippelsdorf on Wed, 15 Oct 2014 10:14:01 +0200) Subject: Re: __intN patch 3/5: main __int128 -> __intN conversion. References: <201408212123.s7LLNPIQ018746@greed.delorie.com> <201408220515.s7M5Fhpa007479@greed.delorie.com> <201408221924.s7MJOcjB022631@greed.delorie.com> <201408260303.s7Q33nqm024601@greed.delorie.com> <20141014201711.GA344@x4> <201410142110.s9ELAW4b019458@greed.delorie.com> <20141015081401.GA339@x4> X-IsSubscribed: yes > If you could implement the second option, it would be appreciated. Could you please test this for me? It builds as a powerpc-elf cross-compiler (at least the host half) but I don't have a power machine here to test on. Index: rs6000-c.c =================================================================== --- rs6000-c.c (revision 216241) +++ rs6000-c.c (working copy) @@ -157,12 +157,29 @@ init_vector_keywords (void) { __int128_type = get_identifier ("__int128_t"); __uint128_type = get_identifier ("__uint128_t"); } } +/* Helper function to find out which RID_INT_N_* code is the one for + __int128, if any. Returns RID_MAX+1 if none apply, which is safe + (for our purposes, since we always expect to have __int128) to + compare against. */ +static int +rid_int128(void) +{ + int i; + + for (i = 0; i < NUM_INT_N_ENTS; i ++) + if (int_n_enabled_p[i] + && int_n_data[i].bitsize == 128) + return RID_INT_N_0 + i; + + return RID_MAX + 1; +} + /* Called to decide whether a conditional macro should be expanded. Since we have exactly one such macro (i.e, 'vector'), we do not need to examine the 'tok' parameter. */ static cpp_hashnode * rs6000_macro_to_expand (cpp_reader *pfile, const cpp_token *tok) @@ -231,13 +248,13 @@ rs6000_macro_to_expand (cpp_reader *pfil if (rid_code == RID_UNSIGNED || rid_code == RID_LONG || rid_code == RID_SHORT || rid_code == RID_SIGNED || rid_code == RID_INT || rid_code == RID_CHAR || rid_code == RID_FLOAT || (rid_code == RID_DOUBLE && TARGET_VSX) - || (rid_code == RID_INT128 && TARGET_VADDUQM)) + || (rid_code == rid_int128 () && TARGET_VADDUQM)) { expand_this = C_CPP_HASHNODE (__vector_keyword); /* If the next keyword is bool or pixel, it will need to be expanded as well. */ do tok = cpp_peek_token (pfile, idx++);