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-11-24 14:39:13 +00:00
|
|
|
# CHECK-EL: lbu16 $3, 4($17) # encoding: [0x94,0x09]
|
2014-11-26 18:56:38 +00:00
|
|
|
# CHECK-EL: lbu16 $3, -1($16) # encoding: [0x8f,0x09]
|
2014-11-24 14:39:13 +00:00
|
|
|
# CHECK-EL: lhu16 $3, 4($16) # encoding: [0x82,0x29]
|
|
|
|
# CHECK-EL: lw16 $4, 8($17) # encoding: [0x12,0x6a]
|
|
|
|
# CHECK-EL: sb16 $3, 4($16) # encoding: [0x84,0x89]
|
|
|
|
# CHECK-EL: sh16 $4, 8($17) # encoding: [0x14,0xaa]
|
|
|
|
# CHECK-EL: sw16 $4, 4($17) # encoding: [0x11,0xea]
|
|
|
|
# CHECK-EL: sw16 $zero, 4($17) # encoding: [0x11,0xe8]
|
2015-01-28 17:27:26 +00:00
|
|
|
# CHECK-EL: lw $3, 32($gp) # encoding: [0x88,0x65]
|
2014-12-23 16:16:33 +00:00
|
|
|
# CHECK-EL: lw $3, 32($sp) # encoding: [0x68,0x48]
|
|
|
|
# CHECK-EL: sw $4, 124($sp) # encoding: [0x9f,0xc8]
|
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-12-01 11:12:04 +00:00
|
|
|
# CHECK-EL: addiusp -1028 # encoding: [0xff,0x4f]
|
|
|
|
# CHECK-EL: addiusp -1032 # encoding: [0xfd,0x4f]
|
|
|
|
# CHECK-EL: addiusp 1024 # encoding: [0x01,0x4c]
|
|
|
|
# CHECK-EL: addiusp 1028 # encoding: [0x03,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]
|
2014-11-24 16:14:10 +00:00
|
|
|
# CHECK-NEXT: jalrs16 $9 # encoding: [0xe9,0x45]
|
2014-11-29 13:29:24 +00:00
|
|
|
# CHECK-EL: nop # 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]
|
2015-01-12 12:03:34 +00:00
|
|
|
# CHECK-EL: beqz16 $6, 20 # encoding: [0x0a,0x8f]
|
|
|
|
# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00]
|
|
|
|
# CHECK-EL: bnez16 $6, 20 # encoding: [0x0a,0xaf]
|
|
|
|
# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00]
|
2015-01-21 12:39:30 +00:00
|
|
|
# CHECK-EL: b16 132 # encoding: [0x42,0xcc]
|
|
|
|
# CHECK-EL: nop
|
|
|
|
# CHECK-EL: b16 132 # encoding: [0x42,0xcc]
|
|
|
|
# CHECK-EL: nop
|
2014-11-27 18:18:42 +00:00
|
|
|
# CHECK-EL: break16 8 # encoding: [0x88,0x46]
|
|
|
|
# CHECK-EL: sdbbp16 14 # encoding: [0xce,0x46]
|
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-11-24 14:39:13 +00:00
|
|
|
# CHECK-EB: lbu16 $3, 4($17) # encoding: [0x09,0x94]
|
2014-11-26 18:56:38 +00:00
|
|
|
# CHECK-EB: lbu16 $3, -1($16) # encoding: [0x09,0x8f]
|
2014-11-24 14:39:13 +00:00
|
|
|
# CHECK-EB: lhu16 $3, 4($16) # encoding: [0x29,0x82]
|
|
|
|
# CHECK-EB: lw16 $4, 8($17) # encoding: [0x6a,0x12]
|
|
|
|
# CHECK-EB: sb16 $3, 4($16) # encoding: [0x89,0x84]
|
|
|
|
# CHECK-EB: sh16 $4, 8($17) # encoding: [0xaa,0x14]
|
|
|
|
# CHECK-EB: sw16 $4, 4($17) # encoding: [0xea,0x11]
|
|
|
|
# CHECK-EB: sw16 $zero, 4($17) # encoding: [0xe8,0x11]
|
2015-01-28 17:27:26 +00:00
|
|
|
# CHECK-EB: lw $3, 32($gp) # encoding: [0x65,0x88]
|
2014-12-23 16:16:33 +00:00
|
|
|
# CHECK-EB: lw $3, 32($sp) # encoding: [0x48,0x68]
|
|
|
|
# CHECK-EB: sw $4, 124($sp) # encoding: [0xc8,0x9f]
|
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-12-01 11:12:04 +00:00
|
|
|
# CHECK-EB: addiusp -1028 # encoding: [0x4f,0xff]
|
|
|
|
# CHECK-EB: addiusp -1032 # encoding: [0x4f,0xfd]
|
|
|
|
# CHECK-EB: addiusp 1024 # encoding: [0x4c,0x01]
|
|
|
|
# CHECK-EB: addiusp 1028 # encoding: [0x4c,0x03]
|
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]
|
2014-11-24 16:14:10 +00:00
|
|
|
# CHECK-NEXT: jalrs16 $9 # encoding: [0x45,0xe9]
|
2014-11-29 13:29:24 +00:00
|
|
|
# CHECK-EB: nop # 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]
|
2015-01-12 12:03:34 +00:00
|
|
|
# CHECK-EB: beqz16 $6, 20 # encoding: [0x8f,0x0a]
|
|
|
|
# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00]
|
|
|
|
# CHECK-EB: bnez16 $6, 20 # encoding: [0xaf,0x0a]
|
|
|
|
# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00]
|
2015-01-21 12:39:30 +00:00
|
|
|
# CHECK-EB: b16 132 # encoding: [0xcc,0x42]
|
|
|
|
# CHECK-EB: nop
|
|
|
|
# CHECK-EB: b16 132 # encoding: [0xcc,0x42]
|
|
|
|
# CHECK-EB: nop
|
2014-11-27 18:18:42 +00:00
|
|
|
# CHECK-EB: break16 8 # encoding: [0x46,0x88]
|
|
|
|
# CHECK-EB: sdbbp16 14 # encoding: [0x46,0xce]
|
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-11-24 14:39:13 +00:00
|
|
|
lbu16 $3, 4($17)
|
2014-11-26 18:56:38 +00:00
|
|
|
lbu16 $3, -1($16)
|
2014-11-24 14:39:13 +00:00
|
|
|
lhu16 $3, 4($16)
|
|
|
|
lw16 $4, 8($17)
|
|
|
|
sb16 $3, 4($16)
|
|
|
|
sh16 $4, 8($17)
|
|
|
|
sw16 $4, 4($17)
|
|
|
|
sw16 $0, 4($17)
|
2015-01-28 17:27:26 +00:00
|
|
|
lw $3, 32($gp)
|
2014-12-23 16:16:33 +00:00
|
|
|
lw $3, 32($sp)
|
|
|
|
sw $4, 124($sp)
|
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-12-01 11:12:04 +00:00
|
|
|
addiusp -1028
|
|
|
|
addiusp -1032
|
|
|
|
addiusp 1024
|
|
|
|
addiusp 1028
|
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
|
2015-01-12 12:03:34 +00:00
|
|
|
beqz16 $6, 20
|
|
|
|
bnez16 $6, 20
|
2015-01-21 12:39:30 +00:00
|
|
|
b 132
|
|
|
|
b16 132
|
2014-11-27 18:18:42 +00:00
|
|
|
break16 8
|
|
|
|
sdbbp16 14
|