xref: /aosp_15_r20/external/llvm/test/MC/Mips/micromips-shift-instructions.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc %s -triple=mipsel -show-encoding -mcpu=mips32r2 -mattr=micromips | FileCheck -check-prefix=CHECK-EL %s
2*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc %s -triple=mips -show-encoding -mcpu=mips32r2 -mattr=micromips | FileCheck -check-prefix=CHECK-EB %s
3*9880d681SAndroid Build Coastguard Worker# Check that the assembler can handle the documented syntax
4*9880d681SAndroid Build Coastguard Worker# for shift instructions.
5*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
6*9880d681SAndroid Build Coastguard Worker# Shift Instructions
7*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
8*9880d681SAndroid Build Coastguard Worker# Little endian
9*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
10*9880d681SAndroid Build Coastguard Worker# CHECK-EL: sll    $4, $3, 7      # encoding: [0x83,0x00,0x00,0x38]
11*9880d681SAndroid Build Coastguard Worker# CHECK-EL: sllv   $2, $3, $5     # encoding: [0x65,0x00,0x10,0x10]
12*9880d681SAndroid Build Coastguard Worker# CHECK-EL: sra    $4, $3, 7      # encoding: [0x83,0x00,0x80,0x38]
13*9880d681SAndroid Build Coastguard Worker# CHECK-EL: srav   $2, $3, $5     # encoding: [0x65,0x00,0x90,0x10]
14*9880d681SAndroid Build Coastguard Worker# CHECK-EL: srl    $4, $3, 7      # encoding: [0x83,0x00,0x40,0x38]
15*9880d681SAndroid Build Coastguard Worker# CHECK-EL: srlv   $2, $3, $5     # encoding: [0x65,0x00,0x50,0x10]
16*9880d681SAndroid Build Coastguard Worker# CHECK-EL: rotr   $9, $6, 7      # encoding: [0x26,0x01,0xc0,0x38]
17*9880d681SAndroid Build Coastguard Worker# CHECK-EL: rotrv  $9, $6, $7     # encoding: [0xc7,0x00,0xd0,0x48]
18*9880d681SAndroid Build Coastguard Worker# CHECK-EL: sllv   $2, $3, $5     # encoding: [0x65,0x00,0x10,0x10]
19*9880d681SAndroid Build Coastguard Worker# CHECK-EL: srav   $2, $3, $5     # encoding: [0x65,0x00,0x90,0x10]
20*9880d681SAndroid Build Coastguard Worker# CHECK-EL: srlv   $2, $3, $5     # encoding: [0x65,0x00,0x50,0x10]
21*9880d681SAndroid Build Coastguard Worker# CHECK-EL: sllv   $2, $2, $3     # encoding: [0x43,0x00,0x10,0x10]
22*9880d681SAndroid Build Coastguard Worker# CHECK-EL: srav   $2, $2, $3     # encoding: [0x43,0x00,0x90,0x10]
23*9880d681SAndroid Build Coastguard Worker# CHECK-EL: srlv   $2, $2, $3     # encoding: [0x43,0x00,0x50,0x10]
24*9880d681SAndroid Build Coastguard Worker# CHECK-EL: sll    $3, $3, 7      # encoding: [0x63,0x00,0x00,0x38]
25*9880d681SAndroid Build Coastguard Worker# CHECK-EL: sra    $3, $3, 7      # encoding: [0x63,0x00,0x80,0x38]
26*9880d681SAndroid Build Coastguard Worker# CHECK-EL: srl    $3, $3, 7      # encoding: [0x63,0x00,0x40,0x38]
27*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
28*9880d681SAndroid Build Coastguard Worker# Big endian
29*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
30*9880d681SAndroid Build Coastguard Worker# CHECK-EB: sll $4, $3, 7         # encoding: [0x00,0x83,0x38,0x00]
31*9880d681SAndroid Build Coastguard Worker# CHECK-EB: sllv  $2, $3, $5      # encoding: [0x00,0x65,0x10,0x10]
32*9880d681SAndroid Build Coastguard Worker# CHECK-EB: sra $4, $3, 7         # encoding: [0x00,0x83,0x38,0x80]
33*9880d681SAndroid Build Coastguard Worker# CHECK-EB: srav  $2, $3, $5      # encoding: [0x00,0x65,0x10,0x90]
34*9880d681SAndroid Build Coastguard Worker# CHECK-EB: srl $4, $3, 7         # encoding: [0x00,0x83,0x38,0x40]
35*9880d681SAndroid Build Coastguard Worker# CHECK-EB: srlv  $2, $3, $5      # encoding: [0x00,0x65,0x10,0x50]
36*9880d681SAndroid Build Coastguard Worker# CHECK-EB: rotr  $9, $6, 7       # encoding: [0x01,0x26,0x38,0xc0]
37*9880d681SAndroid Build Coastguard Worker# CHECK-EB: rotrv $9, $6, $7      # encoding: [0x00,0xc7,0x48,0xd0]
38*9880d681SAndroid Build Coastguard Worker# CHECK-EB: sllv $2, $3, $5       # encoding: [0x00,0x65,0x10,0x10]
39*9880d681SAndroid Build Coastguard Worker# CHECK-EB: srav $2, $3, $5       # encoding: [0x00,0x65,0x10,0x90]
40*9880d681SAndroid Build Coastguard Worker# CHECK-EB: srlv $2, $3, $5       # encoding: [0x00,0x65,0x10,0x50]
41*9880d681SAndroid Build Coastguard Worker# CHECK-EB: sllv $2, $2, $3       # encoding: [0x00,0x43,0x10,0x10]
42*9880d681SAndroid Build Coastguard Worker# CHECK-EB: srav $2, $2, $3       # encoding: [0x00,0x43,0x10,0x90]
43*9880d681SAndroid Build Coastguard Worker# CHECK-EB: srlv $2, $2, $3       # encoding: [0x00,0x43,0x10,0x50]
44*9880d681SAndroid Build Coastguard Worker# CHECK-EB: sll $3, $3, 7         # encoding: [0x00,0x63,0x38,0x00]
45*9880d681SAndroid Build Coastguard Worker# CHECK-EB: sra $3, $3, 7         # encoding: [0x00,0x63,0x38,0x80]
46*9880d681SAndroid Build Coastguard Worker# CHECK-EB: srl $3, $3, 7         # encoding: [0x00,0x63,0x38,0x40]
47*9880d681SAndroid Build Coastguard Worker     sll    $4, $3, 7
48*9880d681SAndroid Build Coastguard Worker     sllv   $2, $3, $5
49*9880d681SAndroid Build Coastguard Worker     sra    $4, $3, 7
50*9880d681SAndroid Build Coastguard Worker     srav   $2, $3, $5
51*9880d681SAndroid Build Coastguard Worker     srl    $4, $3, 7
52*9880d681SAndroid Build Coastguard Worker     srlv   $2, $3, $5
53*9880d681SAndroid Build Coastguard Worker     rotr   $9, $6, 7
54*9880d681SAndroid Build Coastguard Worker     rotrv  $9, $6, $7
55*9880d681SAndroid Build Coastguard Worker     sll    $2, $3, $5
56*9880d681SAndroid Build Coastguard Worker     sra    $2, $3, $5
57*9880d681SAndroid Build Coastguard Worker     srl    $2, $3, $5
58*9880d681SAndroid Build Coastguard Worker     sll    $2, $3
59*9880d681SAndroid Build Coastguard Worker     sra    $2, $3
60*9880d681SAndroid Build Coastguard Worker     srl    $2, $3
61*9880d681SAndroid Build Coastguard Worker     sll    $3, 7
62*9880d681SAndroid Build Coastguard Worker     sra    $3, 7
63*9880d681SAndroid Build Coastguard Worker     srl    $3, 7
64