diff mbox

[x32] PATCH: Use 64bit value in tablejump for x32

Message ID 20110215132807.GA24880@intel.com
State New
Headers show

Commit Message

H.J. Lu Feb. 15, 2011, 1:28 p.m. UTC
Pmode is used in non-PIC tablejump, we have to put 64bit value for
labels with 0 upper 32bits in tablejump for x32.  I checked it in.


H.J.
--
From 1665aa7685af162d127cbd8f2769d6b9683921f2 Mon Sep 17 00:00:00 2001
From: H.J. Lu <hjl.tools@gmail.com>
Date: Mon, 14 Feb 2011 21:06:43 -0800
Subject: [PATCH 1/2] Use 64bit value in tablejump for x32.

---
 gcc/ChangeLog.x32       |    9 +++++++++
 gcc/config/i386/i386.c  |   16 ++++++++++++----
 gcc/config/i386/i386.md |   10 +---------
 3 files changed, 22 insertions(+), 13 deletions(-)
diff mbox

Patch

diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
index 4f073c5..b189b74 100644
--- a/gcc/ChangeLog.x32
+++ b/gcc/ChangeLog.x32
@@ -1,5 +1,14 @@ 
 2011-02-14  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* config/i386/i386.c (ix86_output_addr_vec_elt): Output
+	64bit value for labels for TARGET_X32.
+
+	* config/i386/i386.md (*tablejump_1): Don't disable for
+	TARGET_X32.
+	(*tablejump_1_x32): Removed.
+
+2011-02-14  H.J. Lu  <hongjiu.lu@intel.com>
+
 	PR middle-end/47727
 	* explow.c (convert_memory_address_addr_space): Permute the
 	conversion and addition if one operand is a constant.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 44c1911..98fa75d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -15319,14 +15319,22 @@  ix86_output_addr_vec_elt (FILE *file, int value)
 {
   const char *directive = ASM_LONG;
 
+  if (TARGET_X32)
+    {
+      fprintf (file, "%s%s%d\n", directive, LPREFIX, value);
+      fprintf (file, "%s0\n", directive);
+    }
+  else
+    {
 #ifdef ASM_QUAD
-  if (TARGET_LP64)
-    directive = ASM_QUAD;
+      if (TARGET_LP64)
+	directive = ASM_QUAD;
 #else
-  gcc_assert (!TARGET_64BIT);
+      gcc_assert (!TARGET_64BIT);
 #endif
 
-  fprintf (file, "%s%s%d\n", directive, LPREFIX, value);
+      fprintf (file, "%s%s%d\n", directive, LPREFIX, value);
+    }
 }
 
 void
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index e6be7b8..cef2c19 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -11236,15 +11236,7 @@ 
 (define_insn "*tablejump_1"
   [(set (pc) (match_operand:P 0 "nonimmediate_operand" "rm"))
    (use (label_ref (match_operand 1 "" "")))]
-  "!TARGET_X32"
-  "jmp\t%A0"
-  [(set_attr "type" "ibr")
-   (set_attr "length_immediate" "0")])
-
-(define_insn "*tablejump_1_x32"
-  [(set (pc) (match_operand:P 0 "register_operand" "r"))
-   (use (label_ref (match_operand 1 "" "")))]
-  "TARGET_X32"
+  ""
   "jmp\t%A0"
   [(set_attr "type" "ibr")
    (set_attr "length_immediate" "0")])