[RS6000] Replace TLSmode with P, and correct tls call mems
authorAlan Modra <amodra@gmail.com>
Thu, 29 Nov 2018 04:45:00 +0000 (15:15 +1030)
committerAlan Modra <amodra@gcc.gnu.org>
Thu, 29 Nov 2018 04:45:00 +0000 (15:15 +1030)
There is really no need to define a TLSmode mode iterator that is
identical (since !TARGET_64BIT == TARGET_32BIT) to the much used P
mode iterator.  It's nonsense to think we might ever want to support
32-bit TLS on 64-bit or vice versa!  The patch also fixes a minor
error in the call mems.  All other direct calls use (call (mem:SI ..)).

* config/rs6000/rs6000.md (TLSmode): Delete mode iterator.  Replace
with P throughout except for call mems which should use SI.
(tls_abi_suffix, tls_sysv_suffix, tls_insn_suffix): Delete mode
attributes.  Replace with bits, mode and ptrload respectively.

From-SVN: r266602

gcc/ChangeLog
gcc/config/rs6000/rs6000.md

index 85ae1d95c1fc82a02f345d8b6d61e3795866931c..3c9c0b450e1c619db03715d0dba0e43c90bbfd7a 100644 (file)
@@ -1,3 +1,10 @@
+2018-11-29  Alan Modra  <amodra@gmail.com>
+
+       * config/rs6000/rs6000.md (TLSmode): Delete mode iterator.  Replace
+       with P throughout except for call mems which should use SI.
+       (tls_abi_suffix, tls_sysv_suffix, tls_insn_suffix): Delete mode
+       attributes.  Replace with bits, mode and ptrload respectively.
+
 2018-11-29  Alan Modra  <amodra@gmail.com>
 
        * config/rs6000/rs6000-protos.h (rs6000_indirect_call_template),
index c918b04e64bcb9e524084eb8abd821c60e483ee8..81914a99c904aa38839e565c8fa2b7b629375342 100644 (file)
 \f
 ;; TLS support.
 
-;; Mode attributes for different ABIs.
-(define_mode_iterator TLSmode [(SI "! TARGET_64BIT") (DI "TARGET_64BIT")])
-(define_mode_attr tls_abi_suffix [(SI "32") (DI "64")])
-(define_mode_attr tls_sysv_suffix [(SI "si") (DI "di")])
-(define_mode_attr tls_insn_suffix [(SI "wz") (DI "d")])
-
-(define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-        (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
+(define_insn_and_split "tls_gd_aix<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+        (call (mem:SI (match_operand:P 3 "symbol_ref_operand" "s"))
              (match_operand 4 "" "g")))
-   (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                   (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                  UNSPEC_TLSGD)
+   (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+             (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+            UNSPEC_TLSGD)
    (clobber (reg:SI LR_REGNO))]
   "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
 {
 }
   "&& TARGET_TLS_MARKERS"
   [(set (match_dup 0)
-       (unspec:TLSmode [(match_dup 1)
-                        (match_dup 2)]
-                       UNSPEC_TLSGD))
+       (unspec:P [(match_dup 1)
+                  (match_dup 2)]
+                 UNSPEC_TLSGD))
    (parallel [(set (match_dup 0)
-                  (call (mem:TLSmode (match_dup 3))
-                        (match_dup 4)))
-             (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
+                  (call (mem:SI (match_dup 3))
+                        (match_dup 4)))
+             (unspec:P [(match_dup 2)] UNSPEC_TLSGD)
              (clobber (reg:SI LR_REGNO))])]
   ""
   [(set_attr "type" "two")
    (set (attr "length")
      (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
-                  (const_int 16)
-                  (const_int 12)))])
+                  (const_int 16)
+                  (const_int 12)))])
 
