1# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 | FileCheck %s 2# Check that the assembler can handle the documented syntax 3# for arithmetic and logical instructions. 4#------------------------------------------------------------------------------ 5# Logical instructions 6#------------------------------------------------------------------------------ 7# CHECK: and $9, $6, $7 # encoding: [0x24,0x48,0xc7,0x00] 8# CHECK: andi $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x30] 9# CHECK: andi $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x30] 10# CHECK: andi $9, $9, 17767 # encoding: [0x67,0x45,0x29,0x31] 11# CHECK: clo $6, $7 # encoding: [0x21,0x30,0xe6,0x70] 12# CHECK: clz $6, $7 # encoding: [0x20,0x30,0xe6,0x70] 13# CHECK: ins $19, $9, 6, 7 # encoding: [0x84,0x61,0x33,0x7d] 14# CHECK: nor $9, $6, $7 # encoding: [0x27,0x48,0xc7,0x00] 15# CHECK: or $3, $3, $5 # encoding: [0x25,0x18,0x65,0x00] 16# CHECK: ori $4, $5, 17767 # encoding: [0x67,0x45,0xa4,0x34] 17# CHECK: ori $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x34] 18# CHECK: ori $11, $11, 128 # encoding: [0x80,0x00,0x6b,0x35] 19# CHECK: rotr $9, $6, 7 # encoding: [0xc2,0x49,0x26,0x00] 20# CHECK: rotrv $9, $6, $7 # encoding: [0x46,0x48,0xe6,0x00] 21# CHECK: sll $4, $3, 7 # encoding: [0xc0,0x21,0x03,0x00] 22# CHECK: sllv $2, $3, $5 # encoding: [0x04,0x10,0xa3,0x00] 23# CHECK: slt $3, $3, $5 # encoding: [0x2a,0x18,0x65,0x00] 24# CHECK: slti $3, $3, 103 # encoding: [0x67,0x00,0x63,0x28] 25# CHECK: slti $3, $3, 103 # encoding: [0x67,0x00,0x63,0x28] 26# CHECK: sltiu $3, $3, 103 # encoding: [0x67,0x00,0x63,0x2c] 27# CHECK: sltu $3, $3, $5 # encoding: [0x2b,0x18,0x65,0x00] 28# CHECK: sra $4, $3, 7 # encoding: [0xc3,0x21,0x03,0x00] 29# CHECK: srav $2, $3, $5 # encoding: [0x07,0x10,0xa3,0x00] 30# CHECK: srl $4, $3, 7 # encoding: [0xc2,0x21,0x03,0x00] 31# CHECK: srlv $2, $3, $5 # encoding: [0x06,0x10,0xa3,0x00] 32# CHECK: xor $3, $3, $5 # encoding: [0x26,0x18,0x65,0x00] 33# CHECK: xori $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x38] 34# CHECK: xori $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x38] 35# CHECK: xori $11, $11, 12 # encoding: [0x0c,0x00,0x6b,0x39] 36# CHECK: wsbh $6, $7 # encoding: [0xa0,0x30,0x07,0x7c] 37# CHECK: not $7, $8 # encoding: [0x27,0x38,0x00,0x01] 38 and $9, $6, $7 39 and $9, $6, 17767 40 andi $9, $6, 17767 41 andi $9, 17767 42 clo $6, $7 43 clz $6, $7 44 ins $19, $9, 6,7 45 nor $9, $6, $7 46 or $3, $3, $5 47 or $4, $5, 17767 48 ori $9, $6, 17767 49 ori $11, 128 50 rotr $9, $6, 7 51 rotrv $9, $6, $7 52 sll $4, $3, 7 53 sllv $2, $3, $5 54 slt $3, $3, $5 55 slt $3, $3, 103 56 slti $3, $3, 103 57 sltiu $3, $3, 103 58 sltu $3, $3, $5 59 sra $4, $3, 7 60 srav $2, $3, $5 61 srl $4, $3, 7 62 srlv $2, $3, $5 63 xor $3, $3, $5 64 xor $9, $6, 17767 65 xori $9, $6, 17767 66 xori $11, 12 67 wsbh $6, $7 68 not $7 ,$8 69 70#------------------------------------------------------------------------------ 71# Arithmetic instructions 72#------------------------------------------------------------------------------ 73 74# CHECK: add $9, $6, $7 # encoding: [0x20,0x48,0xc7,0x00] 75# CHECK: addi $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x20] 76# CHECK: addiu $9, $6, -15001 # encoding: [0x67,0xc5,0xc9,0x24] 77# CHECK: addi $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x20] 78# CHECK: addi $9, $9, 17767 # encoding: [0x67,0x45,0x29,0x21] 79# CHECK: addiu $9, $6, -15001 # encoding: [0x67,0xc5,0xc9,0x24] 80# CHECK: addiu $11, $11, 40 # encoding: [0x28,0x00,0x6b,0x25] 81# CHECK: addu $9, $6, $7 # encoding: [0x21,0x48,0xc7,0x00] 82# CHECK: madd $6, $7 # encoding: [0x00,0x00,0xc7,0x70] 83# CHECK: maddu $6, $7 # encoding: [0x01,0x00,0xc7,0x70] 84# CHECK: msub $6, $7 # encoding: [0x04,0x00,0xc7,0x70] 85# CHECK: msubu $6, $7 # encoding: [0x05,0x00,0xc7,0x70] 86# CHECK: mult $3, $5 # encoding: [0x18,0x00,0x65,0x00] 87# CHECK: multu $3, $5 # encoding: [0x19,0x00,0x65,0x00] 88# CHECK: sub $9, $6, $7 # encoding: [0x22,0x48,0xc7,0x00] 89# CHECK: subu $4, $3, $5 # encoding: [0x23,0x20,0x65,0x00] 90# CHECK: neg $6, $7 # encoding: [0x22,0x30,0x07,0x00] 91# CHECK: negu $6, $7 # encoding: [0x23,0x30,0x07,0x00] 92# CHECK: move $7, $8 # encoding: [0x21,0x38,0x00,0x01] 93# CHECK: .set push 94# CHECK: .set mips32r2 95# CHECK: rdhwr $5, $29 96# CHECK: .set pop # encoding: [0x3b,0xe8,0x05,0x7c] 97 add $9,$6,$7 98 add $9,$6,17767 99 addu $9,$6,-15001 100 addi $9,$6,17767 101 addi $9,17767 102 addiu $9,$6,-15001 103 addiu $11,40 104 addu $9,$6,$7 105 madd $6,$7 106 maddu $6,$7 107 msub $6,$7 108 msubu $6,$7 109 mult $3,$5 110 multu $3,$5 111 sub $9,$6,$7 112 subu $4,$3,$5 113 neg $6,$7 114 negu $6,$7 115 move $7,$8 116 rdhwr $5, $29 117