From 5821951ca6721283d125491fa1c56322f086ea94 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Thu, 8 Nov 2012 18:21:25 +0000 Subject: [PATCH] gas/ * config/tc-mips.c (mips_ip) <'u'>: Default to BFD_RELOC_LO16. gas/testsuite/ * gas/mips/lui.d: New test. * gas/mips/micromips@lui.d: New test. * gas/mips/lui-1.l: New list test. * gas/mips/lui-2.l: New list test. * gas/mips/lui.s: New test source. * gas/mips/lui-1.s: New test source. * gas/mips/lui-2.s: New test source. * gas/mips/mips.exp: Run the new tests. --- gas/ChangeLog | 4 ++++ gas/config/tc-mips.c | 1 + gas/testsuite/ChangeLog | 11 ++++++++++ gas/testsuite/gas/mips/lui-1.l | 5 +++++ gas/testsuite/gas/mips/lui-1.s | 8 +++++++ gas/testsuite/gas/mips/lui-2.l | 5 +++++ gas/testsuite/gas/mips/lui-2.s | 10 +++++++++ gas/testsuite/gas/mips/lui.d | 25 ++++++++++++++++++++++ gas/testsuite/gas/mips/lui.s | 29 ++++++++++++++++++++++++++ gas/testsuite/gas/mips/micromips@lui.d | 25 ++++++++++++++++++++++ gas/testsuite/gas/mips/mips.exp | 3 +++ 11 files changed, 126 insertions(+) create mode 100644 gas/testsuite/gas/mips/lui-1.l create mode 100644 gas/testsuite/gas/mips/lui-1.s create mode 100644 gas/testsuite/gas/mips/lui-2.l create mode 100644 gas/testsuite/gas/mips/lui-2.s create mode 100644 gas/testsuite/gas/mips/lui.d create mode 100644 gas/testsuite/gas/mips/lui.s create mode 100644 gas/testsuite/gas/mips/micromips@lui.d diff --git a/gas/ChangeLog b/gas/ChangeLog index 1c1dc07670..69e161d4f9 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2012-11-08 Maciej W. Rozycki + + * config/tc-mips.c (mips_ip) <'u'>: Default to BFD_RELOC_LO16. + 2012-11-08 Alan Modra * po/POTFILES.in: Regenerate. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 024b864fe8..0372b7a76b 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -12413,6 +12413,7 @@ mips_ip (char *str, struct mips_cl_insn *ip) continue; case 'u': /* Upper 16 bits. */ + *imm_reloc = BFD_RELOC_LO16; if (my_getSmallExpression (&imm_expr, imm_reloc, s) == 0 && imm_expr.X_op == O_constant && (imm_expr.X_add_number < 0 diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 4399fcb443..b007717ae5 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2012-11-08 Maciej W. Rozycki + + * gas/mips/lui.d: New test. + * gas/mips/micromips@lui.d: New test. + * gas/mips/lui-1.l: New list test. + * gas/mips/lui-2.l: New list test. + * gas/mips/lui.s: New test source. + * gas/mips/lui-1.s: New test source. + * gas/mips/lui-2.s: New test source. + * gas/mips/mips.exp: Run the new tests. + 2012-11-07 David Holsgrove * testsuite/gas/microblaze/special_reg.exp: Add test case. diff --git a/gas/testsuite/gas/mips/lui-1.l b/gas/testsuite/gas/mips/lui-1.l new file mode 100644 index 0000000000..e4362b6079 --- /dev/null +++ b/gas/testsuite/gas/mips/lui-1.l @@ -0,0 +1,5 @@ +.*\.s: Assembler messages: +.*\.s:5: Error: lui expression \((18446744073709551615|4294967295)\) not in range 0\.\.65535 +.*\.s:6: Error: lui expression \(65536\) not in range 0\.\.65535 +.*\.s:7: Error: bignum invalid +.*\.s:8: Error: register value used as expression diff --git a/gas/testsuite/gas/mips/lui-1.s b/gas/testsuite/gas/mips/lui-1.s new file mode 100644 index 0000000000..226b005107 --- /dev/null +++ b/gas/testsuite/gas/mips/lui-1.s @@ -0,0 +1,8 @@ +# Source code used to test error diagnostics with the LUI instruction. + + .text +foo: + lui $2, -1 + lui $2, 65536 + lui $2, 0x10000000000000000 + lui $2, $3 diff --git a/gas/testsuite/gas/mips/lui-2.l b/gas/testsuite/gas/mips/lui-2.l new file mode 100644 index 0000000000..ed97e85846 --- /dev/null +++ b/gas/testsuite/gas/mips/lui-2.l @@ -0,0 +1,5 @@ +.*\.s: Assembler messages: +.*\.s:10: Error: invalid operands \(\*UND\* and \*UND\* sections\) for `/' +.*\.s:7: Error: can't resolve `bar' {\*UND\* section} - `foo' {\.text section} +.*\.s:8: Error: can't resolve `baz' {\*UND\* section} - `bar' {\*UND\* section} +.*\.s:9: Error: can't resolve `\.text' {\.text section} - `baz' {\*UND\* section} diff --git a/gas/testsuite/gas/mips/lui-2.s b/gas/testsuite/gas/mips/lui-2.s new file mode 100644 index 0000000000..3b52245f63 --- /dev/null +++ b/gas/testsuite/gas/mips/lui-2.s @@ -0,0 +1,10 @@ +# Source code used to test error diagnostics with the LUI instruction. +# These need to be separate from lui-1.s as they are reported at a later +# stage in assembly. + + .text +foo: + lui $2, bar - foo + lui $2, baz - bar + lui $2, foo - baz + lui $2, bar / baz diff --git a/gas/testsuite/gas/mips/lui.d b/gas/testsuite/gas/mips/lui.d new file mode 100644 index 0000000000..e00095d95b --- /dev/null +++ b/gas/testsuite/gas/mips/lui.d @@ -0,0 +1,25 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS lui +#as: -32 +#source: lui.s + +.*: +file format .*mips.* + +Disassembly of section \.text: +[0-9a-f]+ <[^>]*> 3c020000 lui v0,0x0 +[0-9a-f]+ <[^>]*> 3c02ffff lui v0,0xffff +[0-9a-f]+ <[^>]*> 3c020008 lui v0,0x8 +[0-9a-f]+ <[^>]*> 3c020008 lui v0,0x8 +[0-9a-f]+ <[^>]*> 3c02000c lui v0,0xc +[0-9a-f]+ <[^>]*> 3c02000c lui v0,0xc +[0-9a-f]+ <[^>]*> 3c02000c lui v0,0xc +[ ]*[0-9a-f]+: (R_MIPS_LO16|REFLO) \.text +[0-9a-f]+ <[^>]*> 3c020000 lui v0,0x0 +[ ]*[0-9a-f]+: (R_MIPS_LO16|REFLO) ext +[0-9a-f]+ <[^>]*> 3c020020 lui v0,0x20 +[ ]*[0-9a-f]+: (R_MIPS_LO16|REFLO) \.text +[0-9a-f]+ <[^>]*> 3c020028 lui v0,0x28 +[ ]*[0-9a-f]+: (R_MIPS_LO16|REFLO) \.text +[0-9a-f]+ <[^>]*> 3c020000 lui v0,0x0 +[0-9a-f]+ <[^>]*> 3c02ffff lui v0,0xffff + \.\.\. diff --git a/gas/testsuite/gas/mips/lui.s b/gas/testsuite/gas/mips/lui.s new file mode 100644 index 0000000000..3988ff89d2 --- /dev/null +++ b/gas/testsuite/gas/mips/lui.s @@ -0,0 +1,29 @@ +# Source code used to test the LUI instruction with some expressions. + + .text +foo: +0: + lui $2, 0 + lui $2, 65535 +1: + lui $2, 1b - 0b +bar: + lui $2, 2f - 1b +2: + lui $2, bar - foo + lui $2, baz - bar +baz: + lui $2, bar + lui $2, ext +3: + lui $2, 3b + lui $2, 4f +4: + lui $2, min + 1 + lui $2, max - 1 + .eqv min, -1 + .eqv max, 65536 + +# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... + .align 4, 0 + .space 16 diff --git a/gas/testsuite/gas/mips/micromips@lui.d b/gas/testsuite/gas/mips/micromips@lui.d new file mode 100644 index 0000000000..882bff0d36 --- /dev/null +++ b/gas/testsuite/gas/mips/micromips@lui.d @@ -0,0 +1,25 @@ +#objdump: -dr --prefix-addresses --show-raw-insn +#name: MIPS lui +#as: -32 +#source: lui.s + +.*: +file format .*mips.* + +Disassembly of section \.text: +[0-9a-f]+ <[^>]*> 41a2 0000 lui v0,0x0 +[0-9a-f]+ <[^>]*> 41a2 ffff lui v0,0xffff +[0-9a-f]+ <[^>]*> 41a2 0008 lui v0,0x8 +[0-9a-f]+ <[^>]*> 41a2 0008 lui v0,0x8 +[0-9a-f]+ <[^>]*> 41a2 000c lui v0,0xc +[0-9a-f]+ <[^>]*> 41a2 000c lui v0,0xc +[0-9a-f]+ <[^>]*> 41a2 000d lui v0,0xd +[ ]*[0-9a-f]+: R_MICROMIPS_LO16 \.text +[0-9a-f]+ <[^>]*> 41a2 0000 lui v0,0x0 +[ ]*[0-9a-f]+: R_MICROMIPS_LO16 ext +[0-9a-f]+ <[^>]*> 41a2 0021 lui v0,0x21 +[ ]*[0-9a-f]+: R_MICROMIPS_LO16 \.text +[0-9a-f]+ <[^>]*> 41a2 0029 lui v0,0x29 +[ ]*[0-9a-f]+: R_MICROMIPS_LO16 \.text +[0-9a-f]+ <[^>]*> 41a2 0000 lui v0,0x0 +[0-9a-f]+ <[^>]*> 41a2 ffff lui v0,0xffff + \.\.\. diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 6a452d5cdd..2ffbd4b099 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -1128,4 +1128,7 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test_arches "hilo-diff-eb-n64" [mips_arch_list_matching mips3] run_dump_test_arches "hilo-diff-el-n64" [mips_arch_list_matching mips3] } + run_dump_test_arches "lui" [mips_arch_list_matching mips1] + run_list_test_arches "lui-1" "-32" [mips_arch_list_matching mips1] + run_list_test_arches "lui-2" "-32" [mips_arch_list_matching mips1] }