diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 9d9e29d12eb..3f9830bc743 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -9438,18 +9438,17 @@ (define_peephole2
 ;; 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<P:tls_abi_suffix>"
+  [(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)"
 {
@@ -9462,28 +9461,28 @@ (define_insn_and_split "tls_gd_aix<TLSmode:tls_abi_suffix>"
 }
   "&& 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<P:tls_sysv_suffix>"
+  [(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"
 {
@@ -9492,64 +9491,64 @@ (define_insn_and_split "tls_gd_sysv<TLSmode:tls_sysv_suffix>"
 }
   "&& 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<P:tls_abi_suffix>"
+  [(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<P:tls_abi_suffix>"
+  [(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<P:tls_abi_suffix>"
+  [(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<P:tls_abi_suffix>"
+  [(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)"
@@ -9559,12 +9558,12 @@ (define_insn "*tls_gd_call_aix<TLSmode:tls_abi_suffix>"
   [(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<P:tls_abi_suffix>"
+  [(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"
 {
@@ -9572,12 +9571,12 @@ (define_insn "*tls_gd_call_sysv<TLSmode:tls_abi_suffix>"
 }
   [(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<P:tls_abi_suffix>"
+  [(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)"
 {
@@ -9590,26 +9589,26 @@ (define_insn_and_split "tls_ld_aix<TLSmode:tls_abi_suffix>"
 }
   "&& 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<P:tls_sysv_suffix>"
+  [(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"
 {
@@ -9618,60 +9617,60 @@ (define_insn_and_split "tls_ld_sysv<TLSmode:tls_sysv_suffix>"
 }
   "&& 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<P:tls_abi_suffix>"
+  [(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<P:tls_abi_suffix>"
+  [(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<P:tls_abi_suffix>"
+  [(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<P:tls_abi_suffix>"
+  [(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)"
@@ -9681,11 +9680,11 @@ (define_insn "*tls_ld_call_aix<TLSmode:tls_abi_suffix>"
   [(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<P:tls_abi_suffix>"
+  [(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"
 {
@@ -9693,142 +9692,142 @@ (define_insn "*tls_ld_call_sysv<TLSmode:tls_abi_suffix>"
 }
   [(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_<P:tls_abi_suffix>"
+  [(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_<P:tls_abi_suffix>"
+  [(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_<P:tls_abi_suffix>"
+  [(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_<P:tls_abi_suffix>"
+  [(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)"
+  "l<P:tls_insn_suffix> %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<P:tls_abi_suffix>"
+  [(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<P:tls_abi_suffix>"
+  [(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)")
+  "l<P:tls_insn_suffix> %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_<P:tls_abi_suffix>"
+  [(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_<P:tls_abi_suffix>"
+  [(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_<P:tls_abi_suffix>"
+  [(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_<P:tls_abi_suffix>"
+  [(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)"
+  "l<P:tls_insn_suffix> %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<P:tls_abi_suffix>"
+  [(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<P:tls_abi_suffix>"
+  [(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)")
+  "l<P:tls_insn_suffix> %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_<P:tls_abi_suffix>"
+  [(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")
 