-(define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-        (call (mem:TLSmode (match_operand:TLSmode 3 "symbol_ref_operand" "s"))
+(define_insn_and_split "tls_gd_sysv<mode>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+        (call (mem:SI (match_operand:P 3 "symbol_ref_operand" "s"))
              (match_operand 4 "" "g")))
-   (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                   (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                  UNSPEC_TLSGD)
+   (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+             (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+            UNSPEC_TLSGD)
    (clobber (reg:SI LR_REGNO))]
   "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
 {
 }
   "&& TARGET_TLS_MARKERS"
   [(set (match_dup 0)
-       (unspec:TLSmode [(match_dup 1)
-                        (match_dup 2)]
-                       UNSPEC_TLSGD))
+       (unspec:P [(match_dup 1)
+                  (match_dup 2)]
+                 UNSPEC_TLSGD))
    (parallel [(set (match_dup 0)
-                  (call (mem:TLSmode (match_dup 3))
-                        (match_dup 4)))
-             (unspec:TLSmode [(match_dup 2)] UNSPEC_TLSGD)
+                  (call (mem:SI (match_dup 3))
+                        (match_dup 4)))
+             (unspec:P [(match_dup 2)] UNSPEC_TLSGD)
              (clobber (reg:SI LR_REGNO))])]
   ""
   [(set_attr "type" "two")
    (set_attr "length" "8")])
 
-(define_insn_and_split "*tls_gd<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                        (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                       UNSPEC_TLSGD))]
+(define_insn_and_split "*tls_gd<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                  (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                 UNSPEC_TLSGD))]
   "HAVE_AS_TLS && TARGET_TLS_MARKERS"
   "addi %0,%1,%2@got@tlsgd"
   "&& TARGET_CMODEL != CMODEL_SMALL"
   [(set (match_dup 3)
-       (high:TLSmode
-           (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
+       (high:P
+           (unspec:P [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))
    (set (match_dup 0)
-       (lo_sum:TLSmode (match_dup 3)
-           (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))]
+       (lo_sum:P (match_dup 3)
+           (unspec:P [(match_dup 1) (match_dup 2)] UNSPEC_TLSGD)))]
 {
   operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
 }
   [(set (attr "length")
      (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
-                  (const_int 8)
-                  (const_int 4)))])
-
-(define_insn "*tls_gd_high<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-     (high:TLSmode
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                       (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                      UNSPEC_TLSGD)))]
+                  (const_int 8)
+                  (const_int 4)))])
+
+(define_insn "*tls_gd_high<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+     (high:P
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                 (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                UNSPEC_TLSGD)))]
   "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
   "addis %0,%1,%2@got@tlsgd@ha")
 
-(define_insn "*tls_gd_low<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-     (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
-       (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
-                       (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                      UNSPEC_TLSGD)))]
+(define_insn "*tls_gd_low<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+     (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
+       (unspec:P [(match_operand:P 3 "gpc_reg_operand" "b")
+                 (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                UNSPEC_TLSGD)))]
   "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
   "addi %0,%1,%2@got@tlsgd@l")
 
-(define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-        (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
+(define_insn "*tls_gd_call_aix<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+        (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
              (match_operand 2 "" "g")))
-   (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
-                  UNSPEC_TLSGD)
+   (unspec:P [(match_operand:P 3 "rs6000_tls_symbol_ref" "")]
+            UNSPEC_TLSGD)
    (clobber (reg:SI LR_REGNO))]
   "HAVE_AS_TLS && TARGET_TLS_MARKERS
    && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
   [(set_attr "type" "branch")
    (set_attr "length" "8")])
 
-(define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-        (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
+(define_insn "*tls_gd_call_sysv<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+        (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
              (match_operand 2 "" "g")))
-   (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
-                  UNSPEC_TLSGD)
+   (unspec:P [(match_operand:P 3 "rs6000_tls_symbol_ref" "")]
+            UNSPEC_TLSGD)
    (clobber (reg:SI LR_REGNO))]
   "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
 {
 }
   [(set_attr "type" "branch")])
 
