public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [AArch64] Simplify TLS pattern by hardcoding relocation modifiers into pattern
@ 2015-09-10 11:46 Jiong Wang
  2015-12-16 15:26 ` [Ping]Re: " Jiong Wang
  2015-12-17 11:44 ` Marcus Shawcroft
  0 siblings, 2 replies; 4+ messages in thread
From: Jiong Wang @ 2015-09-10 11:46 UTC (permalink / raw)
  To: gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 928 bytes --]


TLS instruction sequences are always with fixed format, there is no need
to use operand modifier, we can hardcode the relocation modifiers into
instruction pattern, all those redundant checks in aarch64_print_operand
can be removed.

OK for trunk?

2015-09-10  Jiong Wang  <jiong.wang@arm.com>

gcc/
  * config/aarch64/aarch64.md (ldr_got_tiny): Hardcode relocation
  modifers.
  (tlsgd_small): Likewise.
  (tlsgd_tiny): Likewise.
  (tlsie_small_<mode>): Likewise.
  (tlsie_small_sidi): Likewise.
  (tlsie_tiny_<mode>): Likewise.
  (tlsie_tiny_sidi): Likewise.
  (tlsle12_<mode>): Likewise.
  (tlsle24_<mode>): Likewise.
  (tlsdesc_small_<mode>): Likewise.
  (tlsdesc_small_pseudo_<mode>): Likewise.
  (tlsdesc_tiny_<mode>): Likewise.
  (tlsdesc_tiny_pseudo_<mode>): Likewise.
  * config/aarch64/aarch64.c (aarch64_print_operand): Delete useless
  check on 'A', 'L', 'G'.
  
-- 
Regards,
Jiong


[-- Attachment #2: 3.patch --]
[-- Type: text/x-diff, Size: 5582 bytes --]

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 5ba0215..5945d9c 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -4640,23 +4640,6 @@ aarch64_print_operand (FILE *f, rtx x, char code)
 	  asm_fprintf (asm_out_file, ":tlsgd:");
 	  break;

-	case SYMBOL_TINY_TLSDESC:
-	case SYMBOL_SMALL_TLSDESC:
-	  asm_fprintf (asm_out_file, ":tlsdesc:");
-	  break;
-
-	case SYMBOL_SMALL_TLSIE:
-	  asm_fprintf (asm_out_file, ":gottprel:");
-	  break;
-
-	case SYMBOL_TLSLE24:
-	  asm_fprintf (asm_out_file, ":tprel:");
-	  break;
-
-	case SYMBOL_TINY_GOT:
-	  gcc_unreachable ();
-	  break;
-
 	default:
 	  break;
 	}
@@ -4666,38 +4649,9 @@ aarch64_print_operand (FILE *f, rtx x, char code)
     case 'L':
       switch (aarch64_classify_symbolic_expression (x))
 	{
-	case SYMBOL_SMALL_GOT_4G:
-	  asm_fprintf (asm_out_file, ":lo12:");
-	  break;
-
 	case SYMBOL_SMALL_TLSGD:
 	  asm_fprintf (asm_out_file, ":tlsgd_lo12:");
 	  break;
-
-	case SYMBOL_SMALL_TLSDESC:
-	  asm_fprintf (asm_out_file, ":tlsdesc_lo12:");
-	  break;
-
-	case SYMBOL_SMALL_TLSIE:
-	  asm_fprintf (asm_out_file, ":gottprel_lo12:");
-	  break;
-
-	case SYMBOL_TLSLE12:
-	  asm_fprintf (asm_out_file, ":tprel_lo12:");
-	  break;
-
-	case SYMBOL_TLSLE24:
-	  asm_fprintf (asm_out_file, ":tprel_lo12_nc:");
-	  break;
-
-	case SYMBOL_TINY_GOT:
-	  asm_fprintf (asm_out_file, ":got:");
-	  break;
-
-	case SYMBOL_TINY_TLSIE:
-	  asm_fprintf (asm_out_file, ":gottprel:");
-	  break;
-
 	default:
 	  break;
 	}
@@ -4705,15 +4659,6 @@ aarch64_print_operand (FILE *f, rtx x, char code)
       break;

     case 'G':
-
-      switch (aarch64_classify_symbolic_expression (x))
-	{
-	case SYMBOL_TLSLE24:
-	  asm_fprintf (asm_out_file, ":tprel_hi12:");
-	  break;
-	default:
-	  break;
-	}
       output_addr_const (asm_out_file, x);
       break;

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 4a6bf2d..b808f84 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -4529,7 +4529,7 @@
 	(unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "S")]
 		   UNSPEC_GOTTINYPIC))]
   ""
-  "ldr\\t%0, %L1"
+  "ldr\\t%0, :got:%1"
   [(set_attr "type" "load1")]
 )

@@ -4571,7 +4571,7 @@
         (unspec:PTR [(match_operand 1 "aarch64_tls_ie_symref" "S")]
 		   UNSPEC_GOTSMALLTLS))]
   ""
-  "adrp\\t%0, %A1\;ldr\\t%<w>0, [%0, #%L1]"
+  "adrp\\t%0, :gottprel:%1\;ldr\\t%<w>0, [%0, #:gottprel_lo12:%1]"
   [(set_attr "type" "load1")
    (set_attr "length" "8")]
 )
