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 # CHECK: .section __TEXT,__text,regular,pure_instructions 5 #------------------------------------------------------------------------------ 6 # Logical instructions 7 #------------------------------------------------------------------------------ 8 # CHECK: and $9, $6, $7 # encoding: [0x24,0x48,0xc7,0x00] 9 # CHECK: andi $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x30] 10 # CHECK: andi $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x30] 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 $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x34] 17 # CHECK: rotr $9, $6, 7 # encoding: [0xc2,0x49,0x26,0x00] 18 # CHECK: rotrv $9, $6, $7 # encoding: [0x46,0x48,0xe6,0x00] 19 # CHECK: sll $4, $3, 7 # encoding: [0xc0,0x21,0x03,0x00] 20 # CHECK: sllv $2, $3, $5 # encoding: [0x04,0x10,0xa3,0x00] 21 # CHECK: slt $3, $3, $5 # encoding: [0x2a,0x18,0x65,0x00] 22 # CHECK: slti $3, $3, 103 # encoding: [0x67,0x00,0x63,0x28] 23 # CHECK: slti $3, $3, 103 # encoding: [0x67,0x00,0x63,0x28] 24 # CHECK: sltiu $3, $3, 103 # encoding: [0x67,0x00,0x63,0x2c] 25 # CHECK: sltu $3, $3, $5 # encoding: [0x2b,0x18,0x65,0x00] 26 # CHECK: sra $4, $3, 7 # encoding: [0xc3,0x21,0x03,0x00] 27 # CHECK: srav $2, $3, $5 # encoding: [0x07,0x10,0xa3,0x00] 28 # CHECK: srl $4, $3, 7 # encoding: [0xc2,0x21,0x03,0x00] 29 # CHECK: srlv $2, $3, $5 # encoding: [0x06,0x10,0xa3,0x00] 30 # CHECK: xor $3, $3, $5 # encoding: [0x26,0x18,0x65,0x00] 31 # CHECK: xori $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x38] 32 # CHECK: xori $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x38] 33 # CHECK: wsbh $6, $7 # encoding: [0xa0,0x30,0x07,0x7c] 34 # CHECK: nor $7, $8, $zero # encoding: [0x27,0x38,0x00,0x01] 35 and $9, $6, $7 36 and $9, $6, 17767 37 andi $9, $6, 17767 38 clo $6, $7 39 clz $6, $7 40 ins $19, $9, 6,7 41 nor $9, $6, $7 42 or $3, $3, $5 43 ori $9, $6, 17767 44 rotr $9, $6, 7 45 rotrv $9, $6, $7 46 sll $4, $3, 7 47 sllv $2, $3, $5 48 slt $3, $3, $5 49 slt $3, $3, 103 50 slti $3, $3, 103 51 sltiu $3, $3, 103 52 sltu $3, $3, $5 53 sra $4, $3, 7 54 srav $2, $3, $5 55 srl $4, $3, 7 56 srlv $2, $3, $5 57 xor $3, $3, $5 58 xor $9, $6, 17767 59 xori $9, $6, 17767 60 wsbh $6, $7 61 not $7 ,$8 62 63 #------------------------------------------------------------------------------ 64 # Arithmetic instructions 65 #------------------------------------------------------------------------------ 66 67 # CHECK: add $9, $6, $7 # encoding: [0x20,0x48,0xc7,0x00] 68 # CHECK: addi $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x20] 69 # CHECK: addiu $9, $6, -15001 # encoding: [0x67,0xc5,0xc9,0x24] 70 # CHECK: addi $9, $6, 17767 # encoding: [0x67,0x45,0xc9,0x20] 71 # CHECK: addiu $9, $6, -15001 # encoding: [0x67,0xc5,0xc9,0x24] 72 # CHECK: addu $9, $6, $7 # encoding: [0x21,0x48,0xc7,0x00] 73 # CHECK: madd $6, $7 # encoding: [0x00,0x00,0xc7,0x70] 74 # CHECK: maddu $6, $7 # encoding: [0x01,0x00,0xc7,0x70] 75 # CHECK: msub $6, $7 # encoding: [0x04,0x00,0xc7,0x70] 76 # CHECK: msubu $6, $7 # encoding: [0x05,0x00,0xc7,0x70] 77 # CHECK: mult $3, $5 # encoding: [0x18,0x00,0x65,0x00] 78 # CHECK: multu $3, $5 # encoding: [0x19,0x00,0x65,0x00] 79 # CHECK: sub $9, $6, $7 # encoding: [0x22,0x48,0xc7,0x00] 80 # CHECK: subu $4, $3, $5 # encoding: [0x23,0x20,0x65,0x00] 81 # CHECK: sub $6, $zero, $7 # encoding: [0x22,0x30,0x07,0x00] 82 # CHECK: subu $6, $zero, $7 # encoding: [0x23,0x30,0x07,0x00] 83 # CHECK: add $7, $8, $zero # encoding: [0x20,0x38,0x00,0x01] 84 add $9,$6,$7 85 add $9,$6,17767 86 addu $9,$6,-15001 87 addi $9,$6,17767 88 addiu $9,$6,-15001 89 addu $9,$6,$7 90 madd $6,$7 91 maddu $6,$7 92 msub $6,$7 93 msubu $6,$7 94 mult $3,$5 95 multu $3,$5 96 sub $9,$6,$7 97 subu $4,$3,$5 98 neg $6,$7 99 negu $6,$7 100 move $7,$8 101