1 # RUN: llvm-mc %s -triple=mipsel -show-encoding -mattr=micromips | FileCheck -check-prefix=CHECK-EL %s 2 # RUN: llvm-mc %s -triple=mips -show-encoding -mattr=micromips | FileCheck -check-prefix=CHECK-EB %s 3 # Check that the assembler can handle the documented syntax 4 # for arithmetic and logical instructions. 5 #------------------------------------------------------------------------------ 6 # Arithmetic and Logical Instructions 7 #------------------------------------------------------------------------------ 8 # Little endian 9 #------------------------------------------------------------------------------ 10 # CHECK-EL: add $9, $6, $7 # encoding: [0xe6,0x00,0x10,0x49] 11 # CHECK-EL: addi $9, $6, 17767 # encoding: [0x26,0x11,0x67,0x45] 12 # CHECK-EL: addiu $9, $6, -15001 # encoding: [0x26,0x31,0x67,0xc5] 13 # CHECK-EL: addi $9, $6, 17767 # encoding: [0x26,0x11,0x67,0x45] 14 # CHECK-EL: addiu $9, $6, -15001 # encoding: [0x26,0x31,0x67,0xc5] 15 # CHECK-EL: addu $9, $6, $7 # encoding: [0xe6,0x00,0x50,0x49] 16 # CHECK-EL: sub $9, $6, $7 # encoding: [0xe6,0x00,0x90,0x49] 17 # CHECK-EL: subu $4, $3, $5 # encoding: [0xa3,0x00,0xd0,0x21] 18 # CHECK-EL: neg $6, $7 # encoding: [0xe0,0x00,0x90,0x31] 19 # CHECK-EL: negu $6, $7 # encoding: [0xe0,0x00,0xd0,0x31] 20 # CHECK-EL: slt $3, $3, $5 # encoding: [0xa3,0x00,0x50,0x1b] 21 # CHECK-EL: slti $3, $3, 103 # encoding: [0x63,0x90,0x67,0x00] 22 # CHECK-EL: slti $3, $3, 103 # encoding: [0x63,0x90,0x67,0x00] 23 # CHECK-EL: sltiu $3, $3, 103 # encoding: [0x63,0xb0,0x67,0x00] 24 # CHECK-EL: sltu $3, $3, $5 # encoding: [0xa3,0x00,0x90,0x1b] 25 # CHECK-EL: lui $9, 17767 # encoding: [0xa9,0x41,0x67,0x45] 26 # CHECK-EL: and $9, $6, $7 # encoding: [0xe6,0x00,0x50,0x4a] 27 # CHECK-EL: andi $9, $6, 17767 # encoding: [0x26,0xd1,0x67,0x45] 28 # CHECK-EL: andi $9, $6, 17767 # encoding: [0x26,0xd1,0x67,0x45] 29 # CHECK-EL: or $3, $4, $5 # encoding: [0xa4,0x00,0x90,0x1a] 30 # CHECK-EL: ori $9, $6, 17767 # encoding: [0x26,0x51,0x67,0x45] 31 # CHECK-EL: xor $3, $3, $5 # encoding: [0xa3,0x00,0x10,0x1b] 32 # CHECK-EL: xori $9, $6, 17767 # encoding: [0x26,0x71,0x67,0x45] 33 # CHECK-EL: xori $9, $6, 17767 # encoding: [0x26,0x71,0x67,0x45] 34 # CHECK-EL: nor $9, $6, $7 # encoding: [0xe6,0x00,0xd0,0x4a] 35 # CHECK-EL: not $7, $8 # encoding: [0x08,0x00,0xd0,0x3a] 36 # CHECK-EL: mul $9, $6, $7 # encoding: [0xe6,0x00,0x10,0x4a] 37 # CHECK-EL: mult $9, $7 # encoding: [0xe9,0x00,0x3c,0x8b] 38 # CHECK-EL: multu $9, $7 # encoding: [0xe9,0x00,0x3c,0x9b] 39 # CHECK-EL: div $zero, $9, $7 # encoding: [0xe9,0x00,0x3c,0xab] 40 # CHECK-EL: divu $zero, $9, $7 # encoding: [0xe9,0x00,0x3c,0xbb] 41 # CHECK-EL: addiupc $2, 20 # encoding: [0x00,0x79,0x05,0x00] 42 # CHECK-EL: addiupc $7, 16777212 # encoding: [0xbf,0x7b,0xff,0xff] 43 # CHECK-EL: addiupc $7, -16777216 # encoding: [0xc0,0x7b,0x00,0x00] 44 #------------------------------------------------------------------------------ 45 # Big endian 46 #------------------------------------------------------------------------------ 47 # CHECK-EB: add $9, $6, $7 # encoding: [0x00,0xe6,0x49,0x10] 48 # CHECK-EB: addi $9, $6, 17767 # encoding: [0x11,0x26,0x45,0x67] 49 # CHECK-EB: addiu $9, $6, -15001 # encoding: [0x31,0x26,0xc5,0x67] 50 # CHECK-EB: addi $9, $6, 17767 # encoding: [0x11,0x26,0x45,0x67] 51 # CHECK-EB: addiu $9, $6, -15001 # encoding: [0x31,0x26,0xc5,0x67] 52 # CHECK-EB: addu $9, $6, $7 # encoding: [0x00,0xe6,0x49,0x50] 53 # CHECK-EB: sub $9, $6, $7 # encoding: [0x00,0xe6,0x49,0x90] 54 # CHECK-EB: subu $4, $3, $5 # encoding: [0x00,0xa3,0x21,0xd0] 55 # CHECK-EB: neg $6, $7 # encoding: [0x00,0xe0,0x31,0x90] 56 # CHECK-EB: negu $6, $7 # encoding: [0x00,0xe0,0x31,0xd0] 57 # CHECK-EB: slt $3, $3, $5 # encoding: [0x00,0xa3,0x1b,0x50] 58 # CHECK-EB: slti $3, $3, 103 # encoding: [0x90,0x63,0x00,0x67] 59 # CHECK-EB: slti $3, $3, 103 # encoding: [0x90,0x63,0x00,0x67] 60 # CHECK-EB: sltiu $3, $3, 103 # encoding: [0xb0,0x63,0x00,0x67] 61 # CHECK-EB: sltu $3, $3, $5 # encoding: [0x00,0xa3,0x1b,0x90] 62 # CHECK-EB: lui $9, 17767 # encoding: [0x41,0xa9,0x45,0x67] 63 # CHECK-EB: and $9, $6, $7 # encoding: [0x00,0xe6,0x4a,0x50] 64 # CHECK-EB: andi $9, $6, 17767 # encoding: [0xd1,0x26,0x45,0x67] 65 # CHECK-EB: andi $9, $6, 17767 # encoding: [0xd1,0x26,0x45,0x67] 66 # CHECK-EB: or $3, $4, $5 # encoding: [0x00,0xa4,0x1a,0x90] 67 # CHECK-EB: ori $9, $6, 17767 # encoding: [0x51,0x26,0x45,0x67] 68 # CHECK-EB: xor $3, $3, $5 # encoding: [0x00,0xa3,0x1b,0x10] 69 # CHECK-EB: xori $9, $6, 17767 # encoding: [0x71,0x26,0x45,0x67] 70 # CHECK-EB: xori $9, $6, 17767 # encoding: [0x71,0x26,0x45,0x67] 71 # CHECK-EB: nor $9, $6, $7 # encoding: [0x00,0xe6,0x4a,0xd0] 72 # CHECK-EB: not $7, $8 # encoding: [0x00,0x08,0x3a,0xd0] 73 # CHECK-EB: mul $9, $6, $7 # encoding: [0x00,0xe6,0x4a,0x10] 74 # CHECK-EB: mult $9, $7 # encoding: [0x00,0xe9,0x8b,0x3c] 75 # CHECK-EB: multu $9, $7 # encoding: [0x00,0xe9,0x9b,0x3c] 76 # CHECK-EB: div $zero, $9, $7 # encoding: [0x00,0xe9,0xab,0x3c] 77 # CHECK-EB: divu $zero, $9, $7 # encoding: [0x00,0xe9,0xbb,0x3c] 78 # CHECK-EB: addiupc $2, 20 # encoding: [0x79,0x00,0x00,0x05] 79 # CHECK-EB: addiupc $7, 16777212 # encoding: [0x7b,0xbf,0xff,0xff] 80 # CHECK-EB: addiupc $7, -16777216 # encoding: [0x7b,0xc0,0x00,0x00] 81 add $9, $6, $7 82 add $9, $6, 17767 83 addu $9, $6, -15001 84 addi $9, $6, 17767 85 addiu $9, $6,-15001 86 addu $9, $6, $7 87 sub $9, $6, $7 88 subu $4, $3, $5 89 neg $6, $7 90 negu $6, $7 91 move $7, $8 92 slt $3, $3, $5 93 slt $3, $3, 103 94 slti $3, $3, 103 95 sltiu $3, $3, 103 96 sltu $3, $3, $5 97 lui $9, 17767 98 and $9, $6, $7 99 and $9, $6, 17767 100 andi $9, $6, 17767 101 or $3, $4, $5 102 ori $9, $6, 17767 103 xor $3, $3, $5 104 xor $9, $6, 17767 105 xori $9, $6, 17767 106 nor $9, $6, $7 107 nor $7, $8, $zero 108 mul $9, $6, $7 109 mult $9, $7 110 multu $9, $7 111 div $0, $9, $7 112 divu $0, $9, $7 113 addiupc $2, 20 114 addiupc $7, 16777212 115 addiupc $7, -16777216 116