aboutsummaryrefslogtreecommitdiff
path: root/test/MC
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-02 12:46:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-02 12:46:23 +0000
commitedad5bcb76bf472a1487c0f3dd94a5914213a647 (patch)
tree63c3f98843d0debbfd390005cf8e05250cd3fe28 /test/MC
parent0bc1bd0d3931803dc6a26d35758f93527359bcdb (diff)
downloadsrc-edad5bcb76bf472a1487c0f3dd94a5914213a647.tar.gz
src-edad5bcb76bf472a1487c0f3dd94a5914213a647.zip
Vendor import of llvm release_50 branch r319231:vendor/llvm/llvm-release_50-r319231
Notes
Notes: svn path=/vendor/llvm/dist/; revision=326460 svn path=/vendor/llvm/llvm-release_50-r319231/; revision=326461; tag=vendor/llvm/llvm-release_50-r319231
Diffstat (limited to 'test/MC')
-rw-r--r--test/MC/Disassembler/Mips/mt/valid-r2-el.txt21
-rw-r--r--test/MC/Disassembler/Mips/mt/valid-r2.txt21
-rw-r--r--test/MC/Mips/macro-aliases-invalid-wrong-error.s38
-rw-r--r--test/MC/Mips/macro-aliases.s35
-rw-r--r--test/MC/Mips/mt/invalid-wrong-error.s4
-rw-r--r--test/MC/Mips/mt/invalid.s1
-rw-r--r--test/MC/Mips/mt/mftr-mttr-aliases-invalid-wrong-error.s18
-rw-r--r--test/MC/Mips/mt/mftr-mttr-aliases-invalid.s23
-rw-r--r--test/MC/Mips/mt/mftr-mttr-aliases.s47
-rw-r--r--test/MC/Mips/mt/mftr-mttr-reserved-valid.s8
-rw-r--r--test/MC/Mips/mt/valid.s42
-rw-r--r--test/MC/Mips/tls-symbols.s28
12 files changed, 273 insertions, 13 deletions
diff --git a/test/MC/Disassembler/Mips/mt/valid-r2-el.txt b/test/MC/Disassembler/Mips/mt/valid-r2-el.txt
index 7025354d6847..62e7092086aa 100644
--- a/test/MC/Disassembler/Mips/mt/valid-r2-el.txt
+++ b/test/MC/Disassembler/Mips/mt/valid-r2-el.txt
@@ -10,4 +10,23 @@
0x08 0x10 0x65 0x7c # CHECK: fork $2, $3, $5
0x09 0x00 0x80 0x7c # CHECK: yield $4
0x09 0x20 0xa0 0x7c # CHECK: yield $4, $5
-
+0x02 0x20 0x05 0x41 # CHECK: mftr $4, $5, 0, 2, 0
+0x20 0x20 0x05 0x41 # CHECK: mftr $4, $5, 1, 0, 0
+0x21 0x20 0x00 0x41 # CHECK: mftr $4, $zero, 1, 1, 0
+0x21 0x20 0x0a 0x41 # CHECK: mftr $4, $10, 1, 1, 0
+0x22 0x20 0x0a 0x41 # CHECK: mftr $4, $10, 1, 2, 0
+0x32 0x20 0x0a 0x41 # CHECK: mftr $4, $10, 1, 2, 1
+0x23 0x20 0x1a 0x41 # CHECK: mftr $4, $26, 1, 3, 0
+0x23 0x20 0x1f 0x41 # CHECK: mftr $4, $ra, 1, 3, 0
+0x24 0x20 0x0e 0x41 # CHECK: mftr $4, $14, 1, 4, 0
+0x25 0x20 0x0f 0x41 # CHECK: mftr $4, $15, 1, 5, 0
+0x02 0x28 0x84 0x41 # CHECK: mttr $4, $5, 0, 2, 0
+0x20 0x28 0x84 0x41 # CHECK: mttr $4, $5, 1, 0, 0
+0x21 0x00 0x84 0x41 # CHECK: mttr $4, $zero, 1, 1, 0
+0x21 0x50 0x84 0x41 # CHECK: mttr $4, $10, 1, 1, 0
+0x22 0x50 0x84 0x41 # CHECK: mttr $4, $10, 1, 2, 0
+0x32 0x50 0x84 0x41 # CHECK: mttr $4, $10, 1, 2, 1
+0x23 0xd0 0x84 0x41 # CHECK: mttr $4, $26, 1, 3, 0
+0x23 0xf8 0x84 0x41 # CHECK: mttr $4, $ra, 1, 3, 0
+0x24 0x70 0x84 0x41 # CHECK: mttr $4, $14, 1, 4, 0
+0x25 0x78 0x84 0x41 # CHECK: mttr $4, $15, 1, 5, 0
diff --git a/test/MC/Disassembler/Mips/mt/valid-r2.txt b/test/MC/Disassembler/Mips/mt/valid-r2.txt
index 17c42c0614a5..4786d8b5591f 100644
--- a/test/MC/Disassembler/Mips/mt/valid-r2.txt
+++ b/test/MC/Disassembler/Mips/mt/valid-r2.txt
@@ -10,4 +10,23 @@
0x7c 0x65 0x10 0x08 # CHECK: fork $2, $3, $5
0x7c 0x80 0x00 0x09 # CHECK: yield $4
0x7c 0xa0 0x20 0x09 # CHECK: yield $4, $5
-
+0x41 0x05 0x20 0x02 # CHECK: mftr $4, $5, 0, 2, 0
+0x41 0x05 0x20 0x20 # CHECK: mftr $4, $5, 1, 0, 0
+0x41 0x00 0x20 0x21 # CHECK: mftr $4, $zero, 1, 1, 0
+0x41 0x0a 0x20 0x21 # CHECK: mftr $4, $10, 1, 1, 0
+0x41 0x0a 0x20 0x22 # CHECK: mftr $4, $10, 1, 2, 0
+0x41 0x0a 0x20 0x32 # CHECK: mftr $4, $10, 1, 2, 1
+0x41 0x1a 0x20 0x23 # CHECK: mftr $4, $26, 1, 3, 0
+0x41 0x1f 0x20 0x23 # CHECK: mftr $4, $ra, 1, 3, 0
+0x41 0x0e 0x20 0x24 # CHECK: mftr $4, $14, 1, 4, 0
+0x41 0x0f 0x20 0x25 # CHECK: mftr $4, $15, 1, 5, 0
+0x41 0x84 0x28 0x02 # CHECK: mttr $4, $5, 0, 2, 0
+0x41 0x84 0x28 0x20 # CHECK: mttr $4, $5, 1, 0, 0
+0x41 0x84 0x00 0x21 # CHECK: mttr $4, $zero, 1, 1, 0
+0x41 0x84 0x50 0x21 # CHECK: mttr $4, $10, 1, 1, 0
+0x41 0x84 0x50 0x22 # CHECK: mttr $4, $10, 1, 2, 0
+0x41 0x84 0x50 0x32 # CHECK: mttr $4, $10, 1, 2, 1
+0x41 0x84 0xd0 0x23 # CHECK: mttr $4, $26, 1, 3, 0
+0x41 0x84 0xf8 0x23 # CHECK: mttr $4, $ra, 1, 3, 0
+0x41 0x84 0x70 0x24 # CHECK: mttr $4, $14, 1, 4, 0
+0x41 0x84 0x78 0x25 # CHECK: mttr $4, $15, 1, 5, 0
diff --git a/test/MC/Mips/macro-aliases-invalid-wrong-error.s b/test/MC/Mips/macro-aliases-invalid-wrong-error.s
new file mode 100644
index 000000000000..b87646d0b09a
--- /dev/null
+++ b/test/MC/Mips/macro-aliases-invalid-wrong-error.s
@@ -0,0 +1,38 @@
+# RUN: not llvm-mc -arch=mips %s 2>%t1
+# RUN: FileCheck --check-prefix=O32 %s < %t1
+
+# RUN: not llvm-mc -arch=mips64 %s 2>%t1
+# RUN: FileCheck --check-prefix=N64 %s < %t1
+
+# Check that subu only rejects any non-constant values.
+
+.globl end
+ subu $4, $4, %lo($start) # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ # N64: [[@LINE-1]]:{{[0-9]+}}: error: unexpected token in argument list
+ subu $4, $4, $start # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ # N64: [[@LINE-1]]:{{[0-9]+}}: error: unexpected token in argument list
+ subu $4, $a4, $a4 # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ subu $4, $4, %hi(end) # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ # N64: [[@LINE-1]]:{{[0-9]+}}: error: unexpected token in argument list
+ subu $4, $4, end + 4 # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ # N64: [[@LINE-1]]:{{[0-9]+}}: error: unexpected token in argument list
+ subu $4, $4, end # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ # N64: [[@LINE-1]]:{{[0-9]+}}: error: unexpected token in argument list
+ subu $4, $4, sp # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ # N64: [[@LINE-1]]:{{[0-9]+}}: error: unexpected token in argument list
+
+ subu $4, %lo($start) # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ # N64: [[@LINE-1]]:{{[0-9]+}}: error: unexpected token in argument list
+ subu $4, $start # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ # N64: [[@LINE-1]]:{{[0-9]+}}: error: unexpected token in argument list
+ subu $4, $a4 # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ subu $4, %hi(end) # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ # N64: [[@LINE-1]]:{{[0-9]+}}: error: unexpected token in argument list
+ subu $4, end + 4 # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ # N64: [[@LINE-1]]:{{[0-9]+}}: error: unexpected token in argument list
+ subu $4, end # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ # N64: [[@LINE-1]]:{{[0-9]+}}: error: unexpected token in argument list
+ subu $4, sp # O32: [[@LINE]]:{{[0-9]+}}: error: unexpected token in argument list
+ # N64: [[@LINE-1]]:{{[0-9]+}}: error: unexpected token in argument list
+
+$start:
diff --git a/test/MC/Mips/macro-aliases.s b/test/MC/Mips/macro-aliases.s
new file mode 100644
index 000000000000..daa1d8b2437c
--- /dev/null
+++ b/test/MC/Mips/macro-aliases.s
@@ -0,0 +1,35 @@
+# RUN: llvm-mc -arch=mips -mcpu=mips32r2 %s -show-inst | FileCheck %s
+
+# Test that subu accepts constant operands and inverts them when
+# rendering the operand.
+
+ subu $4, $4, 4 # CHECK: ADDiu
+ # CHECK; Imm:-4
+ subu $gp, $gp, 4 # CHECK: ADDiu
+ # CHECK; Imm:-4
+ subu $sp, $sp, 4 # CHECK: ADDiu
+ # CHECK; Imm:-4
+ subu $4, $4, -4 # CHECK: ADDiu
+ # CHECK; Imm:4
+ subu $gp, $gp, -4 # CHECK: ADDiu
+ # CHECK; Imm:4
+ subu $sp, $sp, -4 # CHECK: ADDiu
+ # CHECK; Imm:4
+ subu $sp, $sp, -(4 + 4) # CHECK: ADDiu
+ # CHECK: Imm:8
+
+ subu $4, 8 # CHECK: ADDiu
+ # CHECK; Imm:-8
+ subu $gp, 8 # CHECK: ADDiu
+ # CHECK; Imm:-8
+ subu $sp, 8 # CHECK: ADDiu
+ # CHECK; Imm:-8
+ subu $4, -8 # CHECK: ADDiu
+ # CHECK; Imm:8
+ subu $gp, -8 # CHECK: ADDiu
+ # CHECK; Imm:8
+ subu $sp, -8 # CHECK: ADDiu
+ # CHECK; Imm:8
+ subu $sp, -(4 + 4) # CHECK: ADDiu
+ # CHECK: Imm:8
+
diff --git a/test/MC/Mips/mt/invalid-wrong-error.s b/test/MC/Mips/mt/invalid-wrong-error.s
new file mode 100644
index 000000000000..6de852cf0cbe
--- /dev/null
+++ b/test/MC/Mips/mt/invalid-wrong-error.s
@@ -0,0 +1,4 @@
+# RUN: not llvm-mc -arch=mips -mcpu=mips32r2 -mattr=+mt < %s 2>%t1
+# RUN: FileCheck %s < %t1
+ mftr 0($4), $5, 0, 0, 0 # CHECK: error: unexpected token in argument list
+ mttr 0($4), $5, 0, 0, 0 # CHECK: error: unexpected token in argument list
diff --git a/test/MC/Mips/mt/invalid.s b/test/MC/Mips/mt/invalid.s
index 5a145a7e0850..02e96f0a1a3b 100644
--- a/test/MC/Mips/mt/invalid.s
+++ b/test/MC/Mips/mt/invalid.s
@@ -11,3 +11,4 @@
evpe 4 # CHECK: error: invalid operand for instruction
evpe $4, $5 # CHECK: error: invalid operand for instruction
evpe $5, 0($5) # CHECK: error: invalid operand for instruction
+ # FIXME: add tests for mftr/mttr.
diff --git a/test/MC/Mips/mt/mftr-mttr-aliases-invalid-wrong-error.s b/test/MC/Mips/mt/mftr-mttr-aliases-invalid-wrong-error.s
new file mode 100644
index 000000000000..d931b499f26e
--- /dev/null
+++ b/test/MC/Mips/mt/mftr-mttr-aliases-invalid-wrong-error.s
@@ -0,0 +1,18 @@
+# RUN: not llvm-mc -arch=mips -mcpu=mips32r2 -mattr=+mt -show-encoding < %s 2>%t1
+# RUN: FileCheck %s < %t1
+
+# The integrated assembler produces a wrong or misleading error message.
+
+ mftc0 0($4), $5 # CHECK: error: unexpected token in argument list
+ mftc0 0($4), $5, 1 # CHECK: error: unexpected token in argument list
+ mftgpr 0($4), $5 # CHECK: error: unexpected token in argument list
+ mftlo 0($3) # CHECK: error: unexpected token in argument list
+ mftlo 0($3), $ac1 # CHECK: error: unexpected token in argument list
+ mfthi 0($3) # CHECK: error: unexpected token in argument list
+ mfthi 0($3), $ac1 # CHECK: error: unexpected token in argument list
+ mftacx 0($3) # CHECK: error: unexpected token in argument list
+ mftacx 0($3), $ac1 # CHECK: error: unexpected token in argument list
+ mftdsp 0($4) # CHECK: error: unexpected token in argument list
+ mftc1 0($4), $f4 # CHECK: error: unexpected token in argument list
+ mfthc1 0($4), $f4 # CHECK: error: unexpected token in argument list
+ cftc1 0($4), $f8 # CHECK: error: unexpected token in argument list
diff --git a/test/MC/Mips/mt/mftr-mttr-aliases-invalid.s b/test/MC/Mips/mt/mftr-mttr-aliases-invalid.s
new file mode 100644
index 000000000000..17d954030cd1
--- /dev/null
+++ b/test/MC/Mips/mt/mftr-mttr-aliases-invalid.s
@@ -0,0 +1,23 @@
+# RUN: not llvm-mc -arch=mips -mcpu=mips32r2 -mattr=+mt -show-encoding < %s 2>%t1
+# RUN: FileCheck %s < %t1
+
+ mftc0 $4, 0($5) # CHECK: error: invalid operand for instruction
+ mftc0 $4, 0($5), 1 # CHECK: error: invalid operand for instruction
+ mftc0 $4, $5, -1 # CHECK: error: expected 3-bit unsigned immediate
+ mftc0 $4, $5, 9 # CHECK: error: expected 3-bit unsigned immediate
+ mftc0 $4, $5, $6 # CHECK: error: expected 3-bit unsigned immediate
+ mftgpr $4, 0($5) # CHECK: error: invalid operand for instruction
+ mftgpr $4, $5, $6 # CHECK: error: invalid operand for instruction
+ mftlo $3, 0($ac1) # CHECK: error: invalid operand for instruction
+ mftlo $4, $ac1, $4 # CHECK: error: invalid operand for instruction
+ mfthi $3, 0($ac1) # CHECK: error: invalid operand for instruction
+ mfthi $4, $ac1, $4 # CHECK: error: invalid operand for instruction
+ mftacx $3, 0($ac1) # CHECK: error: invalid operand for instruction
+ mftacx $4, $ac1, $4 # CHECK: error: invalid operand for instruction
+ mftdsp $4, $5 # CHECK: error: invalid operand for instruction
+ mftdsp $4, $f5 # CHECK: error: invalid operand for instruction
+ mftdsp $4, $ac0 # CHECK: error: invalid operand for instruction
+ mftc1 $4, 0($f4) # CHECK: error: invalid operand for instruction
+ mfthc1 $4, 0($f4) # CHECK: error: invalid operand for instruction
+ cftc1 $4, 0($f4) # CHECK: error: invalid operand for instruction
+ cftc1 $4, $f4, $5 # CHECK: error: invalid operand for instruction
diff --git a/test/MC/Mips/mt/mftr-mttr-aliases.s b/test/MC/Mips/mt/mftr-mttr-aliases.s
new file mode 100644
index 000000000000..92ed9f9281f2
--- /dev/null
+++ b/test/MC/Mips/mt/mftr-mttr-aliases.s
@@ -0,0 +1,47 @@
+# RUN: llvm-mc -arch=mips -mcpu=mips32r2 -mattr=+mt -show-encoding < %s | FileCheck %s
+
+# Check the various aliases of the m[ft]tr instruction.
+
+ mftc0 $4, $5 # CHECK: mftr $4, $5, 0, 0, 0 # encoding: [0x41,0x05,0x20,0x00]
+ mftc0 $6, $7, 1 # CHECK: mftr $6, $7, 0, 1, 0 # encoding: [0x41,0x07,0x30,0x01]
+ mftgpr $5, $9 # CHECK: mftr $5, $9, 1, 0, 0 # encoding: [0x41,0x09,0x28,0x20]
+ mftlo $3 # CHECK: mftr $3, $zero, 1, 1, 0 # encoding: [0x41,0x00,0x18,0x21]
+ mftlo $3, $ac0 # CHECK: mftr $3, $zero, 1, 1, 0 # encoding: [0x41,0x00,0x18,0x21]
+ mftlo $3, $ac1 # CHECK: mftr $3, $4, 1, 1, 0 # encoding: [0x41,0x04,0x18,0x21]
+ mftlo $3, $ac2 # CHECK: mftr $3, $8, 1, 1, 0 # encoding: [0x41,0x08,0x18,0x21]
+ mftlo $3, $ac3 # CHECK: mftr $3, $12, 1, 1, 0 # encoding: [0x41,0x0c,0x18,0x21]
+ mfthi $3, $ac0 # CHECK: mftr $3, $1, 1, 1, 0 # encoding: [0x41,0x01,0x18,0x21]
+ mfthi $3, $ac1 # CHECK: mftr $3, $5, 1, 1, 0 # encoding: [0x41,0x05,0x18,0x21]
+ mfthi $3, $ac2 # CHECK: mftr $3, $9, 1, 1, 0 # encoding: [0x41,0x09,0x18,0x21]
+ mfthi $3, $ac3 # CHECK: mftr $3, $13, 1, 1, 0 # encoding: [0x41,0x0d,0x18,0x21]
+ mftacx $3, $ac0 # CHECK: mftr $3, $2, 1, 1, 0 # encoding: [0x41,0x02,0x18,0x21]
+ mftacx $3, $ac1 # CHECK: mftr $3, $6, 1, 1, 0 # encoding: [0x41,0x06,0x18,0x21]
+ mftacx $3, $ac2 # CHECK: mftr $3, $10, 1, 1, 0 # encoding: [0x41,0x0a,0x18,0x21]
+ mftacx $3, $ac3 # CHECK: mftr $3, $14, 1, 1, 0 # encoding: [0x41,0x0e,0x18,0x21]
+ mftdsp $4 # CHECK: mftr $4, $16, 1, 1, 0 # encoding: [0x41,0x10,0x20,0x21]
+ mftc1 $4, $f5 # CHECK: mftr $4, $5, 1, 2, 0 # encoding: [0x41,0x05,0x20,0x22]
+ mfthc1 $4, $f5 # CHECK: mftr $4, $5, 1, 2, 1 # encoding: [0x41,0x05,0x20,0x32]
+ cftc1 $4, $f9 # CHECK: mftr $4, $9, 1, 3, 0 # encoding: [0x41,0x09,0x20,0x23]
+
+ mttc0 $4, $5 # CHECK: mttr $4, $5, 0, 0, 0 # encoding: [0x41,0x84,0x28,0x00]
+ mttc0 $6, $7, 1 # CHECK: mttr $6, $7, 0, 1, 0 # encoding: [0x41,0x86,0x38,0x01]
+ mttgpr $5, $9 # CHECK: mttr $5, $9, 1, 0, 0 # encoding: [0x41,0x85,0x48,0x20]
+ mttlo $3 # CHECK: mttr $3, $zero, 1, 1, 0 # encoding: [0x41,0x83,0x00,0x21]
+ mttlo $3, $ac0 # CHECK: mttr $3, $zero, 1, 1, 0 # encoding: [0x41,0x83,0x00,0x21]
+ mttlo $3, $ac1 # CHECK: mttr $3, $4, 1, 1, 0 # encoding: [0x41,0x83,0x20,0x21]
+ mttlo $3, $ac2 # CHECK: mttr $3, $8, 1, 1, 0 # encoding: [0x41,0x83,0x40,0x21]
+ mttlo $3, $ac3 # CHECK: mttr $3, $12, 1, 1, 0 # encoding: [0x41,0x83,0x60,0x21]
+ mtthi $3 # CHECK: mttr $3, $1, 1, 1, 0 # encoding: [0x41,0x83,0x08,0x21]
+ mtthi $3, $ac0 # CHECK: mttr $3, $1, 1, 1, 0 # encoding: [0x41,0x83,0x08,0x21]
+ mtthi $3, $ac1 # CHECK: mttr $3, $5, 1, 1, 0 # encoding: [0x41,0x83,0x28,0x21]
+ mtthi $3, $ac2 # CHECK: mttr $3, $9, 1, 1, 0 # encoding: [0x41,0x83,0x48,0x21]
+ mtthi $3, $ac3 # CHECK: mttr $3, $13, 1, 1, 0 # encoding: [0x41,0x83,0x68,0x21]
+ mttacx $3 # CHECK: mttr $3, $2, 1, 1, 0 # encoding: [0x41,0x83,0x10,0x21]
+ mttacx $3, $ac0 # CHECK: mttr $3, $2, 1, 1, 0 # encoding: [0x41,0x83,0x10,0x21]
+ mttacx $3, $ac1 # CHECK: mttr $3, $6, 1, 1, 0 # encoding: [0x41,0x83,0x30,0x21]
+ mttacx $3, $ac2 # CHECK: mttr $3, $10, 1, 1, 0 # encoding: [0x41,0x83,0x50,0x21]
+ mttacx $3, $ac3 # CHECK: mttr $3, $14, 1, 1, 0 # encoding: [0x41,0x83,0x70,0x21]
+ mttdsp $4 # CHECK: mttr $4, $16, 1, 1, 0 # encoding: [0x41,0x84,0x80,0x21]
+ mttc1 $4, $f5 # CHECK: mttr $4, $5, 1, 2, 0 # encoding: [0x41,0x84,0x28,0x22]
+ mtthc1 $4, $f5 # CHECK: mttr $4, $5, 1, 2, 1 # encoding: [0x41,0x84,0x28,0x32]
+ cttc1 $4, $f9 # CHECK: mttr $4, $9, 1, 3, 0 # encoding: [0x41,0x84,0x48,0x23]
diff --git a/test/MC/Mips/mt/mftr-mttr-reserved-valid.s b/test/MC/Mips/mt/mftr-mttr-reserved-valid.s
new file mode 100644
index 000000000000..c40e81bfc7d7
--- /dev/null
+++ b/test/MC/Mips/mt/mftr-mttr-reserved-valid.s
@@ -0,0 +1,8 @@
+# RUN: llvm-mc -arch=mips -mcpu=mips32r2 -mattr=+mt -show-encoding < %s | FileCheck %s
+
+# The selector value and register values here are marked as reserved in the
+# documentation, but GAS accepts them without warning.
+ mftr $31, $31, 1, 1, 0 # CHECK: mftr $ra, $ra, 1, 1, 0 # encoding: [0x41,0x1f,0xf8,0x21]
+ mttr $31, $31, 1, 1, 0 # CHECK: mttr $ra, $ra, 1, 1, 0 # encoding: [0x41,0x9f,0xf8,0x21]
+ mftr $31, $13, 1, 6, 0 # CHECK: mftr $ra, $13, 1, 6, 0 # encoding: [0x41,0x0d,0xf8,0x26]
+ mttr $31, $13, 1, 6, 0 # CHECK: mttr $ra, $13, 1, 6, 0 # encoding: [0x41,0x9f,0x68,0x26]
diff --git a/test/MC/Mips/mt/valid.s b/test/MC/Mips/mt/valid.s
index ab1179d05c6a..9fa07870a61f 100644
--- a/test/MC/Mips/mt/valid.s
+++ b/test/MC/Mips/mt/valid.s
@@ -1,13 +1,33 @@
# RUN: llvm-mc -arch=mips -mcpu=mips32r2 -mattr=+mt -show-encoding < %s \
# RUN: | FileCheck %s
- dmt # CHECK: dmt # encoding: [0x41,0x60,0x0b,0xc1]
- dmt $5 # CHECK: dmt $5 # encoding: [0x41,0x65,0x0b,0xc1]
- emt # CHECK: emt # encoding: [0x41,0x60,0x0b,0xe1]
- emt $4 # CHECK: emt $4 # encoding: [0x41,0x64,0x0b,0xe1]
- dvpe # CHECK: dvpe # encoding: [0x41,0x60,0x00,0x01]
- dvpe $6 # CHECK: dvpe $6 # encoding: [0x41,0x66,0x00,0x01]
- evpe # CHECK: evpe # encoding: [0x41,0x60,0x00,0x21]
- evpe $4 # CHECK: evpe $4 # encoding: [0x41,0x64,0x00,0x21]
- fork $2, $3, $5 # CHECK: fork $2, $3, $5 # encoding: [0x7c,0x65,0x10,0x08]
- yield $4 # CHECK: yield $4 # encoding: [0x7c,0x80,0x00,0x09]
- yield $4, $5 # CHECK: yield $4, $5 # encoding: [0x7c,0xa0,0x20,0x09]
+ dmt # CHECK: dmt # encoding: [0x41,0x60,0x0b,0xc1]
+ dmt $5 # CHECK: dmt $5 # encoding: [0x41,0x65,0x0b,0xc1]
+ emt # CHECK: emt # encoding: [0x41,0x60,0x0b,0xe1]
+ emt $4 # CHECK: emt $4 # encoding: [0x41,0x64,0x0b,0xe1]
+ dvpe # CHECK: dvpe # encoding: [0x41,0x60,0x00,0x01]
+ dvpe $6 # CHECK: dvpe $6 # encoding: [0x41,0x66,0x00,0x01]
+ evpe # CHECK: evpe # encoding: [0x41,0x60,0x00,0x21]
+ evpe $4 # CHECK: evpe $4 # encoding: [0x41,0x64,0x00,0x21]
+ fork $2, $3, $5 # CHECK: fork $2, $3, $5 # encoding: [0x7c,0x65,0x10,0x08]
+ yield $4 # CHECK: yield $4 # encoding: [0x7c,0x80,0x00,0x09]
+ yield $4, $5 # CHECK: yield $4, $5 # encoding: [0x7c,0xa0,0x20,0x09]
+ mftr $4, $5, 0, 2, 0 # CHECK: mftr $4, $5, 0, 2, 0 # encoding: [0x41,0x05,0x20,0x02]
+ mftr $4, $5, 1, 0, 0 # CHECK: mftr $4, $5, 1, 0, 0 # encoding: [0x41,0x05,0x20,0x20]
+ mftr $4, $0, 1, 1, 0 # CHECK: mftr $4, $zero, 1, 1, 0 # encoding: [0x41,0x00,0x20,0x21]
+ mftr $4, $10, 1, 1, 0 # CHECK: mftr $4, $10, 1, 1, 0 # encoding: [0x41,0x0a,0x20,0x21]
+ mftr $4, $10, 1, 2, 0 # CHECK: mftr $4, $10, 1, 2, 0 # encoding: [0x41,0x0a,0x20,0x22]
+ mftr $4, $10, 1, 2, 1 # CHECK: mftr $4, $10, 1, 2, 1 # encoding: [0x41,0x0a,0x20,0x32]
+ mftr $4, $26, 1, 3, 0 # CHECK: mftr $4, $26, 1, 3, 0 # encoding: [0x41,0x1a,0x20,0x23]
+ mftr $4, $31, 1, 3, 0 # CHECK: mftr $4, $ra, 1, 3, 0 # encoding: [0x41,0x1f,0x20,0x23]
+ mftr $4, $14, 1, 4, 0 # CHECK: mftr $4, $14, 1, 4, 0 # encoding: [0x41,0x0e,0x20,0x24]
+ mftr $4, $15, 1, 5, 0 # CHECK: mftr $4, $15, 1, 5, 0 # encoding: [0x41,0x0f,0x20,0x25]
+ mttr $4, $5, 0, 2, 0 # CHECK: mttr $4, $5, 0, 2, 0 # encoding: [0x41,0x84,0x28,0x02]
+ mttr $4, $5, 1, 0, 0 # CHECK: mttr $4, $5, 1, 0, 0 # encoding: [0x41,0x84,0x28,0x20]
+ mttr $4, $0, 1, 1, 0 # CHECK: mttr $4, $zero, 1, 1, 0 # encoding: [0x41,0x84,0x00,0x21]
+ mttr $4, $10, 1, 1, 0 # CHECK: mttr $4, $10, 1, 1, 0 # encoding: [0x41,0x84,0x50,0x21]
+ mttr $4, $10, 1, 2, 0 # CHECK: mttr $4, $10, 1, 2, 0 # encoding: [0x41,0x84,0x50,0x22]
+ mttr $4, $10, 1, 2, 1 # CHECK: mttr $4, $10, 1, 2, 1 # encoding: [0x41,0x84,0x50,0x32]
+ mttr $4, $26, 1, 3, 0 # CHECK: mttr $4, $26, 1, 3, 0 # encoding: [0x41,0x84,0xd0,0x23]
+ mttr $4, $31, 1, 3, 0 # CHECK: mttr $4, $ra, 1, 3, 0 # encoding: [0x41,0x84,0xf8,0x23]
+ mttr $4, $14, 1, 4, 0 # CHECK: mttr $4, $14, 1, 4, 0 # encoding: [0x41,0x84,0x70,0x24]
+ mttr $4, $15, 1, 5, 0 # CHECK: mttr $4, $15, 1, 5, 0 # encoding: [0x41,0x84,0x78,0x25]
diff --git a/test/MC/Mips/tls-symbols.s b/test/MC/Mips/tls-symbols.s
new file mode 100644
index 000000000000..d5a31b189502
--- /dev/null
+++ b/test/MC/Mips/tls-symbols.s
@@ -0,0 +1,28 @@
+# RUN: llvm-mc -arch=mips < %s -position-independent -filetype=obj \
+# RUN: | llvm-readelf -symbols | FileCheck %s
+# RUN: llvm-mc -arch=mips < %s -filetype=obj | llvm-readelf -symbols \
+# RUN: | FileCheck %s
+
+# Test that TLS relocations cause symbols to be marked as TLS symbols.
+
+ .set noat
+ lui $3, %tlsgd(foo1)
+ lui $1, %dtprel_hi(foo2)
+ lui $1, %dtprel_lo(foo3)
+ lui $1, %tprel_hi(foo4)
+ lui $1, %tprel_lo(foo5)
+ lw $2, %gottprel(foo6)($28)
+
+ .hidden foo1
+ .hidden foo2
+ .hidden foo3
+ .hidden foo4
+ .hidden foo5
+ .hidden foo6
+
+# CHECK: 1: {{.+}} {{.+}} TLS GLOBAL HIDDEN UND foo1
+# CHECK: 2: {{.+}} {{.+}} TLS GLOBAL HIDDEN UND foo2
+# CHECK: 3: {{.+}} {{.+}} TLS GLOBAL HIDDEN UND foo3
+# CHECK: 4: {{.+}} {{.+}} TLS GLOBAL HIDDEN UND foo4
+# CHECK: 5: {{.+}} {{.+}} TLS GLOBAL HIDDEN UND foo5
+# CHECK: 6: {{.+}} {{.+}} TLS GLOBAL HIDDEN UND foo6