aarch64.c (aarch64_load_symref_appropriately): Handle SYMBOL_SMALL_TLSGD for ILP32.
authorNaveen H.S <Naveen.Hurugalawadi@cavium.com>
Thu, 8 Dec 2016 05:09:37 +0000 (05:09 +0000)
committerNaveen H.S <naveenh@gcc.gnu.org>
Thu, 8 Dec 2016 05:09:37 +0000 (05:09 +0000)
2016-12-08  Naveen H.S  <Naveen.Hurugalawadi@cavium.com>

gcc
* config/aarch64/aarch64.c (aarch64_load_symref_appropriately):
Handle SYMBOL_SMALL_TLSGD for ILP32.
* config/aarch64/aarch64.md : tlsgd_small modified into
tlsgd_small_<mode> to support SImode and DImode.
*tlsgd_small modified into *tlsgd_small_<mode> to support SImode and
DImode.

gcc/testsuite
* gcc.target/aarch64/pr78382.c : New Testcase.

From-SVN: r243428

gcc/ChangeLog
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/pr78382.c [new file with mode: 0644]

index a44ba8bcf8aeb41a233fc6487cb643ba144a83bc..20262613f7a0681a1a1170a13ca8993caa62a63a 100644 (file)
@@ -1,3 +1,12 @@
+2016-12-08  Naveen H.S  <Naveen.Hurugalawadi@cavium.com>
+
+       * config/aarch64/aarch64.c (aarch64_load_symref_appropriately):
+       Handle SYMBOL_SMALL_TLSGD for ILP32.
+       * config/aarch64/aarch64.md : tlsgd_small modified into
+       tlsgd_small_<mode> to support SImode and DImode.
+       *tlsgd_small modified into *tlsgd_small_<mode> to support SImode and
+       DImode.
+
 2016-12-08  Andrew Pinski  <apinski@cavium.com>
 
        * config/aarch64/aarch64.c (aarch64_load_symref_appropriately):
index 98f76c15b4ef398d1d164c3e72f3967adb698838..1a06432655e155f9ef347b174e389600bd84b5a9 100644 (file)
@@ -1379,10 +1379,14 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm,
     case SYMBOL_SMALL_TLSGD:
       {
        rtx_insn *insns;
-       rtx result = gen_rtx_REG (Pmode, R0_REGNUM);
+       machine_mode mode = GET_MODE (dest);
+       rtx result = gen_rtx_REG (mode, R0_REGNUM);
 
        start_sequence ();
-       aarch64_emit_call_insn (gen_tlsgd_small (result, imm));
+       if (TARGET_ILP32)
+         aarch64_emit_call_insn (gen_tlsgd_small_si (result, imm));
+       else
+         aarch64_emit_call_insn (gen_tlsgd_small_di (result, imm));
        insns = get_insns ();
        end_sequence ();
 
index 811a0785e7df1b89bde785f1541e73842b38ee6c..65eb3265bc2964c2ed9ed455c0723cc455371367 100644 (file)
 ;; The TLS ABI specifically requires that the compiler does not schedule
 ;; instructions in the TLS stubs, in order to enable linker relaxation.
 ;; Therefore we treat the stubs as an atomic sequence.
-(define_expand "tlsgd_small"
+(define_expand "tlsgd_small_<mode>"
  [(parallel [(set (match_operand 0 "register_operand" "")
                   (call (mem:DI (match_dup 2)) (const_int 1)))
-            (unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "")] UNSPEC_GOTSMALLTLS)
+            (unspec:DI [(match_operand:PTR 1 "aarch64_valid_symref" "")] UNSPEC_GOTSMALLTLS)
             (clobber (reg:DI LR_REGNUM))])]
  ""
 {
   operands[2] = aarch64_tls_get_addr ();
 })
 
-(define_insn "*tlsgd_small"
+(define_insn "*tlsgd_small_<mode>"
   [(set (match_operand 0 "register_operand" "")
        (call (mem:DI (match_operand:DI 2 "" "")) (const_int 1)))
-   (unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "S")] UNSPEC_GOTSMALLTLS)
+   (unspec:DI [(match_operand:PTR 1 "aarch64_valid_symref" "S")] UNSPEC_GOTSMALLTLS)
    (clobber (reg:DI LR_REGNUM))
   ]
   ""
index d4fb081254d3d0d98386de35c07f1b97b1c04684..bf6db373076329a1f43fb84554a4de4ce59bb327 100644 (file)
@@ -1,3 +1,7 @@
+2016-12-08  Naveen H.S  <Naveen.Hurugalawadi@cavium.com>
+
+       * gcc.target/aarch64/pr78382.c : New Testcase.
+
 2016-12-08  Andrew Pinski  <apinski@cavium.com>
 
        * gcc.target/aarch64/pr71112.c : New Testcase.
diff --git a/gcc/testsuite/gcc.target/aarch64/pr78382.c b/gcc/testsuite/gcc.target/aarch64/pr78382.c
new file mode 100644 (file)
index 0000000..febe7bc
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-mtls-dialect=trad -fpic" } */
+
+__thread int abc;
+void
+foo ()
+{
+  int *p;
+  p = &abc;
+}