-(define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-        (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
+(define_insn_and_split "tls_ld_aix<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+        (call (mem:SI (match_operand:P 2 "symbol_ref_operand" "s"))
              (match_operand 3 "" "g")))
-   (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
-                  UNSPEC_TLSLD)
+   (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")]
+            UNSPEC_TLSLD)
    (clobber (reg:SI LR_REGNO))]
   "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
 {
 }
   "&& TARGET_TLS_MARKERS"
   [(set (match_dup 0)
-       (unspec:TLSmode [(match_dup 1)]
-                       UNSPEC_TLSLD))
+       (unspec:P [(match_dup 1)]
+                 UNSPEC_TLSLD))
    (parallel [(set (match_dup 0)
-                  (call (mem:TLSmode (match_dup 2))
-                        (match_dup 3)))
-             (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
+                  (call (mem:SI (match_dup 2))
+                        (match_dup 3)))
+             (unspec:P [(const_int 0)] UNSPEC_TLSLD)
              (clobber (reg:SI LR_REGNO))])]
   ""
   [(set_attr "type" "two")
    (set (attr "length")
      (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
-                  (const_int 16)
-                  (const_int 12)))])
+                  (const_int 16)
+                  (const_int 12)))])
 
-(define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-        (call (mem:TLSmode (match_operand:TLSmode 2 "symbol_ref_operand" "s"))
+(define_insn_and_split "tls_ld_sysv<mode>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+        (call (mem:SI (match_operand:P 2 "symbol_ref_operand" "s"))
              (match_operand 3 "" "g")))
-   (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
-                  UNSPEC_TLSLD)
+   (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")]
+            UNSPEC_TLSLD)
    (clobber (reg:SI LR_REGNO))]
   "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4"
 {
 }
   "&& TARGET_TLS_MARKERS"
   [(set (match_dup 0)
-       (unspec:TLSmode [(match_dup 1)]
-                       UNSPEC_TLSLD))
+       (unspec:P [(match_dup 1)]
+                 UNSPEC_TLSLD))
    (parallel [(set (match_dup 0)
-                  (call (mem:TLSmode (match_dup 2))
-                        (match_dup 3)))
-             (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
+                  (call (mem:SI (match_dup 2))
+                        (match_dup 3)))
+             (unspec:P [(const_int 0)] UNSPEC_TLSLD)
              (clobber (reg:SI LR_REGNO))])]
   ""
   [(set_attr "length" "8")])
 
-(define_insn_and_split "*tls_ld<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
-                       UNSPEC_TLSLD))]
+(define_insn_and_split "*tls_ld<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")]
+                 UNSPEC_TLSLD))]
   "HAVE_AS_TLS && TARGET_TLS_MARKERS"
   "addi %0,%1,%&@got@tlsld"
   "&& TARGET_CMODEL != CMODEL_SMALL"
   [(set (match_dup 2)
-       (high:TLSmode
-           (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
+       (high:P
+           (unspec:P [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))
    (set (match_dup 0)
-       (lo_sum:TLSmode (match_dup 2)
-           (unspec:TLSmode [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))]
+       (lo_sum:P (match_dup 2)
+           (unspec:P [(const_int 0) (match_dup 1)] UNSPEC_TLSLD)))]
 {
   operands[2] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
 }
   [(set (attr "length")
      (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
-                  (const_int 8)
-                  (const_int 4)))])
-
-(define_insn "*tls_ld_high<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-     (high:TLSmode
-       (unspec:TLSmode [(const_int 0)
-                       (match_operand:TLSmode 1 "gpc_reg_operand" "b")]
-                      UNSPEC_TLSLD)))]
+                  (const_int 8)
+                  (const_int 4)))])
+
+(define_insn "*tls_ld_high<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+     (high:P
+       (unspec:P [(const_int 0)
+                 (match_operand:P 1 "gpc_reg_operand" "b")]
+                UNSPEC_TLSLD)))]
   "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
   "addis %0,%1,%&@got@tlsld@ha")
 
-(define_insn "*tls_ld_low<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-     (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
-       (unspec:TLSmode [(const_int 0)
-                        (match_operand:TLSmode 2 "gpc_reg_operand" "b")]
-                       UNSPEC_TLSLD)))]
+(define_insn "*tls_ld_low<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+     (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
+       (unspec:P [(const_int 0)
+                 (match_operand:P 2 "gpc_reg_operand" "b")]
+                UNSPEC_TLSLD)))]
   "HAVE_AS_TLS && TARGET_TLS_MARKERS && TARGET_CMODEL != CMODEL_SMALL"
   "addi %0,%1,%&@got@tlsld@l")
 
