From: Ian Bolton Date: Fri, 22 Mar 2013 12:07:20 +0000 (+0000) Subject: AArch64 MOVK fix to operand 2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a05c0ddfb270408a9eda9572dbfd83b1767570f3;p=gcc.git AArch64 MOVK fix to operand 2 From-SVN: r196958 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d4ba4705275..448db4f374a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-03-22 Ian Bolton + + * config/aarch64/aarch64.c (aarch64_print_operand): New + format specifier for printing a constant in hex. + * config/aarch64/aarch64.md (insv_imm): Use the X + format specifier for printing second operand. + 2013-03-22 Richard Biener * tree-ssa-loop-im.c (memory_references): Add refs_stored_in_loop diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 43af6a4508d..343586e28c8 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -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 diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index c99e188a7b5..c28f4a013dc 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -844,8 +844,8 @@ (match_operand:GPI 2 "const_int_operand" "n"))] "INTVAL (operands[1]) < GET_MODE_BITSIZE (mode) && INTVAL (operands[1]) % 16 == 0 - && INTVAL (operands[2]) <= 0xffff" - "movk\\t%0, %2, lsl %1" + && UINTVAL (operands[2]) <= 0xffff" + "movk\\t%0, %X2, lsl %1" [(set_attr "v8type" "movk") (set_attr "mode" "")] ) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fc3ee606f44..5c07546bd55 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-03-22 Ian Bolton + + * gcc.target/aarch64/movk.c: New test. + 2013-03-21 Marc Glisse * 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 index 00000000000..e4b22098c44 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/movk.c @@ -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 } } */