Patchwork [x32] PATCH: PR target/47715: Remove DI on operand 1 in tls_global_dynamic_64 patterns

login
register
mail settings
Submitter H.J. Lu
Date Feb. 13, 2011, 1:15 a.m.
Message ID <20110213011538.GA30157@intel.com>
Download mbox | patch
Permalink /patch/82966/
State New
Headers show

Comments

H.J. Lu - Feb. 13, 2011, 1:15 a.m.
Hi,

x32 may generate both SI/DI symbol refereces in tls_global_dynamic_64
patterns.  I checked in this patch to remove DI on operand 1.

H.J.
---
From f77aa55108b7b16106e1fea51b175f70b73d5ab9 Mon Sep 17 00:00:00 2001
From: H.J. Lu <hjl.tools@gmail.com>
Date: Sat, 12 Feb 2011 17:10:24 -0800
Subject: [PATCH 2/2] Remove DI on operand 1 in tls_global_dynamic_64 patterns.

---
 gcc/ChangeLog.x32                         |    7 +++++++
 gcc/config/i386/i386.md                   |    4 ++--
 gcc/testsuite/ChangeLog.x32               |    6 ++++++
 gcc/testsuite/gcc.target/i386/pr47715-1.c |   10 ++++++++++
 gcc/testsuite/gcc.target/i386/pr47715-2.c |    9 +++++++++
 5 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr47715-1.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr47715-2.c

Patch

diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
index 63b2526..4160ca9 100644
--- a/gcc/ChangeLog.x32
+++ b/gcc/ChangeLog.x32
@@ -1,5 +1,12 @@ 
 2011-02-12  H.J. Lu  <hongjiu.lu@intel.com>
 
+	PR target/47715
+	* config/i386/i386.md (*tls_global_dynamic_64): Remove DI on
+	operand 1.
+	(tls_global_dynamic_64): Likewise.
+
+2011-02-12  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* config/i386/i386.md (A): Moved.
 
 2011-02-12  H.J. Lu  <hongjiu.lu@intel.com>
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 09e90bc..e6be7b8 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -12612,7 +12612,7 @@ 
   [(set (match_operand:DI 0 "register_operand" "=a")
 	(call:DI (mem:QI (match_operand:DI 2 "call_insn_operand" ""))
 		 (match_operand:DI 3 "" "")))
-   (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")]
+   (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
 	      UNSPEC_TLS_GD)]
   "TARGET_64BIT"
   { return ASM_BYTE "0x66\n\tlea{q}\t{%a1@tlsgd(%%rip), %%rdi|rdi, %a1@tlsgd[rip]}\n" ASM_SHORT "0x6666\n\trex64\n\tcall\t%P2"; }
@@ -12622,7 +12622,7 @@ 
 (define_expand "tls_global_dynamic_64"
   [(parallel [(set (match_operand:DI 0 "register_operand" "")
 		   (call:DI (mem:QI (match_dup 2)) (const_int 0)))
-	      (unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")]
+	      (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
 			 UNSPEC_TLS_GD)])]
   ""
 {
diff --git a/gcc/testsuite/ChangeLog.x32 b/gcc/testsuite/ChangeLog.x32
index f87c9f9..fd4f856 100644
--- a/gcc/testsuite/ChangeLog.x32
+++ b/gcc/testsuite/ChangeLog.x32
@@ -1,3 +1,9 @@ 
+2011-02-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR target/47715
+	* gcc.target/i386/pr47715-1.c: New.
+	* gcc.target/i386/pr47715-2.c: Likewise. 
+
 2011-02-08  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR middle-end/47383
diff --git a/gcc/testsuite/gcc.target/i386/pr47715-1.c b/gcc/testsuite/gcc.target/i386/pr47715-1.c
new file mode 100644
index 0000000..ec27cd6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr47715-1.c
@@ -0,0 +1,10 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-O2 -fPIC" } */
+
+extern __thread int h_errno;
+int *
+__h_errno_location (void)
+{
+  return &h_errno;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr47715-2.c b/gcc/testsuite/gcc.target/i386/pr47715-2.c
new file mode 100644
index 0000000..ec0368a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr47715-2.c
@@ -0,0 +1,9 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-O2 -fPIC" } */
+
+extern __thread int *__libc_resp;
+int
+__res_init(void) {
+  return *__libc_resp;
+}