diff mbox series

[3/6,RS6000] Replace TLSmode with P, and correct tls call mems

Message ID 20181113125008.GS29784@bubble.grove.modra.org
State New
Headers show
Series [1/6,RS6000] rs6000_call_template for external call insn assembly output | expand

Commit Message

Alan Modra Nov. 13, 2018, 12:50 p.m. UTC
Version 2.

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
	iterators.  Replace with bits, mode and ptrload respectively.

Comments

Segher Boessenkool Nov. 20, 2018, 5:10 p.m. UTC | #1
On Tue, Nov 13, 2018 at 11:20:08PM +1030, Alan Modra wrote:
> 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
> 	iterators.  Replace with bits, mode and ptrload respectively.

(mode attributes, not iterators, in that last line)

> +(define_insn_and_split "tls_gd_aix<P:bits>"

Instead of <P:bits> you can just say <bits>, because P is the only (mode)
iterator used here.  Similar throughout the patch.

Okay for trunk (with that change if you can easily make it).  Thanks!


Segher
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index fe904b1966b..793a0a9d840 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -9436,19 +9436,13 @@  (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: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)"
 {
@@ -9461,28 +9455,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: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"
 {
@@ -9491,64 +9485,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: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<P: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<P: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<P: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)"
@@ -9558,12 +9552,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: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"
 {
@@ -9571,12 +9565,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: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)"
 {
@@ -9589,26 +9583,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: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"
 {
@@ -9617,60 +9611,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: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<P: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<P: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<P: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)"
@@ -9680,11 +9674,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: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"
 {
@@ -9692,142 +9686,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: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_<P: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_<P: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_<P: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)"
+  "<P: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<P: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<P: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)")
+  "<P: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_<P: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_<P: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_<P: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_<P: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)"
+  "<P: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<P: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<P: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)")
+  "<P: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_<P: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")