-(define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-        (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
+(define_insn "*tls_ld_call_aix<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+        (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
              (match_operand 2 "" "g")))
-   (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
+   (unspec:P [(const_int 0)] UNSPEC_TLSLD)
    (clobber (reg:SI LR_REGNO))]
   "HAVE_AS_TLS && TARGET_TLS_MARKERS
    && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
   [(set_attr "type" "branch")
    (set_attr "length" "8")])
 
-(define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-        (call (mem:TLSmode (match_operand:TLSmode 1 "symbol_ref_operand" "s"))
+(define_insn "*tls_ld_call_sysv<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+        (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
              (match_operand 2 "" "g")))
-   (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
+   (unspec:P [(const_int 0)] UNSPEC_TLSLD)
    (clobber (reg:SI LR_REGNO))]
   "HAVE_AS_TLS && DEFAULT_ABI == ABI_V4 && TARGET_TLS_MARKERS"
 {
 }
   [(set_attr "type" "branch")])
 
-(define_insn "tls_dtprel_<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                        (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                       UNSPEC_TLSDTPREL))]
+(define_insn "tls_dtprel_<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                  (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                 UNSPEC_TLSDTPREL))]
   "HAVE_AS_TLS"
   "addi %0,%1,%2@dtprel")
 
-(define_insn "tls_dtprel_ha_<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                        (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                       UNSPEC_TLSDTPRELHA))]
+(define_insn "tls_dtprel_ha_<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                  (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                 UNSPEC_TLSDTPRELHA))]
   "HAVE_AS_TLS"
   "addis %0,%1,%2@dtprel@ha")
 
-(define_insn "tls_dtprel_lo_<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                        (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                       UNSPEC_TLSDTPRELLO))]
+(define_insn "tls_dtprel_lo_<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                  (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                 UNSPEC_TLSDTPRELLO))]
   "HAVE_AS_TLS"
   "addi %0,%1,%2@dtprel@l")
 
-(define_insn_and_split "tls_got_dtprel_<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                        (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                       UNSPEC_TLSGOTDTPREL))]
+(define_insn_and_split "tls_got_dtprel_<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                  (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                 UNSPEC_TLSGOTDTPREL))]
   "HAVE_AS_TLS"
-  "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel(%1)"
+  "<ptrload> %0,%2@got@dtprel(%1)"
   "&& TARGET_CMODEL != CMODEL_SMALL"
   [(set (match_dup 3)
-       (high:TLSmode
-           (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
+       (high:P
+           (unspec:P [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))
    (set (match_dup 0)
-       (lo_sum:TLSmode (match_dup 3)
-           (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
+       (lo_sum:P (match_dup 3)
+           (unspec:P [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTDTPREL)))]
 {
   operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
 }
   [(set (attr "length")
      (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
-                  (const_int 8)
-                  (const_int 4)))])
-
-(define_insn "*tls_got_dtprel_high<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-     (high:TLSmode
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                       (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                      UNSPEC_TLSGOTDTPREL)))]
+                  (const_int 8)
+                  (const_int 4)))])
+
+(define_insn "*tls_got_dtprel_high<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+     (high:P
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                 (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                UNSPEC_TLSGOTDTPREL)))]
   "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
   "addis %0,%1,%2@got@dtprel@ha")
 
-(define_insn "*tls_got_dtprel_low<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
-     (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
-        (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
-                         (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                        UNSPEC_TLSGOTDTPREL)))]
+(define_insn "*tls_got_dtprel_low<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+     (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
+        (unspec:P [(match_operand:P 3 "gpc_reg_operand" "b")
+                   (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                  UNSPEC_TLSGOTDTPREL)))]
   "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
-  "l<TLSmode:tls_insn_suffix> %0,%2@got@dtprel@l(%1)")
+  "<ptrload> %0,%2@got@dtprel@l(%1)")
 
