diff mbox

[v2,03/13] i386: Handle address spaces in movabs patterns

Message ID 1445376433-14658-4-git-send-email-rth@redhat.com
State New
Headers show

Commit Message

Richard Henderson Oct. 20, 2015, 9:27 p.m. UTC
---
 gcc/config/i386/i386.md | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index d0c0d23..ccb672d 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -2595,9 +2595,19 @@ 
   [(set (mem:SWI1248x (match_operand:DI 0 "x86_64_movabs_operand" "i,r"))
 	(match_operand:SWI1248x 1 "nonmemory_operand" "a,r<i>"))]
   "TARGET_LP64 && ix86_check_movabs (insn, 0)"
-  "@
-   movabs{<imodesuffix>}\t{%1, %P0|[%P0], %1}
-   mov{<imodesuffix>}\t{%1, %a0|<iptrsize> PTR %a0, %1}"
+{
+  /* Recover the full memory rtx.  */
+  operands[0] = SET_DEST (PATTERN (insn));
+  switch (which_alternative)
+    {
+    case 0:
+      return "movabs{<imodesuffix>}\t{%1, %0|%0, %1}";
+    case 1:
+      return "mov{<imodesuffix>}\t{%1, %0|%0, %1}";
+    default:
+      gcc_unreachable ();
+    }
+}
   [(set_attr "type" "imov")
    (set_attr "modrm" "0,*")
    (set_attr "length_address" "8,0")
@@ -2609,9 +2619,19 @@ 
   [(set (match_operand:SWI1248x 0 "register_operand" "=a,r")
         (mem:SWI1248x (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
   "TARGET_LP64 && ix86_check_movabs (insn, 1)"
-  "@
-   movabs{<imodesuffix>}\t{%P1, %0|%0, [%P1]}
-   mov{<imodesuffix>}\t{%a1, %0|%0, <iptrsize> PTR %a1}"
+{
+  /* Recover the full memory rtx.  */
+  operands[1] = SET_SRC (PATTERN (insn));
+  switch (which_alternative)
+    {
+    case 0:
+      return "movabs{<imodesuffix>}\t{%1, %0|%0, %1}";
+    case 1:
+      return "mov{<imodesuffix>}\t{%1, %0|%0, %1}";
+    default:
+      gcc_unreachable ();
+    }
+}
   [(set_attr "type" "imov")
    (set_attr "modrm" "0,*")
    (set_attr "length_address" "8,0")