* 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.
This commit is contained in:
Maciej W. Rozycki 2012-11-08 18:21:25 +00:00
parent 4574b35a66
commit 5821951ca6
11 changed files with 126 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2012-11-08 Maciej W. Rozycki <macro@codesourcery.com>
* config/tc-mips.c (mips_ip) <'u'>: Default to BFD_RELOC_LO16.
2012-11-08 Alan Modra <amodra@gmail.com>
* po/POTFILES.in: Regenerate.

View file

@ -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

View file

@ -1,3 +1,14 @@
2012-11-08 Maciej W. Rozycki <macro@codesourcery.com>
* 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 <david.holsgrove@xilinx.com>
* testsuite/gas/microblaze/special_reg.exp: Add test case.

View file

@ -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

View file

@ -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

View file

@ -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}

View file

@ -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

View file

@ -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
\.\.\.

View file

@ -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

View file

@ -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
\.\.\.

View file

@ -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]
}