-(define_insn "tls_tprel_<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                        (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                       UNSPEC_TLSTPREL))]
+(define_insn "tls_tprel_<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                  (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                 UNSPEC_TLSTPREL))]
   "HAVE_AS_TLS"
   "addi %0,%1,%2@tprel")
 
-(define_insn "tls_tprel_ha_<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                        (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                       UNSPEC_TLSTPRELHA))]
+(define_insn "tls_tprel_ha_<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                  (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                 UNSPEC_TLSTPRELHA))]
   "HAVE_AS_TLS"
   "addis %0,%1,%2@tprel@ha")
 
-(define_insn "tls_tprel_lo_<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                        (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                       UNSPEC_TLSTPRELLO))]
+(define_insn "tls_tprel_lo_<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                  (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                 UNSPEC_TLSTPRELLO))]
   "HAVE_AS_TLS"
   "addi %0,%1,%2@tprel@l")
 
 ;; "b" output constraint here and on tls_tls input to support linker tls
 ;; optimization.  The linker may edit the instructions emitted by a
 ;; tls_got_tprel/tls_tls pair to addis,addi.
-(define_insn_and_split "tls_got_tprel_<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                        (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                       UNSPEC_TLSGOTTPREL))]
+(define_insn_and_split "tls_got_tprel_<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                  (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                 UNSPEC_TLSGOTTPREL))]
   "HAVE_AS_TLS"
-  "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel(%1)"
+  "<ptrload> %0,%2@got@tprel(%1)"
   "&& TARGET_CMODEL != CMODEL_SMALL"
   [(set (match_dup 3)
-       (high:TLSmode
-           (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
+       (high:P
+           (unspec:P [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))
    (set (match_dup 0)
-       (lo_sum:TLSmode (match_dup 3)
-           (unspec:TLSmode [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))]
+       (lo_sum:P (match_dup 3)
+           (unspec:P [(match_dup 1) (match_dup 2)] UNSPEC_TLSGOTTPREL)))]
 {
   operands[3] = gen_reg_rtx (TARGET_64BIT ? DImode : SImode);
 }
   [(set (attr "length")
      (if_then_else (ne (symbol_ref "TARGET_CMODEL") (symbol_ref "CMODEL_SMALL"))
-                  (const_int 8)
-                  (const_int 4)))])
-
-(define_insn "*tls_got_tprel_high<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=b")
-     (high:TLSmode
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                       (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                      UNSPEC_TLSGOTTPREL)))]
+                  (const_int 8)
+                  (const_int 4)))])
+
+(define_insn "*tls_got_tprel_high<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=b")
+     (high:P
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                 (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                UNSPEC_TLSGOTTPREL)))]
   "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
   "addis %0,%1,%2@got@tprel@ha")
 
-(define_insn "*tls_got_tprel_low<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
-     (lo_sum:TLSmode (match_operand:TLSmode 1 "gpc_reg_operand" "b")
-        (unspec:TLSmode [(match_operand:TLSmode 3 "gpc_reg_operand" "b")
-                         (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                        UNSPEC_TLSGOTTPREL)))]
+(define_insn "*tls_got_tprel_low<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+     (lo_sum:P (match_operand:P 1 "gpc_reg_operand" "b")
+        (unspec:P [(match_operand:P 3 "gpc_reg_operand" "b")
+                   (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                  UNSPEC_TLSGOTTPREL)))]
   "HAVE_AS_TLS && TARGET_CMODEL != CMODEL_SMALL"
-  "l<TLSmode:tls_insn_suffix> %0,%2@got@tprel@l(%1)")
+  "<ptrload> %0,%2@got@tprel@l(%1)")
 
-(define_insn "tls_tls_<TLSmode:tls_abi_suffix>"
-  [(set (match_operand:TLSmode 0 "gpc_reg_operand" "=r")
-       (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")
-                        (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
-                       UNSPEC_TLSTLS))]
+(define_insn "tls_tls_<bits>"
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+       (unspec:P [(match_operand:P 1 "gpc_reg_operand" "b")
+                  (match_operand:P 2 "rs6000_tls_symbol_ref" "")]
+                 UNSPEC_TLSTLS))]
   "TARGET_ELF && HAVE_AS_TLS"
   "add %0,%1,%2@tls")