From patchwork Tue Mar 13 15:52:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 146435 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 48473B6EF1 for ; Wed, 14 Mar 2012 02:53:02 +1100 (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=1332258783; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=2MSMz0LZ0aG7gFsxNn3ah6Sh3xY=; b=BqLzac2uD1spdwtRd8JwYIagysxrChRmrsgslcbDncPgx7RMydEePso3GKSphI fXRUKn1z2zhpOOmgv4lMSnkOCBBEvvqemngPrUDeXr2vnL67hzTad9fk31Yt4T1o kzdrvbKmbxetOxZcqwDOSN5qZwzVONOoYI+F4moAwd5EE= 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:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=GCHq5lXnZ6xZ3UiyiiZFbqgWGif0csywARdFVvlBtFtZj5eeP+0e2RfCKP9sny dPF6XuhZxp1ykaJptv1Bott0krCzrBvXxrvH7aU1KtnwvanahZWQcTdbe5NPVEJu rs78FvyjUXrxLF0nT1zO152vds3kqgrYYiYs/ohWGXFu8=; Received: (qmail 13899 invoked by alias); 13 Mar 2012 15:52:55 -0000 Received: (qmail 13878 invoked by uid 22791); 13 Mar 2012 15:52:51 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-yw0-f47.google.com (HELO mail-yw0-f47.google.com) (209.85.213.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Mar 2012 15:52:33 +0000 Received: by yhjj56 with SMTP id j56so740267yhj.20 for ; Tue, 13 Mar 2012 08:52:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.101.134.40 with SMTP id l40mr143654ann.33.1331653952859; Tue, 13 Mar 2012 08:52:32 -0700 (PDT) Received: by 10.146.241.18 with HTTP; Tue, 13 Mar 2012 08:52:32 -0700 (PDT) In-Reply-To: References: <20120311232613.GA28504@intel.com> Date: Tue, 13 Mar 2012 16:52:32 +0100 Message-ID: Subject: Re: PATCH: Call gen_tls_global_dynamic_64_ and en_tls_local_dynamic_base_64_ From: Uros Bizjak To: "H.J. Lu" Cc: gcc-patches@gcc.gnu.org, Richard Henderson 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 On Mon, Mar 12, 2012 at 10:35 PM, H.J. Lu wrote: >>>> 2012-03-12  H.J. Lu   >>>> >>>>        * config/i386/i386.c (ix86_gen_tls_global_dynamic_64): New. >>>>        (ix86_gen_tls_local_dynamic_base_64): Likewise. >>>>        (ix86_option_override_internal): Set ix86_gen_tls_global_dynamic_64 >>>>        and ix86_gen_tls_local_dynamic_base_64. >>>>        (legitimize_tls_address): Use ix86_gen_tls_global_dynamic_64 and >>>>        ix86_gen_tls_local_dynamic_base_64. >>>> >>>>        * config/i386/i386.md (*tls_global_dynamic_64): Renamed to ... >>>>        (*tls_global_dynamic_64_): This. >>>>        (tls_global_dynamic_64): Renamed to ... >>>>        (tls_global_dynamic_64_): This. >>>>        (*tls_local_dynamic_base_64): Renamed to ... >>>>        (*tls_local_dynamic_base_64_): This. >>>>        (tls_local_dynamic_base_64): Renamed to ... >>>>        (tls_local_dynamic_base_64_): This. >>> >>> This patch caused x32 libgcc build failure: >>> >>> ../../../../src-trunk/libgcc/generic-morestack-thread.c: In function >>> 'stack_split_initialize_thread': >>> ../../../../src-trunk/libgcc/generic-morestack-thread.c:128:1: error: >>> unrecognizable insn: >>> (call_insn/u 8 7 9 3 (parallel [ >>>            (set (reg:DI 0 ax) >>>                (call:DI (mem:QI (symbol_ref:DI ("__tls_get_addr")) [0 S1 A8]) >>>                    (const_int 0 [0]))) >>>            (unspec:DI [ >>>                    (symbol_ref:SI ("__morestack_segments") [flags >>> 0x50] ) >>>                ] UNSPEC_TLS_GD) >>>        ]) ../../../../src-trunk/libgcc/generic-morestack-thread.c:117 -1 >>>     (expr_list:REG_EH_REGION (const_int -2147483648 [0xffffffff80000000]) >>>        (nil)) >>>    (nil)) >>> ../../../../src-trunk/libgcc/generic-morestack-thread.c:128:1: >>> internal compiler error: in extract_insn, at recog.c:2123 >>> Please submit a full bug report, >>> with preprocessed source if appropriate. >>> See for instructions. >>> make[8]: *** [generic-morestack-thread.o] Error 1 >>> make[8]: *** Waiting for unfinished jobs.... >>> >>> __morestack_segments is always in SImode for x32.  Adding >>> :P to >>> >>>  (unspec:P [(match_operand 1 "tls_symbolic_operand" "")] >>> >>> causes it to fail when Pmode == DImode  I checked in this patch >>> to revert the part of that change. >> >> Please better declare tls_symbolic_operand as special predicate, as in >> attached patch. 2012-03-13 Uros Bizjak * config/i386/predicates.md (tls_symbolic_operand): Declare as special predicate. (tls_modbase_operand): Ditto. * config/i386/i386.md: Remove mode from tls_symbolic_operand and tls_modbase_operand predicates. There is no point to pass mode of special predicate operands, so I remove these from i386.md. Tested on x86_64-pc-linux-gnu, committed to mainline SVN. Uros. Index: i386.md =================================================================== --- i386.md (revision 185277) +++ i386.md (working copy) @@ -12591,7 +12591,7 @@ [(set (match_operand:SI 0 "register_operand" "=a") (unspec:SI [(match_operand:SI 1 "register_operand" "b") - (match_operand:SI 2 "tls_symbolic_operand" "") + (match_operand 2 "tls_symbolic_operand" "") (match_operand:SI 3 "constant_call_address_operand" "z")] UNSPEC_TLS_GD)) (clobber (match_scratch:SI 4 "=d")) @@ -12616,7 +12616,7 @@ [(parallel [(set (match_operand:SI 0 "register_operand" "") (unspec:SI [(match_operand:SI 2 "register_operand" "") - (match_operand:SI 1 "tls_symbolic_operand" "") + (match_operand 1 "tls_symbolic_operand" "") (match_operand:SI 3 "constant_call_address_operand" "")] UNSPEC_TLS_GD)) (clobber (match_scratch:SI 4 "")) @@ -12727,7 +12727,7 @@ (match_operand:SI 2 "constant_call_address_operand" "z")] UNSPEC_TLS_LD_BASE) (const:SI (unspec:SI - [(match_operand:SI 3 "tls_symbolic_operand" "")] + [(match_operand 3 "tls_symbolic_operand" "")] UNSPEC_DTPOFF)))) (clobber (match_scratch:SI 4 "=d")) (clobber (match_scratch:SI 5 "=c")) @@ -12825,7 +12825,7 @@ (define_insn "tls_initial_exec_64_sun" [(set (match_operand:DI 0 "register_operand" "=a") (unspec:DI - [(match_operand:DI 1 "tls_symbolic_operand" "")] + [(match_operand 1 "tls_symbolic_operand" "")] UNSPEC_TLS_IE_SUN)) (clobber (reg:CC FLAGS_REG))] "TARGET_64BIT && TARGET_SUN_TLS" @@ -12847,7 +12847,7 @@ (define_insn "tls_initial_exec_x32" [(set (match_operand:SI 0 "register_operand" "=r") (unspec:SI - [(match_operand:SI 1 "tls_symbolic_operand" "")] + [(match_operand 1 "tls_symbolic_operand" "")] UNSPEC_TLS_IE_X32)) (clobber (reg:CC FLAGS_REG))] "TARGET_X32" @@ -12864,7 +12864,7 @@ [(set (match_dup 3) (plus:SI (match_operand:SI 2 "register_operand" "") (const:SI - (unspec:SI [(match_operand:SI 1 "tls_symbolic_operand" "")] + (unspec:SI [(match_operand 1 "tls_symbolic_operand" "")] UNSPEC_TLSDESC)))) (parallel [(set (match_operand:SI 0 "register_operand" "") @@ -12882,7 +12882,7 @@ [(set (match_operand:SI 0 "register_operand" "=r") (plus:SI (match_operand:SI 1 "register_operand" "b") (const:SI - (unspec:SI [(match_operand:SI 2 "tls_symbolic_operand" "")] + (unspec:SI [(match_operand 2 "tls_symbolic_operand" "")] UNSPEC_TLSDESC))))] "!TARGET_64BIT && TARGET_GNU2_TLS" "lea{l}\t{%E2@TLSDESC(%1), %0|%0, %E2@TLSDESC[%1]}" @@ -12893,7 +12893,7 @@ (define_insn "*tls_dynamic_gnu2_call_32" [(set (match_operand:SI 0 "register_operand" "=a") - (unspec:SI [(match_operand:SI 1 "tls_symbolic_operand" "") + (unspec:SI [(match_operand 1 "tls_symbolic_operand" "") (match_operand:SI 2 "register_operand" "0") ;; we have to make sure %ebx still points to the GOT (match_operand:SI 3 "register_operand" "b") @@ -12909,13 +12909,13 @@ (define_insn_and_split "*tls_dynamic_gnu2_combine_32" [(set (match_operand:SI 0 "register_operand" "=&a") (plus:SI - (unspec:SI [(match_operand:SI 3 "tls_modbase_operand" "") + (unspec:SI [(match_operand 3 "tls_modbase_operand" "") (match_operand:SI 4 "" "") (match_operand:SI 2 "register_operand" "b") (reg:SI SP_REG)] UNSPEC_TLSDESC) (const:SI (unspec:SI - [(match_operand:SI 1 "tls_symbolic_operand" "")] + [(match_operand 1 "tls_symbolic_operand" "")] UNSPEC_DTPOFF)))) (clobber (reg:CC FLAGS_REG))] "!TARGET_64BIT && TARGET_GNU2_TLS" @@ -12969,7 +12969,7 @@ (define_insn_and_split "*tls_dynamic_gnu2_combine_64" [(set (match_operand:DI 0 "register_operand" "=&a") (plus:DI - (unspec:DI [(match_operand:DI 2 "tls_modbase_operand" "") + (unspec:DI [(match_operand 2 "tls_modbase_operand" "") (match_operand:DI 3 "" "") (reg:DI SP_REG)] UNSPEC_TLSDESC) Index: predicates.md =================================================================== --- predicates.md (revision 185277) +++ predicates.md (working copy) @@ -491,11 +491,11 @@ (match_operand 0 "local_symbolic_operand"))) ;; Test for various thread-local symbols. -(define_predicate "tls_symbolic_operand" +(define_special_predicate "tls_symbolic_operand" (and (match_code "symbol_ref") (match_test "SYMBOL_REF_TLS_MODEL (op)"))) -(define_predicate "tls_modbase_operand" +(define_special_predicate "tls_modbase_operand" (and (match_code "symbol_ref") (match_test "op == ix86_tls_module_base ()")))