AArch64 MOVK fix to operand 2
authorIan Bolton <ian.bolton@arm.com>
Fri, 22 Mar 2013 12:07:20 +0000 (12:07 +0000)
committerIan Bolton <ibolton@gcc.gnu.org>
Fri, 22 Mar 2013 12:07:20 +0000 (12:07 +0000)
From-SVN: r196958

gcc/ChangeLog
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/movk.c [new file with mode: 0644]

index d4ba470527564e4b131eeda7bec104b0486d7173..448db4f374a2178aeb0af104be17b450e6683b78 100644 (file)
@@ -1,3 +1,10 @@
+2013-03-22  Ian Bolton  <ian.bolton@arm.com>
+
+       * config/aarch64/aarch64.c (aarch64_print_operand): New
+       format specifier for printing a constant in hex.
+       * config/aarch64/aarch64.md (insv_imm<mode>): Use the X
+       format specifier for printing second operand.
+
 2013-03-22  Richard Biener  <rguenther@suse.de>
 
        * tree-ssa-loop-im.c (memory_references): Add refs_stored_in_loop
index 43af6a4508d094cf18251febfa51cbd508fe6cc0..343586e28c8ed246793bf089047fc03dd0277cf0 100644 (file)
@@ -3364,6 +3364,16 @@ aarch64_print_operand (FILE *f, rtx x, char code)
       asm_fprintf (f, "v%d", REGNO (x) - V0_REGNUM + (code - 'S'));
       break;
 
+    case 'X':
+      /* Print integer constant in hex.  */
+      if (GET_CODE (x) != CONST_INT)
+       {
+         output_operand_lossage ("invalid operand for '%%%c'", code);
+         return;
+       }
+      asm_fprintf (f, "0x%x", UINTVAL (x));
+      break;
+
     case 'w':
     case 'x':
       /* Print a general register name or the zero register (32-bit or
index c99e188a7b5e47fb8e3b36ec66a5fbc786a9d025..c28f4a013dcfd4c0b50c20b5571607a0d1aec0c5 100644 (file)
        (match_operand:GPI 2 "const_int_operand" "n"))]
   "INTVAL (operands[1]) < GET_MODE_BITSIZE (<MODE>mode)
    && INTVAL (operands[1]) % 16 == 0
-   && INTVAL (operands[2]) <= 0xffff"
-  "movk\\t%<w>0, %2, lsl %1"
+   && UINTVAL (operands[2]) <= 0xffff"
+  "movk\\t%<w>0, %X2, lsl %1"
   [(set_attr "v8type" "movk")
    (set_attr "mode" "<MODE>")]
 )
index fc3ee606f44d761a8d7435965a395903ef32a416..5c07546bd5588a00b64a8914d822e62c227b23f0 100644 (file)
@@ -1,3 +1,7 @@
+2013-03-22  Ian Bolton  <ian.bolton@arm.com>
+
+       * gcc.target/aarch64/movk.c: New test.
+
 2013-03-21  Marc Glisse  <marc.glisse@inria.fr>
 
        * g++.dg/ext/vector21.C: New testcase.
diff --git a/gcc/testsuite/gcc.target/aarch64/movk.c b/gcc/testsuite/gcc.target/aarch64/movk.c
new file mode 100644 (file)
index 0000000..e4b2209
--- /dev/null
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-options "-O2 --save-temps -fno-inline" } */
+
+extern void abort (void);
+
+long long int
+dummy_number_generator ()
+{
+  /* { dg-final { scan-assembler "movk\tx\[0-9\]+, 0xefff, lsl 16" } } */
+  /* { dg-final { scan-assembler "movk\tx\[0-9\]+, 0xc4cc, lsl 32" } } */
+  /* { dg-final { scan-assembler "movk\tx\[0-9\]+, 0xfffe, lsl 48" } } */
+  return -346565474575675;
+}
+
+int
+main (void)
+{
+
+  long long int num = dummy_number_generator ();
+  if (num > 0)
+    abort ();
+
+  /* { dg-final { scan-assembler "movk\tx\[0-9\]+, 0x4667, lsl 16" } } */
+  /* { dg-final { scan-assembler "movk\tx\[0-9\]+, 0x7a3d, lsl 32" } } */
+  if (num / 69313094915135 != -5)
+    abort ();
+
+  return 0;
+}
+
+/* { dg-final { cleanup-saved-temps } } */