gas/
authorMaciej W. Rozycki <macro@linux-mips.org>
Thu, 8 Nov 2012 18:21:25 +0000 (18:21 +0000)
committerMaciej W. Rozycki <macro@linux-mips.org>
Thu, 8 Nov 2012 18:21:25 +0000 (18:21 +0000)
* 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
gas/config/tc-mips.c
gas/testsuite/ChangeLog
gas/testsuite/gas/mips/lui-1.l [new file with mode: 0644]
gas/testsuite/gas/mips/lui-1.s [new file with mode: 0644]
gas/testsuite/gas/mips/lui-2.l [new file with mode: 0644]
gas/testsuite/gas/mips/lui-2.s [new file with mode: 0644]
gas/testsuite/gas/mips/lui.d [new file with mode: 0644]
gas/testsuite/gas/mips/lui.s [new file with mode: 0644]
gas/testsuite/gas/mips/micromips@lui.d [new file with mode: 0644]
gas/testsuite/gas/mips/mips.exp

index 1c1dc076702434639ebce7e0b8fa6e8700f3ab1f..69e161d4f9f4691dcc5067244d270e51de641ceb 100644 (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.
index 024b864fe8cd77ab366eb35e604310770a6acf64..0372b7a76b45ff8f681da9e0c691558b50dc2cbc 100644 (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
index 4399fcb4432f8d4909ca74847f164ddcd7e5acff..b007717ae528c4da0f9a86898c379d4d7f8dffab 100644 (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.
diff --git a/gas/testsuite/gas/mips/lui-1.l b/gas/testsuite/gas/mips/lui-1.l
new file mode 100644 (file)
index 0000000..e4362b6
--- /dev/null
@@ -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 (file)
index 0000000..226b005
--- /dev/null
@@ -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 (file)
index 0000000..ed97e85
--- /dev/null
@@ -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 (file)
index 0000000..3b52245
--- /dev/null
@@ -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 (file)
index 0000000..e00095d
--- /dev/null
@@ -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 (file)
index 0000000..3988ff8
--- /dev/null
@@ -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 (file)
index 0000000..882bff0
--- /dev/null
@@ -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
+       \.\.\.
index 6a452d5cdd85bdb4feea1edf088226aca7d3f3ff..2ffbd4b099d52a68f56a7f7ea4af30ef0f3cfb37 100644 (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]
 }