2014-03-20 10:18:24 +00:00
|
|
|
# RUN: llvm-mc %s -triple=mipsel -show-encoding -mattr=micromips | \
|
|
|
|
# RUN: FileCheck -check-prefix=CHECK-EL %s
|
|
|
|
# RUN: llvm-mc %s -triple=mips -show-encoding -mattr=micromips | \
|
|
|
|
# RUN: FileCheck -check-prefix=CHECK-EB %s
|
|
|
|
# Check that the assembler can handle the documented syntax
|
|
|
|
# for arithmetic and logical instructions.
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# MicroMIPS 16-bit Instructions
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Little endian
|
|
|
|
#------------------------------------------------------------------------------
|
2014-10-21 08:44:58 +00:00
|
|
|
# CHECK-EL: addu16 $6, $17, $4 # encoding: [0x42,0x07]
|
|
|
|
# CHECK-EL: subu16 $5, $16, $3 # encoding: [0xb1,0x06]
|
2014-11-05 17:31:00 +00:00
|
|
|
# CHECK-EL: andi16 $16, $2, 31 # encoding: [0x29,0x2c]
|
2014-10-21 08:32:40 +00:00
|
|
|
# CHECK-EL: and16 $16, $2 # encoding: [0x82,0x44]
|
|
|
|
# CHECK-EL: not16 $17, $3 # encoding: [0x0b,0x44]
|
|
|
|
# CHECK-EL: or16 $16, $4 # encoding: [0xc4,0x44]
|
|
|
|
# CHECK-EL: xor16 $17, $5 # encoding: [0x4d,0x44]
|
2014-10-23 10:42:01 +00:00
|
|
|
# CHECK-EL: sll16 $3, $16, 5 # encoding: [0x8a,0x25]
|
|
|
|
# CHECK-EL: srl16 $4, $17, 6 # encoding: [0x1d,0x26]
|
2014-10-23 10:59:24 +00:00
|
|
|
# CHECK-EL: li16 $3, -1 # encoding: [0xff,0xed]
|
|
|
|
# CHECK-EL: li16 $3, 126 # encoding: [0xfe,0xed]
|
2014-10-23 11:13:59 +00:00
|
|
|
# CHECK-EL: addiur1sp $7, 4 # encoding: [0x83,0x6f]
|
2014-10-23 11:06:34 +00:00
|
|
|
# CHECK-EL: addiur2 $6, $7, -1 # encoding: [0x7e,0x6f]
|
|
|
|
# CHECK-EL: addiur2 $6, $7, 12 # encoding: [0x76,0x6f]
|
2014-10-10 13:45:34 +00:00
|
|
|
# CHECK-EL: addius5 $7, -2 # encoding: [0xfc,0x4c]
|
2014-10-10 14:37:30 +00:00
|
|
|
# CHECK-EL: addiusp -16 # encoding: [0xf9,0x4f]
|
2014-04-03 12:47:34 +00:00
|
|
|
# CHECK-EL: mfhi $9 # encoding: [0x09,0x46]
|
|
|
|
# CHECK-EL: mflo $9 # encoding: [0x49,0x46]
|
2014-03-20 10:18:24 +00:00
|
|
|
# CHECK-EL: move $25, $1 # encoding: [0x21,0x0f]
|
2014-10-10 13:31:18 +00:00
|
|
|
# CHECK-EL: jrc $9 # encoding: [0xa9,0x45]
|
|
|
|
# CHECK-NEXT: jalr $9 # encoding: [0xc9,0x45]
|
2014-09-12 14:29:54 +00:00
|
|
|
# CHECK-EL: jraddiusp 20 # encoding: [0x05,0x47]
|
|
|
|
# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00]
|
2014-10-10 13:22:28 +00:00
|
|
|
# CHECK-EL: jalrs16 $9 # encoding: [0xe9,0x45]
|
|
|
|
# CHECK-EL: move $zero, $zero # encoding: [0x00,0x0c]
|
2014-10-10 14:02:44 +00:00
|
|
|
# CHECK-EL: jr16 $9 # encoding: [0x89,0x45]
|
|
|
|
# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00]
|
2014-03-20 10:18:24 +00:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Big endian
|
|
|
|
#------------------------------------------------------------------------------
|
2014-10-21 08:44:58 +00:00
|
|
|
# CHECK-EB: addu16 $6, $17, $4 # encoding: [0x07,0x42]
|
|
|
|
# CHECK-EB: subu16 $5, $16, $3 # encoding: [0x06,0xb1]
|
2014-11-05 17:31:00 +00:00
|
|
|
# CHECK-EB: andi16 $16, $2, 31 # encoding: [0x2c,0x29]
|
2014-10-21 08:32:40 +00:00
|
|
|
# CHECK-EB: and16 $16, $2 # encoding: [0x44,0x82]
|
|
|
|
# CHECK-EB: not16 $17, $3 # encoding: [0x44,0x0b]
|
|
|
|
# CHECK-EB: or16 $16, $4 # encoding: [0x44,0xc4]
|
|
|
|
# CHECK-EB: xor16 $17, $5 # encoding: [0x44,0x4d]
|
2014-10-23 10:42:01 +00:00
|
|
|
# CHECK-EB: sll16 $3, $16, 5 # encoding: [0x25,0x8a]
|
|
|
|
# CHECK-EB: srl16 $4, $17, 6 # encoding: [0x26,0x1d]
|
2014-10-23 10:59:24 +00:00
|
|
|
# CHECK-EB: li16 $3, -1 # encoding: [0xed,0xff]
|
|
|
|
# CHECK-EB: li16 $3, 126 # encoding: [0xed,0xfe]
|
2014-10-23 11:13:59 +00:00
|
|
|
# CHECK-EB: addiur1sp $7, 4 # encoding: [0x6f,0x83]
|
2014-10-23 11:06:34 +00:00
|
|
|
# CHECK-EB: addiur2 $6, $7, -1 # encoding: [0x6f,0x7e]
|
|
|
|
# CHECK-EB: addiur2 $6, $7, 12 # encoding: [0x6f,0x76]
|
2014-10-10 13:45:34 +00:00
|
|
|
# CHECK-EB: addius5 $7, -2 # encoding: [0x4c,0xfc]
|
2014-10-10 14:37:30 +00:00
|
|
|
# CHECK-EB: addiusp -16 # encoding: [0x4f,0xf9]
|
2014-04-03 12:47:34 +00:00
|
|
|
# CHECK-EB: mfhi $9 # encoding: [0x46,0x09]
|
|
|
|
# CHECK-EB: mflo $9 # encoding: [0x46,0x49]
|
2014-03-20 10:18:24 +00:00
|
|
|
# CHECK-EB: move $25, $1 # encoding: [0x0f,0x21]
|
2014-10-10 13:31:18 +00:00
|
|
|
# CHECK-EB: jrc $9 # encoding: [0x45,0xa9]
|
|
|
|
# CHECK-NEXT: jalr $9 # encoding: [0x45,0xc9]
|
2014-09-12 14:29:54 +00:00
|
|
|
# CHECK-EB: jraddiusp 20 # encoding: [0x47,0x05]
|
|
|
|
# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00]
|
2014-10-10 13:22:28 +00:00
|
|
|
# CHECK-EB: jalrs16 $9 # encoding: [0x45,0xe9]
|
|
|
|
# CHECK-EB: move $zero, $zero # encoding: [0x0c,0x00]
|
2014-10-10 14:02:44 +00:00
|
|
|
# CHECK-EB: jr16 $9 # encoding: [0x45,0x89]
|
|
|
|
# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00]
|
2014-03-20 10:18:24 +00:00
|
|
|
|
2014-10-21 08:44:58 +00:00
|
|
|
addu16 $6, $17, $4
|
|
|
|
subu16 $5, $16, $3
|
2014-11-05 17:31:00 +00:00
|
|
|
andi16 $16, $2, 31
|
2014-10-21 08:32:40 +00:00
|
|
|
and16 $16, $2
|
|
|
|
not16 $17, $3
|
|
|
|
or16 $16, $4
|
|
|
|
xor16 $17, $5
|
2014-10-23 10:42:01 +00:00
|
|
|
sll16 $3, $16, 5
|
|
|
|
srl16 $4, $17, 6
|
2014-10-23 10:59:24 +00:00
|
|
|
li16 $3, -1
|
|
|
|
li16 $3, 126
|
2014-10-23 11:13:59 +00:00
|
|
|
addiur1sp $7, 4
|
2014-10-23 11:06:34 +00:00
|
|
|
addiur2 $6, $7, -1
|
|
|
|
addiur2 $6, $7, 12
|
2014-10-10 13:45:34 +00:00
|
|
|
addius5 $7, -2
|
2014-10-10 14:37:30 +00:00
|
|
|
addiusp -16
|
2014-04-03 12:47:34 +00:00
|
|
|
mfhi $9
|
|
|
|
mflo $9
|
2014-03-20 10:18:24 +00:00
|
|
|
move $25, $1
|
2014-10-10 13:31:18 +00:00
|
|
|
jrc $9
|
2014-03-20 10:18:24 +00:00
|
|
|
jalr $9
|
2014-09-12 14:29:54 +00:00
|
|
|
jraddiusp 20
|
2014-10-10 13:22:28 +00:00
|
|
|
jalrs16 $9
|
2014-10-10 14:02:44 +00:00
|
|
|
jr16 $9
|