PR target/43309
authorro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Jan 2011 19:44:32 +0000 (19:44 +0000)
committerro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Jan 2011 19:44:32 +0000 (19:44 +0000)
* config/i386/i386.c (legitimize_tls_address)
<TLS_MODEL_INITIAL_EXEC>: Handle TARGET_64BIT && TARGET_SUN_TLS.
* config/i386/i386.md (UNSPEC_TLS_IE_SUN): Declare.
(tls_initial_exec_64_sun): New pattern.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168553 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.md

index 2a8cef0..c7fe658 100644 (file)
@@ -1,3 +1,11 @@
+2011-01-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       PR target/43309
+       * config/i386/i386.c (legitimize_tls_address)
+       <TLS_MODEL_INITIAL_EXEC>: Handle TARGET_64BIT && TARGET_SUN_TLS.
+       * config/i386/i386.md (UNSPEC_TLS_IE_SUN): Declare.
+       (tls_initial_exec_64_sun): New pattern.
+
 2011-01-06  Gerald Pfeifer  <gerald@pfeifer.com>
 
        * doc/invoke.texi (Overall Options): Improve wording and markup
index 2a31d3c..39be03e 100644 (file)
@@ -12505,6 +12505,17 @@ legitimize_tls_address (rtx x, enum tls_model model, int for_mov)
     case TLS_MODEL_INITIAL_EXEC:
       if (TARGET_64BIT)
        {
+         if (TARGET_SUN_TLS)
+           {
+             /* The Sun linker took the AMD64 TLS spec literally
+                and can only handle %rax as destination of the
+                initial executable code sequence.  */
+
+             dest = gen_reg_rtx (Pmode);
+             emit_insn (gen_tls_initial_exec_64_sun (dest, x));
+             return dest;
+           }
+
          pic = NULL;
          type = UNSPEC_GOTNTPOFF;
        }
index 05937e6..66ddf1d 100644 (file)
@@ -93,6 +93,7 @@
   UNSPEC_TLS_GD
   UNSPEC_TLS_LD_BASE
   UNSPEC_TLSDESC
+  UNSPEC_TLS_IE_SUN
 
   ;; Other random patterns
   UNSPEC_SCAS
    (set_attr "memory" "load")
    (set_attr "imm_disp" "false")])
 
+;; The Sun linker took the AMD64 TLS spec literally and can only handle
+;; %rax as destination of the initial executable code sequence.
+(define_insn "tls_initial_exec_64_sun"
+  [(set (match_operand:DI 0 "register_operand" "=a")
+       (unspec:DI
+        [(match_operand:DI 1 "tls_symbolic_operand" "")]
+        UNSPEC_TLS_IE_SUN))
+   (clobber (reg:CC FLAGS_REG))]
+  "TARGET_64BIT && TARGET_SUN_TLS"
+  "mov{q}\t{%%fs:0, %0|%0, QWORD PTR fs:0}\n\tadd{q}\t{%a1@gottpoff(%%rip), %0|%0, %a1@gottpoff[rip]}"
+  [(set_attr "type" "multi")])
+
 ;; GNU2 TLS patterns can be split.
 
 (define_expand "tls_dynamic_gnu2_32"