aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2012-11-08 18:21:25 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2012-11-08 18:21:25 +0000
commit5821951ca6721283d125491fa1c56322f086ea94 (patch)
tree180c2731b71d66cb7d327cf366c7a78e99304533 /gas
parent4574b35a66f832ce0cc2204431834fbe73ab5886 (diff)
downloadgdb-5821951ca6721283d125491fa1c56322f086ea94.zip
gdb-5821951ca6721283d125491fa1c56322f086ea94.tar.gz
gdb-5821951ca6721283d125491fa1c56322f086ea94.tar.bz2
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.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/config/tc-mips.c1
-rw-r--r--gas/testsuite/ChangeLog11
-rw-r--r--gas/testsuite/gas/mips/lui-1.l5
-rw-r--r--gas/testsuite/gas/mips/lui-1.s8
-rw-r--r--gas/testsuite/gas/mips/lui-2.l5
-rw-r--r--gas/testsuite/gas/mips/lui-2.s10
-rw-r--r--gas/testsuite/gas/mips/lui.d25
-rw-r--r--gas/testsuite/gas/mips/lui.s29
-rw-r--r--gas/testsuite/gas/mips/micromips@lui.d25
-rw-r--r--gas/testsuite/gas/mips/mips.exp3
11 files changed, 126 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 1c1dc07..69e161d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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.
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 024b864..0372b7a 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 4399fcb..b007717 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -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.
diff --git a/gas/testsuite/gas/mips/lui-1.l b/gas/testsuite/gas/mips/lui-1.l
new file mode 100644
index 0000000..e4362b6
--- /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 0000000..226b005
--- /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 0000000..ed97e85
--- /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 0000000..3b52245
--- /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 0000000..e00095d
--- /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 0000000..3988ff8
--- /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 0000000..882bff0
--- /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 6a452d5..2ffbd4b 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]
}