@@ -4582,7 +4582,7 @@
           (unspec:SI [(match_operand 1 "aarch64_tls_ie_symref" "S")]
 		      UNSPEC_GOTSMALLTLS)))]
   ""
-  "adrp\\t%0, %A1\;ldr\\t%w0, [%0, #%L1]"
+  "adrp\\t%0, :gottprel:%1\;ldr\\t%w0, [%0, #:gottprel_lo12:%1]"
   [(set_attr "type" "load1")
    (set_attr "length" "8")]
 )
@@ -4593,7 +4593,7 @@
 		     (match_operand:PTR 2 "register_operand" "r")]
 		   UNSPEC_GOTTINYTLS))]
   ""
-  "ldr\\t%<w>0, %L1\;add\\t%<w>0, %<w>0, %<w>2"
+  "ldr\\t%<w>0, :gottprel:%1\;add\\t%<w>0, %<w>0, %<w>2"
   [(set_attr "type" "multiple")
    (set_attr "length" "8")]
 )
@@ -4606,7 +4606,7 @@
 		      ]
 		      UNSPEC_GOTTINYTLS)))]
   ""
-  "ldr\\t%w0, %L1\;add\\t%<w>0, %<w>0, %<w>2"
+  "ldr\\t%w0, :gottprel:%1\;add\\t%<w>0, %<w>0, %<w>2"
   [(set_attr "type" "multiple")
    (set_attr "length" "8")]
 )
@@ -4617,7 +4617,7 @@
 		   (match_operand 2 "aarch64_tls_le_symref" "S")]
 		   UNSPEC_TLSLE12))]
   ""
-  "add\\t%<w>0, %<w>1, #%L2";
+  "add\\t%<w>0, %<w>1, #:tprel_lo12:%2";
   [(set_attr "type" "alu_sreg")
    (set_attr "length" "4")]
 )
@@ -4628,7 +4628,7 @@
 		   (match_operand 2 "aarch64_tls_le_symref" "S")]
 		   UNSPEC_TLSLE24))]
   ""
-  "add\\t%<w>0, %<w>1, #%G2, lsl #12\;add\\t%<w>0, %<w>0, #%L2"
+  "add\\t%<w>0, %<w>1, #:tprel_hi12:%2, lsl #12\;add\\t%<w>0, %<w>0, #:tprel_lo12_nc:%2"
   [(set_attr "type" "multiple")
    (set_attr "length" "8")]
 )
@@ -4661,7 +4661,7 @@
    (clobber (reg:CC CC_REGNUM))
    (clobber (match_scratch:DI 1 "=r"))]
   "TARGET_TLS_DESC"
-  "adrp\\tx0, %A0\;ldr\\t%<w>1, [x0, #%L0]\;add\\t<w>0, <w>0, %L0\;.tlsdesccall\\t%0\;blr\\t%1"
+  "adrp\\tx0, :tlsdesc:%0\;ldr\\t%<w>1, [x0, #:tlsdesc_lo12:%0]\;add\\t<w>0, <w>0, :tlsdesc_lo12:%0\;.tlsdesccall\\t%0\;blr\\t%1"
   [(set_attr "type" "call")
    (set_attr "length" "16")])

@@ -4680,7 +4680,7 @@
    (clobber (reg:CC CC_REGNUM))
    (clobber (match_scratch:DI 2 "=r"))]
   "TARGET_TLS_DESC"
-  "adrp\\t<w>0, %A1\;ldr\\t%<w>2, [%<w>0, #%L1]\;add\\t%<w>0, %<w>0, %L1\;.tlsdesccall\\t%1\;blr\\t%2"
+  "adrp\\t<w>0, :tlsdesc:%1\;ldr\\t%<w>2, [%<w>0, #:tlsdesc_lo12:%1]\;add\\t%<w>0, %<w>0, :tlsdesc_lo12:%1\;.tlsdesccall\\t%1\;blr\\t%2"
   [(set_attr "type" "call")
    (set_attr "length" "16")])

@@ -4692,7 +4692,7 @@
    (clobber (reg:CC CC_REGNUM))
    (clobber (match_scratch:DI 1 "=r"))]
   "TARGET_TLS_DESC"
-  "ldr\t%<w>1, #%A0;adr\t<w>0, %A0;.tlsdesccall\t%0;blr\t%1"
+  "ldr\t%<w>1, #:tlsdesc:%0;adr\t<w>0, :tlsdesc:%0;.tlsdesccall\t%0;blr\t%1"
   [(set_attr "type" "multiple")
    (set_attr "length" "12")])

@@ -4704,7 +4704,7 @@
    (clobber (reg:CC CC_REGNUM))
    (clobber (match_scratch:DI 2 "=r"))]
   "TARGET_TLS_DESC"
-  "ldr\t%<w>2, #%A1;adr\t%<w>0, %A1;.tlsdesccall\t%1;blr\t%2"
+  "ldr\t%<w>2, #:tlsdesc:%1;adr\t%<w>0, :tlsdesc:%1;.tlsdesccall\t%1;blr\t%2"
   [(set_attr "type" "multiple")
    (set_attr "length" "16")])


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-18  9:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-10 11:46 [AArch64] Simplify TLS pattern by hardcoding relocation modifiers into pattern Jiong Wang
2015-12-16 15:26 ` [Ping]Re: " Jiong Wang
2015-12-17 11:44 ` Marcus Shawcroft
2015-12-18  9:45   ` Jiong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).