aboutsummaryrefslogtreecommitdiff
path: root/test/MC/Mips
diff options
context:
space:
mode:
Diffstat (limited to 'test/MC/Mips')
-rw-r--r--test/MC/Mips/eh-frame.ll (renamed from test/MC/Mips/ef_frame.ll)0
-rw-r--r--test/MC/Mips/eh-frame.s46
-rw-r--r--test/MC/Mips/fde-reloc.s21
-rw-r--r--test/MC/Mips/mips-alu-instructions.s2
-rw-r--r--test/MC/Mips/mips-expansions.s22
-rw-r--r--test/MC/Mips/mips-jump-instructions.s40
-rw-r--r--test/MC/Mips/mips_directives.s6
7 files changed, 124 insertions, 13 deletions
diff --git a/test/MC/Mips/ef_frame.ll b/test/MC/Mips/eh-frame.ll
index 91c8b43d02..91c8b43d02 100644
--- a/test/MC/Mips/ef_frame.ll
+++ b/test/MC/Mips/eh-frame.ll
diff --git a/test/MC/Mips/eh-frame.s b/test/MC/Mips/eh-frame.s
new file mode 100644
index 0000000000..56278b8b99
--- /dev/null
+++ b/test/MC/Mips/eh-frame.s
@@ -0,0 +1,46 @@
+// Assembler generated object test.
+// This tests .eh_frame descriptors minimally.
+
+// What we really need is a prettyprinter output check not unlike what
+// gnu's readobj generates instead of checking the bits for .eh_frame.
+
+// RUN: llvm-mc -filetype=obj -mcpu=mips32r2 -triple mipsel-unknown-linux -arch=mipsel %s -o - \
+// RUN: | llvm-objdump -s - | FileCheck -check-prefix=CHECK-LEO32 %s
+
+// RUN: llvm-mc -filetype=obj -mcpu=mips32r2 -triple mips-unknown-linux -arch=mips %s -o - \
+// RUN: | llvm-objdump -s - | FileCheck -check-prefix=CHECK-BEO32 %s
+
+// RUN: llvm-mc -filetype=obj -mcpu=mips64r2 -mattr=n64 -arch=mips64el %s -o - \
+// RUN: | llvm-objdump -s - | FileCheck -check-prefix=CHECK-LE64 %s
+
+// RUN: llvm-mc -filetype=obj -mcpu=mips64r2 -mattr=n64 -arch=mips64 %s -o - \
+// RUN: | llvm-objdump -s - | FileCheck -check-prefix=CHECK-BE64 %s
+
+// O32 little endian
+// CHECK-LEO32: Contents of section .eh_frame:
+// CHECK-LEO32-NEXT: 0000 10000000 00000000 017a5200 017c1f01 .........zR..|..
+// CHECK-LEO32-NEXT: 0010 000c1d00 10000000 18000000 00000000 ................
+// CHECK-LEO32-NEXT: 0020 00000000 00000000 ........
+
+// O32 big endian
+// CHECK-BEO32: Contents of section .eh_frame:
+// CHECK-BEO32-NEXT 0000 00000010 00000000 017a5200 017c1f01 .........zR..|..
+// CHECK-BEO32-NEXT 0010 000c1d00 00000010 00000018 00000000 ................
+// CHECK-BEO32-NEXT 0020 00000000 00000000 ........
+
+// N64 little endian
+// CHECK-LE64: Contents of section .eh_frame:
+// CHECK-LE64-NEXT: 0000 10000000 00000000 017a5200 01781f01 .........zR..x..
+// CHECK-LE64-NEXT: 0010 000c1d00 18000000 18000000 00000000 ................
+// CHECK-LE64-NEXT: 0020 00000000 00000000 00000000 00000000 ................
+
+// N64 big endian
+// CHECK-BE64: Contents of section .eh_frame:
+// CHECK-BE64-NEXT: 0000 00000010 00000000 017a5200 01781f01 .........zR..x..
+// CHECK-BE64-NEXT: 0010 000c1d00 00000018 00000018 00000000 ................
+// CHECK-BE64-NEXT: 0020 00000000 00000000 00000000 00000000 ................
+
+func:
+ .cfi_startproc
+ .cfi_endproc
+
diff --git a/test/MC/Mips/fde-reloc.s b/test/MC/Mips/fde-reloc.s
new file mode 100644
index 0000000000..2db5d0b638
--- /dev/null
+++ b/test/MC/Mips/fde-reloc.s
@@ -0,0 +1,21 @@
+// This just tests that a relocation of the specified type shows up as the first
+// relocation in the relocation section for .eh_frame when produced by the
+// assembler.
+
+// RUN: llvm-mc -filetype=obj %s -o - -triple mips-unknown-unknown | \
+// RUN: llvm-objdump -r - | FileCheck --check-prefix=MIPS32 %s
+
+// RUN: llvm-mc -filetype=obj %s -o - -triple mips64-unknown-unknown | \
+// RUN: llvm-objdump -r - | FileCheck --check-prefix=MIPS64 %s
+
+// PR15448
+
+func:
+ .cfi_startproc
+ .cfi_endproc
+
+// MIPS32: RELOCATION RECORDS FOR [.eh_frame]:
+// MIPS32-NEXT: R_MIPS_32
+
+// MIPS64: RELOCATION RECORDS FOR [.eh_frame]:
+// MIPS64-NEXT: R_MIPS_64
diff --git a/test/MC/Mips/mips-alu-instructions.s b/test/MC/Mips/mips-alu-instructions.s
index 816138ec65..7384d19e44 100644
--- a/test/MC/Mips/mips-alu-instructions.s
+++ b/test/MC/Mips/mips-alu-instructions.s
@@ -13,6 +13,7 @@
# CHECK: ins $19, $9, 6, 7 # encoding: [0x84,0x61,0x33,0x7d]
# CHECK: nor $9, $6, $7 # encoding: [0x27,0x48,0xc7,0x00]
# CHECK: or $3, $3, $5 # encoding: [0x25,0x18,0x65,0x00]
+# CHECK: ori $4, $5, 17767 # encoding: [0x67,0x45,0xa4,0x34]
# CHECK: ori $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x34]
# CHECK: rotr $9, $6, 7 # encoding: [0xc2,0x49,0x26,0x00]
# CHECK: rotrv $9, $6, $7 # encoding: [0x46,0x48,0xe6,0x00]
@@ -40,6 +41,7 @@
ins $19, $9, 6,7
nor $9, $6, $7
or $3, $3, $5
+ or $4, $5, 17767
ori $9, $6, 17767
rotr $9, $6, 7
rotrv $9, $6, $7
diff --git a/test/MC/Mips/mips-expansions.s b/test/MC/Mips/mips-expansions.s
index cfc15e883a..3385fe1930 100644
--- a/test/MC/Mips/mips-expansions.s
+++ b/test/MC/Mips/mips-expansions.s
@@ -16,6 +16,22 @@
# CHECK: lui $7, 1 # encoding: [0x01,0x00,0x07,0x3c]
# CHECK: ori $7, $7, 2 # encoding: [0x02,0x00,0xe7,0x34]
# CHECK: addu $7, $7, $8 # encoding: [0x21,0x38,0xe8,0x00]
+# CHECK: lui $10, %hi(symbol) # encoding: [A,A,0x0a,0x3c]
+# CHECK: # fixup A - offset: 0, value: symbol@ABS_HI, kind: fixup_Mips_HI16
+# CHECK: addu $10, $10, $4 # encoding: [0x21,0x50,0x44,0x01]
+# CHECK: lw $10, %lo(symbol)($10) # encoding: [A,A,0x4a,0x8d]
+# CHECK: # fixup A - offset: 0, value: symbol@ABS_LO, kind: fixup_Mips_LO16
+# CHECK: lui $1, %hi(symbol) # encoding: [A,A,0x01,0x3c]
+# CHECK: # fixup A - offset: 0, value: symbol@ABS_HI, kind: fixup_Mips_HI16
+# CHECK: addu $1, $1, $9 # encoding: [0x21,0x08,0x29,0x00]
+# CHECK: sw $10, %lo(symbol)($1) # encoding: [A,A,0x2a,0xac]
+# CHECK: # fixup A - offset: 0, value: symbol@ABS_LO, kind: fixup_Mips_LO16
+# CHECK: lui $10, 10 # encoding: [0x0a,0x00,0x0a,0x3c]
+# CHECK: addu $10, $10, $4 # encoding: [0x21,0x50,0x44,0x01]
+# CHECK: lw $10, 123($10) # encoding: [0x7b,0x00,0x4a,0x8d]
+# CHECK: lui $1, 2 # encoding: [0x02,0x00,0x01,0x3c]
+# CHECK: addu $1, $1, $9 # encoding: [0x21,0x08,0x29,0x00]
+# CHECK: sw $10, 57920($1) # encoding: [0x40,0xe2,0x2a,0xac]
li $5,123
li $6,-2345
@@ -25,3 +41,9 @@
la $7,65538
la $a0, 20($a1)
la $7,65538($8)
+
+ lw $t2, symbol($a0)
+ sw $t2, symbol($t1)
+
+ lw $t2, 655483($a0)
+ sw $t2, 123456($t1)
diff --git a/test/MC/Mips/mips-jump-instructions.s b/test/MC/Mips/mips-jump-instructions.s
index bc2d720398..1dcb287738 100644
--- a/test/MC/Mips/mips-jump-instructions.s
+++ b/test/MC/Mips/mips-jump-instructions.s
@@ -1,30 +1,34 @@
-# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 | FileCheck %s
+# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 | \
+# RUN: FileCheck %s
# Check that the assembler can handle the documented syntax
# for jumps and branches.
# CHECK: .section __TEXT,__text,regular,pure_instructions
#------------------------------------------------------------------------------
# Branch instructions
#------------------------------------------------------------------------------
-# CHECK: b 1332 # encoding: [0x34,0x05,0x00,0x10]
+# CHECK: b 1332 # encoding: [0x4d,0x01,0x00,0x10]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
-# CHECK: bc1f 1332 # encoding: [0x34,0x05,0x00,0x45]
+# CHECK: bc1f 1332 # encoding: [0x4d,0x01,0x00,0x45]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
-# CHECK: bc1t 1332 # encoding: [0x34,0x05,0x01,0x45]
+# CHECK: bc1t 1332 # encoding: [0x4d,0x01,0x01,0x45]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
-# CHECK: beq $9, $6, 1332 # encoding: [0x34,0x05,0x26,0x11]
+# CHECK: beq $9, $6, 1332 # encoding: [0x4d,0x01,0x26,0x11]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
-# CHECK: bgez $6, 1332 # encoding: [0x34,0x05,0xc1,0x04]
+# CHECK: bgez $6, 1332 # encoding: [0x4d,0x01,0xc1,0x04]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
-# CHECK: bgezal $6, 1332 # encoding: [0x34,0x05,0xd1,0x04]
+# CHECK: bgezal $6, 1332 # encoding: [0x4d,0x01,0xd1,0x04]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
-# CHECK: bgtz $6, 1332 # encoding: [0x34,0x05,0xc0,0x1c]
+# CHECK: bgtz $6, 1332 # encoding: [0x4d,0x01,0xc0,0x1c]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
-# CHECK: blez $6, 1332 # encoding: [0x34,0x05,0xc0,0x18]
+# CHECK: blez $6, 1332 # encoding: [0x4d,0x01,0xc0,0x18]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
-# CHECK: bne $9, $6, 1332 # encoding: [0x34,0x05,0x26,0x15]
+# CHECK: bne $9, $6, 1332 # encoding: [0x4d,0x01,0x26,0x15]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
-# CHECK: bal 1332 # encoding: [0x34,0x05,0x11,0x04]
+# CHECK: bal 1332 # encoding: [0x4d,0x01,0x11,0x04]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
+
+.set noreorder
+
b 1332
nop
bc1f 1332
@@ -50,9 +54,9 @@ end_of_code:
#------------------------------------------------------------------------------
# Jump instructions
#------------------------------------------------------------------------------
-# CHECK: j 1328 # encoding: [0x30,0x05,0x00,0x08]
+# CHECK: j 1328 # encoding: [0x4c,0x01,0x00,0x08]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
-# CHECK: jal 1328 # encoding: [0x30,0x05,0x00,0x0c]
+# CHECK: jal 1328 # encoding: [0x4c,0x01,0x00,0x0c]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK: jalr $6 # encoding: [0x09,0xf8,0xc0,0x00]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
@@ -63,6 +67,11 @@ end_of_code:
# CHECK: jr $7 # encoding: [0x08,0x00,0xe0,0x00]
# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK: jr $7 # encoding: [0x08,0x00,0xe0,0x00]
+# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
+# CHECK: jalr $25 # encoding: [0x09,0xf8,0x20,0x03]
+# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
+# CHECK: jalr $4, $25 # encoding: [0x09,0x20,0x20,0x03]
+# CHECK: nop # encoding: [0x00,0x00,0x00,0x00]
j 1328
@@ -78,3 +87,8 @@ end_of_code:
jr $7
nop
j $7
+ nop
+ jal $25
+ nop
+ jal $4,$25
+ nop
diff --git a/test/MC/Mips/mips_directives.s b/test/MC/Mips/mips_directives.s
index 65d584dfa8..df7e645633 100644
--- a/test/MC/Mips/mips_directives.s
+++ b/test/MC/Mips/mips_directives.s
@@ -17,3 +17,9 @@ $JTI0_0:
.set macro
.set reorder
.set at=$a0
+ .set STORE_MASK,$t7
+ .set FPU_MASK,$f7
+#CHECK: abs.s $f6, $f7 # encoding: [0x46,0x00,0x39,0x85]
+#CHECK: and $3, $15, $15 # encoding: [0x01,0xef,0x18,0x24]
+ abs.s $f6,FPU_MASK
+ and $3,$t7,STORE_MASK