diff options
Diffstat (limited to 'test/MC/Mips')
-rw-r--r-- | test/MC/Mips/elf-tls.s | 2 | ||||
-rw-r--r-- | test/MC/Mips/insn-directive.s | 98 | ||||
-rw-r--r-- | test/MC/Mips/micromips-alias.s | 12 | ||||
-rw-r--r-- | test/MC/Mips/mips-expansions-bad.s | 8 | ||||
-rw-r--r-- | test/MC/Mips/mips-expansions.s | 14 | ||||
-rw-r--r-- | test/MC/Mips/mips-jump-delay-slots.s | 6 | ||||
-rw-r--r-- | test/MC/Mips/mips1/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips2/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips3/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips32/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips32r2/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips32r3/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips32r5/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips32r6/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips4/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips5/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips64/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips64r2/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips64r3/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips64r5/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/mips64r6/valid.s | 9 | ||||
-rw-r--r-- | test/MC/Mips/set-defined-symbol.s | 18 | ||||
-rw-r--r-- | test/MC/Mips/sort-relocation-table.s | 125 | ||||
-rw-r--r-- | test/MC/Mips/xgot.s | 2 |
24 files changed, 400 insertions, 20 deletions
diff --git a/test/MC/Mips/elf-tls.s b/test/MC/Mips/elf-tls.s index d32a699..d50f62c 100644 --- a/test/MC/Mips/elf-tls.s +++ b/test/MC/Mips/elf-tls.s @@ -3,7 +3,7 @@ // Check that the appropriate relocations were created. // CHECK: Relocations [ -// CHECK: Section (2) .rel.text { +// CHECK: Section {{.*}} .rel.text { // CHECK: R_MIPS_TLS_LDM // CHECK: R_MIPS_TLS_DTPREL_HI16 // CHECK: R_MIPS_TLS_DTPREL_LO16 diff --git a/test/MC/Mips/insn-directive.s b/test/MC/Mips/insn-directive.s new file mode 100644 index 0000000..760a273 --- /dev/null +++ b/test/MC/Mips/insn-directive.s @@ -0,0 +1,98 @@ +# RUN: llvm-mc %s -arch=mips -mcpu=mips32 | FileCheck %s --check-prefix=ASM + +# RUN: llvm-mc %s -arch=mips -mcpu=mips32 -filetype=obj -o - | \ +# RUN: llvm-readobj -symbols - | FileCheck %s --check-prefix=OBJ + + .set micromips + + .global f_mm_insn_data + .type f_mm_insn_data, @function +f_mm_insn_data: + .insn + .word 0x00e73910 # add $7, $7, $7 + + .global f_mm_insn_instr + .type f_mm_insn_instr, @function +f_mm_insn_instr: + .insn + add $7, $7, $7 + + .global o_mm_insn_data + .type o_mm_insn_data, @object +o_mm_insn_data: + .insn + .word 0x00e73910 # add $7, $7, $7 + + .global o_mm_insn_instr + .type o_mm_insn_instr, @object +o_mm_insn_instr: + .insn + add $7, $7, $7 + + .set nomicromips + + .global f_normal_insn_data + .type f_normal_insn_data, @function +f_normal_insn_data: + .insn + .word 0x00e73820 # add $7, $7, $7 + + .global f_normal_insn_instr + .type f_normal_insn_instr, @function +f_normal_insn_instr: + .insn + add $7, $7, $7 + + .global o_normal_insn_data + .type o_normal_insn_data, @object +o_normal_insn_data: + .insn + .word 0x00e73820 # add $7, $7, $7 + + .global o_normal_insn_instr + .type o_normal_insn_instr, @object +o_normal_insn_instr: + .insn + add $7, $7, $7 + +# Verify that .insn causes the currently saved labels to be cleared by checking +# that foo doesn't get marked. + .set nomicromips +foo: + .insn + .word 0x00e73820 # add $7, $7, $7 + + .set micromips +bar: + add $7, $7, $7 + +# ASM: .insn + +# OBJ: Symbols [ +# OBJ: Name: foo +# OBJ: Other: 0 + +# OBJ: Name: f_mm_insn_data +# OBJ: Other: 128 + +# OBJ: Name: f_mm_insn_instr +# OBJ: Other: 128 + +# OBJ: Name: f_normal_insn_data +# OBJ: Other: 0 + +# OBJ: Name: f_normal_insn_instr +# OBJ: Other: 0 + +# OBJ: Name: o_mm_insn_data +# OBJ: Other: 128 + +# OBJ: Name: o_mm_insn_instr +# OBJ: Other: 128 + +# OBJ: Name: o_normal_insn_data +# OBJ: Other: 0 + +# OBJ: Name: o_normal_insn_instr +# OBJ: Other: 0 +# OBJ: ] diff --git a/test/MC/Mips/micromips-alias.s b/test/MC/Mips/micromips-alias.s index c0bf4b3..256b3b6 100644 --- a/test/MC/Mips/micromips-alias.s +++ b/test/MC/Mips/micromips-alias.s @@ -14,3 +14,15 @@ f: nop .globl bar bar = f + +# CHECK: Name: foo +# CHECK: Other: 128 + .type o,@object + .set micromips +o: + .insn + .word 0x00000000 + .set nomicromips + + .globl foo +foo = o diff --git a/test/MC/Mips/mips-expansions-bad.s b/test/MC/Mips/mips-expansions-bad.s index 8d85169..d9bac20 100644 --- a/test/MC/Mips/mips-expansions-bad.s +++ b/test/MC/Mips/mips-expansions-bad.s @@ -1,6 +1,8 @@ # RUN: not llvm-mc %s -arch=mips -mcpu=mips32r2 2>%t1 # RUN: FileCheck %s < %t1 - .text - li $5, 0x100000000 # CHECK: :[[@LINE]]:9: error: instruction requires a 64-bit architecture - dli $5, 1 # CHECK: :[[@LINE]]:9: error: instruction requires a 64-bit architecture + .text + li $5, 0x100000000 + # CHECK: :[[@LINE-1]]:3: error: instruction requires a 64-bit architecture + dli $5, 1 + # CHECK: :[[@LINE-1]]:3: error: instruction requires a 64-bit architecture diff --git a/test/MC/Mips/mips-expansions.s b/test/MC/Mips/mips-expansions.s index bdc76fb..490b814 100644 --- a/test/MC/Mips/mips-expansions.s +++ b/test/MC/Mips/mips-expansions.s @@ -50,6 +50,17 @@ # CHECK: addu $1, $1, $9 # encoding: [0x21,0x08,0x29,0x00] # CHECK: sw $10, 57920($1) # encoding: [0x40,0xe2,0x2a,0xac] +# CHECK: lui $8, %hi(symbol) # encoding: [A,A,0x08,0x3c] +# CHECK: # fixup A - offset: 0, value: symbol@ABS_HI, kind: fixup_Mips_HI16 +# CHECK-NOT: move $8, $8 # encoding: [0x21,0x40,0x00,0x01] +# CHECK: lw $8, %lo(symbol)($8) # encoding: [A,A,0x08,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-NOT: move $1, $1 # encoding: [0x21,0x08,0x20,0x00] +# CHECK: sw $8, %lo(symbol)($1) # encoding: [A,A,0x28,0xac] +# CHECK: # fixup A - offset: 0, value: symbol@ABS_LO, kind: fixup_Mips_LO16 + # CHECK: lui $1, %hi(symbol) # CHECK: ldc1 $f0, %lo(symbol)($1) # CHECK: lui $1, %hi(symbol) @@ -77,5 +88,8 @@ lw $t2, 655483($a0) sw $t2, 123456($t1) + lw $8, symbol + sw $8, symbol + ldc1 $f0, symbol sdc1 $f0, symbol diff --git a/test/MC/Mips/mips-jump-delay-slots.s b/test/MC/Mips/mips-jump-delay-slots.s index 49f6c15..c52416f 100644 --- a/test/MC/Mips/mips-jump-delay-slots.s +++ b/test/MC/Mips/mips-jump-delay-slots.s @@ -68,9 +68,15 @@ # CHECK: beql $9, $6, 1332 # CHECK-NOT: nop beql $9,$6,1332 + # CHECK: beql $9, $zero, 1332 + # CHECK-NOT: nop + beqzl $9,1332 # CHECK: bnel $9, $6, 1332 # CHECK-NOT: nop bnel $9,$6,1332 + # CHECK: bnel $9, $zero, 1332 + # CHECK-NOT: nop + bnezl $9,1332 # CHECK: bgezl $6, 1332 # CHECK-NOT: nop bgezl $6,1332 diff --git a/test/MC/Mips/mips1/valid.s b/test/MC/Mips/mips1/valid.s index d18f6f5..e2feeac 100644 --- a/test/MC/Mips/mips1/valid.s +++ b/test/MC/Mips/mips1/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips1 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -41,6 +41,11 @@ div.s $f4,$f5,$f15 divu $zero,$25,$15 ehb # CHECK: ehb # encoding: [0x00,0x00,0x00,0xc0] + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] lb $24,-14515($10) lbu $8,30195($v1) lh $11,-8556($s5) @@ -117,3 +122,5 @@ tlbwr # CHECK: tlbwr # encoding: [0x42,0x00,0x00,0x06] xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] + +1: diff --git a/test/MC/Mips/mips2/valid.s b/test/MC/Mips/mips2/valid.s index 6ee6512..93fdbaf 100644 --- a/test/MC/Mips/mips2/valid.s +++ b/test/MC/Mips/mips2/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips2 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -57,6 +57,11 @@ ehb # CHECK: ehb # encoding: [0x00,0x00,0x00,0xc0] floor.w.d $f14,$f11 floor.w.s $f8,$f9 + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] lb $24,-14515($10) lbu $8,30195($v1) ldc1 $f11,16391($s0) @@ -166,3 +171,5 @@ trunc.w.s $f28,$f30 xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] + +1: diff --git a/test/MC/Mips/mips3/valid.s b/test/MC/Mips/mips3/valid.s index 6d55079..954631d 100644 --- a/test/MC/Mips/mips3/valid.s +++ b/test/MC/Mips/mips3/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips64-unknown-linux -show-encoding -mcpu=mips3 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -109,6 +109,11 @@ floor.l.s $f12,$f5 floor.w.d $f14,$f11 floor.w.s $f8,$f9 + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] lb $24,-14515($10) lbu $8,30195($v1) ld $sp,-28645($s1) @@ -229,3 +234,5 @@ trunc.w.s $f28,$f30 xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] + +1: diff --git a/test/MC/Mips/mips32/valid.s b/test/MC/Mips/mips32/valid.s index ba75d77..3765044 100644 --- a/test/MC/Mips/mips32/valid.s +++ b/test/MC/Mips/mips32/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -66,6 +66,11 @@ eret floor.w.d $f14,$f11 floor.w.s $f8,$f9 + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] lb $24,-14515($10) lbu $8,30195($v1) ldc1 $f11,16391($s0) @@ -196,3 +201,5 @@ trunc.w.s $f28,$f30 xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] + +1: diff --git a/test/MC/Mips/mips32r2/valid.s b/test/MC/Mips/mips32r2/valid.s index 61be290..ee7af3f 100644 --- a/test/MC/Mips/mips32r2/valid.s +++ b/test/MC/Mips/mips32r2/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32r2 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -72,6 +72,11 @@ eret floor.w.d $f14,$f11 floor.w.s $f8,$f9 + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] jr.hb $4 # CHECK: jr.hb $4 # encoding: [0x00,0x80,0x04,0x08] jalr.hb $4 # CHECK: jalr.hb $4 # encoding: [0x00,0x80,0xfc,0x09] jalr.hb $4, $5 # CHECK: jalr.hb $4, $5 # encoding: [0x00,0xa0,0x24,0x09] @@ -235,3 +240,5 @@ xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] synci -15842($a2) # CHECK: synci -15842($6) # encoding: [0x04,0xdf,0xc2,0x1e] + +1: diff --git a/test/MC/Mips/mips32r3/valid.s b/test/MC/Mips/mips32r3/valid.s index ff6589d..0a4e5b1 100644 --- a/test/MC/Mips/mips32r3/valid.s +++ b/test/MC/Mips/mips32r3/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32r3 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -72,6 +72,11 @@ eret floor.w.d $f14,$f11 floor.w.s $f8,$f9 + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] jr.hb $4 # CHECK: jr.hb $4 # encoding: [0x00,0x80,0x04,0x08] jalr.hb $4 # CHECK: jalr.hb $4 # encoding: [0x00,0x80,0xfc,0x09] jalr.hb $4, $5 # CHECK: jalr.hb $4, $5 # encoding: [0x00,0xa0,0x24,0x09] @@ -235,3 +240,5 @@ xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] synci -15842($a2) # CHECK: synci -15842($6) # encoding: [0x04,0xdf,0xc2,0x1e] + +1: diff --git a/test/MC/Mips/mips32r5/valid.s b/test/MC/Mips/mips32r5/valid.s index 408d0cc..036b908 100644 --- a/test/MC/Mips/mips32r5/valid.s +++ b/test/MC/Mips/mips32r5/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32r5 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -72,6 +72,11 @@ eret floor.w.d $f14,$f11 floor.w.s $f8,$f9 + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] jr.hb $4 # CHECK: jr.hb $4 # encoding: [0x00,0x80,0x04,0x08] jalr.hb $4 # CHECK: jalr.hb $4 # encoding: [0x00,0x80,0xfc,0x09] jalr.hb $4, $5 # CHECK: jalr.hb $4, $5 # encoding: [0x00,0xa0,0x24,0x09] @@ -235,3 +240,5 @@ xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] synci -15842($a2) # CHECK: synci -15842($6) # encoding: [0x04,0xdf,0xc2,0x1e] + +1: diff --git a/test/MC/Mips/mips32r6/valid.s b/test/MC/Mips/mips32r6/valid.s index 7033d4a..2c3a5b2 100644 --- a/test/MC/Mips/mips32r6/valid.s +++ b/test/MC/Mips/mips32r6/valid.s @@ -12,7 +12,7 @@ # # RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32r6 2> %t0 | FileCheck %s # RUN: FileCheck %s -check-prefix=WARNING < %t0 - +a: .set noat # FIXME: Add the instructions carried forward from older ISA's and $2,4 # CHECK: andi $2, $2, 4 # encoding: [0x30,0x42,0x00,0x04] @@ -146,6 +146,11 @@ rint.d $f2, $f4 # CHECK: rint.d $f2, $f4 # encoding: [0x46,0x20,0x20,0x9a] class.s $f2, $f4 # CHECK: class.s $f2, $f4 # encoding: [0x46,0x00,0x20,0x9b] class.d $f2, $f4 # CHECK: class.d $f2, $f4 # encoding: [0x46,0x20,0x20,0x9b] + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] jr.hb $4 # CHECK: jr.hb $4 # encoding: [0x00,0x80,0x04,0x09] jalr.hb $4 # CHECK: jalr.hb $4 # encoding: [0x00,0x80,0xfc,0x09] jalr.hb $4, $5 # CHECK: jalr.hb $4, $5 # encoding: [0x00,0xa0,0x24,0x09] @@ -176,3 +181,5 @@ tne $6,$17 # CHECK: tne $6, $17 # encoding: [0x00,0xd1,0x00,0x36] tne $7,$8,885 # CHECK: tne $7, $8, 885 # encoding: [0x00,0xe8,0xdd,0x76] xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] + +1: diff --git a/test/MC/Mips/mips4/valid.s b/test/MC/Mips/mips4/valid.s index 7fcf781..a23990c 100644 --- a/test/MC/Mips/mips4/valid.s +++ b/test/MC/Mips/mips4/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips64-unknown-linux -show-encoding -mcpu=mips4 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -113,6 +113,11 @@ floor.l.s $f12,$f5 floor.w.d $f14,$f11 floor.w.s $f8,$f9 + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] lb $24,-14515($10) lbu $8,30195($v1) ld $sp,-28645($s1) @@ -258,3 +263,5 @@ trunc.w.s $f28,$f30 xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] + +1: diff --git a/test/MC/Mips/mips5/valid.s b/test/MC/Mips/mips5/valid.s index 4b1282e..094c07f 100644 --- a/test/MC/Mips/mips5/valid.s +++ b/test/MC/Mips/mips5/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips64-unknown-linux -show-encoding -mcpu=mips5 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -113,6 +113,11 @@ floor.l.s $f12,$f5 floor.w.d $f14,$f11 floor.w.s $f8,$f9 + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] lb $24,-14515($10) lbu $8,30195($v1) ld $sp,-28645($s1) @@ -260,3 +265,5 @@ trunc.w.s $f28,$f30 xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] + +1: diff --git a/test/MC/Mips/mips64/valid.s b/test/MC/Mips/mips64/valid.s index d900ab7..1a65152 100644 --- a/test/MC/Mips/mips64/valid.s +++ b/test/MC/Mips/mips64/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips64-unknown-linux -show-encoding -mcpu=mips64 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -118,6 +118,11 @@ floor.l.s $f12,$f5 floor.w.d $f14,$f11 floor.w.s $f8,$f9 + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] lb $24,-14515($10) lbu $8,30195($v1) ld $sp,-28645($s1) @@ -277,3 +282,5 @@ trunc.w.s $f28,$f30 xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] + +1: diff --git a/test/MC/Mips/mips64r2/valid.s b/test/MC/Mips/mips64r2/valid.s index 7193451..61b1d6d 100644 --- a/test/MC/Mips/mips64r2/valid.s +++ b/test/MC/Mips/mips64r2/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips64-unknown-linux -show-encoding -mcpu=mips64r2 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -131,6 +131,11 @@ floor.l.s $f12,$f5 floor.w.d $f14,$f11 floor.w.s $f8,$f9 + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] jr.hb $4 # CHECK: jr.hb $4 # encoding: [0x00,0x80,0x04,0x08] jalr.hb $4 # CHECK: jalr.hb $4 # encoding: [0x00,0x80,0xfc,0x09] jalr.hb $4, $5 # CHECK: jalr.hb $4, $5 # encoding: [0x00,0xa0,0x24,0x09] @@ -304,3 +309,5 @@ xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] wsbh $k1,$9 + +1: diff --git a/test/MC/Mips/mips64r3/valid.s b/test/MC/Mips/mips64r3/valid.s index 3a3f7ad..bfd16d3 100644 --- a/test/MC/Mips/mips64r3/valid.s +++ b/test/MC/Mips/mips64r3/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips64-unknown-linux -show-encoding -mcpu=mips64r3 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -131,6 +131,11 @@ floor.l.s $f12,$f5 floor.w.d $f14,$f11 floor.w.s $f8,$f9 + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] jr.hb $4 # CHECK: jr.hb $4 # encoding: [0x00,0x80,0x04,0x08] jalr.hb $4 # CHECK: jalr.hb $4 # encoding: [0x00,0x80,0xfc,0x09] jalr.hb $4, $5 # CHECK: jalr.hb $4, $5 # encoding: [0x00,0xa0,0x24,0x09] @@ -304,3 +309,5 @@ xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] wsbh $k1,$9 + +1: diff --git a/test/MC/Mips/mips64r5/valid.s b/test/MC/Mips/mips64r5/valid.s index 5ba102d..22c5093 100644 --- a/test/MC/Mips/mips64r5/valid.s +++ b/test/MC/Mips/mips64r5/valid.s @@ -1,7 +1,7 @@ # Instructions that are valid # # RUN: llvm-mc %s -triple=mips64-unknown-linux -show-encoding -mcpu=mips64r5 | FileCheck %s - +a: .set noat abs.d $f7,$f25 # CHECK: encoding: abs.s $f9,$f16 @@ -131,6 +131,11 @@ floor.l.s $f12,$f5 floor.w.d $f14,$f11 floor.w.s $f8,$f9 + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] jr.hb $4 # CHECK: jr.hb $4 # encoding: [0x00,0x80,0x04,0x08] jalr.hb $4 # CHECK: jalr.hb $4 # encoding: [0x00,0x80,0xfc,0x09] jalr.hb $4, $5 # CHECK: jalr.hb $4, $5 # encoding: [0x00,0xa0,0x24,0x09] @@ -304,3 +309,5 @@ xor $s2,$a0,$s8 xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] wsbh $k1,$9 + +1: diff --git a/test/MC/Mips/mips64r6/valid.s b/test/MC/Mips/mips64r6/valid.s index 600cb48..31a0d7f 100644 --- a/test/MC/Mips/mips64r6/valid.s +++ b/test/MC/Mips/mips64r6/valid.s @@ -12,7 +12,7 @@ # # RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips64r6 2> %t0 | FileCheck %s # RUN: FileCheck %s -check-prefix=WARNING < %t0 - +a: .set noat # FIXME: Add the instructions carried forward from older ISA's and $2,4 # CHECK: andi $2, $2, 4 # encoding: [0x30,0x42,0x00,0x04] @@ -165,6 +165,11 @@ rint.d $f2, $f4 # CHECK: rint.d $f2, $f4 # encoding: [0x46,0x20,0x20,0x9a] class.s $f2, $f4 # CHECK: class.s $f2, $f4 # encoding: [0x46,0x00,0x20,0x9b] class.d $f2, $f4 # CHECK: class.d $f2, $f4 # encoding: [0x46,0x20,0x20,0x9b] + j 1f # CHECK: j $tmp0 # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: ($tmp0), kind: fixup_Mips_26 + j a # CHECK: j a # encoding: [0b000010AA,A,A,A] + # CHECK: # fixup A - offset: 0, value: a, kind: fixup_Mips_26 + j 1328 # CHECK: j 1328 # encoding: [0x08,0x00,0x01,0x4c] jr.hb $4 # CHECK: jr.hb $4 # encoding: [0x00,0x80,0x04,0x09] jalr.hb $4 # CHECK: jalr.hb $4 # encoding: [0x00,0x80,0xfc,0x09] jalr.hb $4, $5 # CHECK: jalr.hb $4, $5 # encoding: [0x00,0xa0,0x24,0x09] @@ -199,3 +204,5 @@ tne $6,$17 # CHECK: tne $6, $17 # encoding: [0x00,0xd1,0x00,0x36] tne $7,$8,885 # CHECK: tne $7, $8, 885 # encoding: [0x00,0xe8,0xdd,0x76] xor $2, 4 # CHECK: xori $2, $2, 4 # encoding: [0x38,0x42,0x00,0x04] + +1: diff --git a/test/MC/Mips/set-defined-symbol.s b/test/MC/Mips/set-defined-symbol.s new file mode 100644 index 0000000..54db45d --- /dev/null +++ b/test/MC/Mips/set-defined-symbol.s @@ -0,0 +1,18 @@ +# RUN: llvm-mc %s -arch=mips -mcpu=mips32 -filetype=obj -o - | \ +# RUN: llvm-objdump -d -r -arch=mips - | FileCheck %s + + .global foo + .weak bar + .set bar, b + .set foo, b + .set foo, a +a: + nop +# CHECK-NOT: a: +# CHECK: foo: + +b: + nop +# CHECK-NOT: b: +# CHECK-NOT: foo: +# CHECK: bar: diff --git a/test/MC/Mips/sort-relocation-table.s b/test/MC/Mips/sort-relocation-table.s new file mode 100644 index 0000000..590f8fd --- /dev/null +++ b/test/MC/Mips/sort-relocation-table.s @@ -0,0 +1,125 @@ +# RUN: llvm-mc -filetype=obj -arch mipsel %s | llvm-readobj -r | FileCheck %s + +# Test the order of records in the relocation table. +# *HI16 and local *GOT16 relocations should be immediately followed by the +# corresponding *LO16 relocation against the same symbol. +# +# We try to implement the same semantics as gas, ie. to order the relocation +# table the same way as gas. +# +# gnu as command line: +# mips-linux-gnu-as -EL sort-relocation-table.s -o sort-relocation-table.o +# +# TODO: Add mips16 and micromips tests. +# Note: offsets are part of expected output, so it's simpler to add new test +# cases at the bottom of the file. + +# CHECK: Relocations [ +# CHECK-NEXT: { + +# Put HI before LO. +addiu $2,$2,%lo(sym1) +lui $2,%hi(sym1) + +# CHECK-NEXT: 0x4 R_MIPS_HI16 sym1 +# CHECK-NEXT: 0x0 R_MIPS_LO16 sym1 + +# When searching for a matching LO, ignore LOs against a different symbol. +addiu $2,$2,%lo(sym2) +lui $2,%hi(sym2) +addiu $2,$2,%lo(sym2_d) + +# CHECK-NEXT: 0xC R_MIPS_HI16 sym2 +# CHECK-NEXT: 0x8 R_MIPS_LO16 sym2 +# CHECK-NEXT: 0x10 R_MIPS_LO16 sym2_d + +# Match HI with 2nd LO because it has higher offset (than the 1st LO). +addiu $2,$2,%lo(sym3) +addiu $2,$2,%lo(sym3) +lui $2,%hi(sym3) + +# CHECK-NEXT: 0x14 R_MIPS_LO16 sym3 +# CHECK-NEXT: 0x1C R_MIPS_HI16 sym3 +# CHECK-NEXT: 0x18 R_MIPS_LO16 sym3 + +# HI is already followed by a matching LO, so don't look further, ie. ignore the +# "free" LO with higher offset. +lui $2,%hi(sym4) +addiu $2,$2,%lo(sym4) +addiu $2,$2,%lo(sym4) + +# CHECK-NEXT: 0x20 R_MIPS_HI16 sym4 +# CHECK-NEXT: 0x24 R_MIPS_LO16 sym4 +# CHECK-NEXT: 0x28 R_MIPS_LO16 sym4 + +# Match 2nd HI with 2nd LO, since it's the one with highest offset among the +# "free" ones. +addiu $2,$2,%lo(sym5) +addiu $2,$2,%lo(sym5) +lui $2,%hi(sym5) +addiu $2,$2,%lo(sym5) +lui $2,%hi(sym5) + +# CHECK-NEXT: 0x2C R_MIPS_LO16 sym5 +# CHECK-NEXT: 0x3C R_MIPS_HI16 sym5 +# CHECK-NEXT: 0x30 R_MIPS_LO16 sym5 +# CHECK-NEXT: 0x34 R_MIPS_HI16 sym5 +# CHECK-NEXT: 0x38 R_MIPS_LO16 sym5 + +# When more HIs are matched with one LO, sort them in descending order of +# offset. +addiu $2,$2,%lo(sym6) +lui $2,%hi(sym6) +lui $2,%hi(sym6) + +# CHECK-NEXT: 0x48 R_MIPS_HI16 sym6 +# CHECK-NEXT: 0x44 R_MIPS_HI16 sym6 +# CHECK-NEXT: 0x40 R_MIPS_LO16 sym6 + +# sym7 is a local symbol, so GOT relocation against it needs a matching LO. +sym7: +addiu $2,$2,%lo(sym7) +lui $2,%got(sym7) + +# CHECK-NEXT: 0x50 R_MIPS_GOT16 sym7 +# CHECK-NEXT: 0x4C R_MIPS_LO16 sym7 + +# sym8 is not a local symbol, don't look for a matching LO for GOT. +.global sym8 +addiu $2,$2,%lo(sym8) +lui $2,%got(sym8) + +# CHECK-NEXT: 0x54 R_MIPS_LO16 sym8 +# CHECK-NEXT: 0x58 R_MIPS_GOT16 sym8 + +# A small combination of previous checks. +symc1: +addiu $2,$2,%lo(symc1) +addiu $2,$2,%lo(symc1) +addiu $2,$2,%lo(symc1) +lui $2,%hi(symc1) +lui $2,%got(symc1) +addiu $2,$2,%lo(symc2) +lui $2,%hi(symc1) +lui $2,%hi(symc1) +lui $2,%got(symc2) +lui $2,%hi(symc1) +addiu $2,$2,%lo(symc1) +addiu $2,$2,%lo(symc2) +lui $2,%hi(symc1) +lui $2,%hi(symc1) + +# CHECK-NEXT: 0x78 R_MIPS_HI16 symc1 +# CHECK-NEXT: 0x74 R_MIPS_HI16 symc1 +# CHECK-NEXT: 0x6C R_MIPS_GOT16 symc1 +# CHECK-NEXT: 0x68 R_MIPS_HI16 symc1 +# CHECK-NEXT: 0x5C R_MIPS_LO16 symc1 +# CHECK-NEXT: 0x8C R_MIPS_HI16 symc1 +# CHECK-NEXT: 0x60 R_MIPS_LO16 symc1 +# CHECK-NEXT: 0x90 R_MIPS_HI16 symc1 +# CHECK-NEXT: 0x64 R_MIPS_LO16 symc1 +# CHECK-NEXT: 0x70 R_MIPS_LO16 symc2 +# CHECK-NEXT: 0x7C R_MIPS_GOT16 symc2 +# CHECK-NEXT: 0x80 R_MIPS_HI16 symc1 +# CHECK-NEXT: 0x84 R_MIPS_LO16 symc1 +# CHECK-NEXT: 0x88 R_MIPS_LO16 symc2 diff --git a/test/MC/Mips/xgot.s b/test/MC/Mips/xgot.s index 3084806..3380a85 100644 --- a/test/MC/Mips/xgot.s +++ b/test/MC/Mips/xgot.s @@ -9,8 +9,8 @@ // CHECK: 0x14 R_MIPS_GOT_HI16 ext_1 // CHECK: 0x1C R_MIPS_GOT_LO16 ext_1 // CHECK: 0x24 R_MIPS_CALL_HI16 printf -// CHECK: 0x2C R_MIPS_GOT16 $.str // CHECK: 0x30 R_MIPS_CALL_LO16 printf +// CHECK: 0x2C R_MIPS_GOT16 $.str // CHECK: 0x38 R_MIPS_LO16 $.str // CHECK: ] |