From patchwork Thu Jul 12 06:52:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chung-Lin Tang X-Patchwork-Id: 170579 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 996542C020C for ; Thu, 12 Jul 2012 16:52:42 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1342680762; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC: Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=AV54clJqXU1w39N6b9hoFpJxllk=; b=QNG41kn+6WmLUO0 8h9oaUsyYlGHbMv9BWIs+R0rb4iwnZthAceggU6Lx3k0NEWcn4IeNyDWc0IT3+gd GQRrrf8CqoL0cpom7JaoqkoaM2KASgCs4m+eSuHGaEbCiJB+mGrqvOk0nipS4Eyf /yWFToK7WE9r0xE8E40xxpaRZ0Ik= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ycpiv5W0Je7msg8imoUC2kqPMP2PIUM3HsGveS/PFTLKIsxvaELncScctZISZm /BxKVKwfNTTUDZiFtJTkQfxvo3Y8Y4wORDeUvu6eYHqeNRDX7wARh6fpo7lybLW3 MhASDTEjG+ljRuQdJbh0YpyQvEDEAo3NOKwZPhDO68s+M=; Received: (qmail 31394 invoked by alias); 12 Jul 2012 06:52:38 -0000 Received: (qmail 31381 invoked by uid 22791); 12 Jul 2012 06:52:36 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, FROM_12LTRDOM, KHOP_RCVD_UNTRUST, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Jul 2012 06:52:23 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1SpDGA-00015p-MO from ChungLin_Tang@mentor.com ; Wed, 11 Jul 2012 23:52:22 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 11 Jul 2012 23:52:22 -0700 Received: from [0.0.0.0] (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Wed, 11 Jul 2012 23:52:21 -0700 Message-ID: <4FFE7429.10201@codesourcery.com> Date: Thu, 12 Jul 2012 14:52:25 +0800 From: Chung-Lin Tang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: gcc-patches CC: Richard Henderson Subject: [PATCH 2/6] Thread pointer built-in functions, alpha X-IsSubscribed: yes 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 Alpha parts. Note that now the machine-independent __builtin_thread_pointer() is now marked as const/readonly, slightly different from the original alpha backend code. Thanks, Chung-Lin * config/alpha/alpha.c (alpha_builtin): Remove ALPHA_BUILTIN_THREAD_POINTER, ALPHA_BUILTIN_SET_THREAD_POINTER. (code_for_builtin): Remove CODE_FOR_load_tp, CODE_FOR_set_tp. (alpha_init_builtins): Remove __builtin_thread_pointer, __builtin_set_thread_pointer machine-specific builtins. (alpha_expand_builtin_thread_pointer): Add hook function for TARGET_EXPAND_BUILTIN_THREAD_POINTER. (alpha_expand_builtin_set_thread_pointer): Add hook function for TARGET_EXPAND_BUILTIN_SET_THREAD_POINTER. (alpha_fold_builtin): Remove ALPHA_BUILTIN_THREAD_POINTER, ALPHA_BUILTIN_SET_THREAD_POINTER cases. Index: config/alpha/alpha.c =================================================================== --- config/alpha/alpha.c (revision 189431) +++ config/alpha/alpha.c (working copy) @@ -6317,8 +6317,6 @@ enum alpha_builtin ALPHA_BUILTIN_AMASK, ALPHA_BUILTIN_IMPLVER, ALPHA_BUILTIN_RPCC, - ALPHA_BUILTIN_THREAD_POINTER, - ALPHA_BUILTIN_SET_THREAD_POINTER, ALPHA_BUILTIN_ESTABLISH_VMS_CONDITION_HANDLER, ALPHA_BUILTIN_REVERT_VMS_CONDITION_HANDLER, @@ -6374,8 +6372,6 @@ static enum insn_code const code_for_builtin[ALPHA CODE_FOR_builtin_amask, CODE_FOR_builtin_implver, CODE_FOR_builtin_rpcc, - CODE_FOR_load_tp, - CODE_FOR_set_tp, CODE_FOR_builtin_establish_vms_condition_handler, CODE_FOR_builtin_revert_vms_condition_handler, @@ -6533,14 +6529,6 @@ alpha_init_builtins (void) alpha_dimode_u, NULL_TREE); alpha_add_builtins (two_arg_builtins, ARRAY_SIZE (two_arg_builtins), ftype); - ftype = build_function_type_list (ptr_type_node, NULL_TREE); - alpha_builtin_function ("__builtin_thread_pointer", ftype, - ALPHA_BUILTIN_THREAD_POINTER, ECF_NOTHROW); - - ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); - alpha_builtin_function ("__builtin_set_thread_pointer", ftype, - ALPHA_BUILTIN_SET_THREAD_POINTER, ECF_NOTHROW); - if (TARGET_ABI_OPEN_VMS) { ftype = build_function_type_list (ptr_type_node, ptr_type_node, @@ -6645,7 +6633,20 @@ alpha_expand_builtin (tree exp, rtx target, return const0_rtx; } +static rtx +alpha_expand_builtin_thread_pointer (rtx target) +{ + emit_insn (gen_load_tp (target)); + return target; +} +static void +alpha_expand_builtin_set_thread_pointer (rtx val) +{ + emit_insn (gen_set_tp (val)); +} + + /* Several bits below assume HWI >= 64 bits. This should be enforced by config.gcc. */ #if HOST_BITS_PER_WIDE_INT < 64 @@ -7077,8 +7078,6 @@ alpha_fold_builtin (tree fndecl, int n_args, tree case ALPHA_BUILTIN_AMASK: case ALPHA_BUILTIN_IMPLVER: case ALPHA_BUILTIN_RPCC: - case ALPHA_BUILTIN_THREAD_POINTER: - case ALPHA_BUILTIN_SET_THREAD_POINTER: /* None of these are foldable at compile-time. */ default: return NULL; @@ -9811,6 +9810,11 @@ alpha_conditional_register_usage (void) #undef TARGET_EXPAND_BUILTIN_VA_START #define TARGET_EXPAND_BUILTIN_VA_START alpha_va_start +#undef TARGET_EXPAND_BUILTIN_THREAD_POINTER +#define TARGET_EXPAND_BUILTIN_THREAD_POINTER alpha_expand_builtin_thread_pointer +#undef TARGET_EXPAND_BUILTIN_SET_THREAD_POINTER +#define TARGET_EXPAND_BUILTIN_SET_THREAD_POINTER alpha_expand_builtin_set_thread_pointer + /* The Alpha architecture does not require sequential consistency. See http://www.cs.umd.edu/~pugh/java/memoryModel/AlphaReordering.html for an example of how it can be violated in practice. */