Reverted revision 226577.
[opencl/llvm.git] / test / MC / Mips / micromips-16-bit-instructions.s
1 # RUN: llvm-mc %s -triple=mipsel -show-encoding -mattr=micromips | \
2 # RUN: FileCheck -check-prefix=CHECK-EL %s
3 # RUN: llvm-mc %s -triple=mips -show-encoding -mattr=micromips | \
4 # RUN: FileCheck -check-prefix=CHECK-EB %s
5 # Check that the assembler can handle the documented syntax
6 # for arithmetic and logical instructions.
7 #------------------------------------------------------------------------------
8 # MicroMIPS 16-bit Instructions
9 #------------------------------------------------------------------------------
10 # Little endian
11 #------------------------------------------------------------------------------
12 # CHECK-EL: addu16  $6, $17, $4     # encoding: [0x42,0x07]
13 # CHECK-EL: subu16  $5, $16, $3     # encoding: [0xb1,0x06]
14 # CHECK-EL: andi16  $16, $2, 31     # encoding: [0x29,0x2c]
15 # CHECK-EL: and16   $16, $2         # encoding: [0x82,0x44]
16 # CHECK-EL: not16   $17, $3         # encoding: [0x0b,0x44]
17 # CHECK-EL: or16    $16, $4         # encoding: [0xc4,0x44]
18 # CHECK-EL: xor16   $17, $5         # encoding: [0x4d,0x44]
19 # CHECK-EL: sll16   $3, $16, 5      # encoding: [0x8a,0x25]
20 # CHECK-EL: srl16   $4, $17, 6      # encoding: [0x1d,0x26]
21 # CHECK-EL: lbu16   $3, 4($17)      # encoding: [0x94,0x09]
22 # CHECK-EL: lbu16   $3, -1($16)     # encoding: [0x8f,0x09]
23 # CHECK-EL: lhu16   $3, 4($16)      # encoding: [0x82,0x29]
24 # CHECK-EL: lw16    $4, 8($17)      # encoding: [0x12,0x6a]
25 # CHECK-EL: sb16    $3, 4($16)      # encoding: [0x84,0x89]
26 # CHECK-EL: sh16    $4, 8($17)      # encoding: [0x14,0xaa]
27 # CHECK-EL: sw16    $4, 4($17)      # encoding: [0x11,0xea]
28 # CHECK-EL: sw16    $zero, 4($17)   # encoding: [0x11,0xe8]
29 # CHECK-EL: lw      $3, 32($sp)     # encoding: [0x68,0x48]
30 # CHECK-EL: sw      $4, 124($sp)    # encoding: [0x9f,0xc8]
31 # CHECK-EL: li16    $3, -1          # encoding: [0xff,0xed]
32 # CHECK-EL: li16    $3, 126         # encoding: [0xfe,0xed]
33 # CHECK-EL: addiur1sp $7, 4         # encoding: [0x83,0x6f]
34 # CHECK-EL: addiur2 $6, $7, -1      # encoding: [0x7e,0x6f]
35 # CHECK-EL: addiur2 $6, $7, 12      # encoding: [0x76,0x6f]
36 # CHECK-EL: addius5 $7, -2          # encoding: [0xfc,0x4c]
37 # CHECK-EL: addiusp -1028           # encoding: [0xff,0x4f]
38 # CHECK-EL: addiusp -1032           # encoding: [0xfd,0x4f]
39 # CHECK-EL: addiusp 1024            # encoding: [0x01,0x4c]
40 # CHECK-EL: addiusp 1028            # encoding: [0x03,0x4c]
41 # CHECK-EL: addiusp -16             # encoding: [0xf9,0x4f]
42 # CHECK-EL: mfhi    $9              # encoding: [0x09,0x46]
43 # CHECK-EL: mflo    $9              # encoding: [0x49,0x46]
44 # CHECK-EL: move    $25, $1         # encoding: [0x21,0x0f]
45 # CHECK-EL: jrc     $9              # encoding: [0xa9,0x45]
46 # CHECK-NEXT: jalr    $9            # encoding: [0xc9,0x45]
47 # CHECK-EL: jraddiusp 20            # encoding: [0x05,0x47]
48 # CHECK-NEXT: jalrs16 $9            # encoding: [0xe9,0x45]
49 # CHECK-EL: nop                     # encoding: [0x00,0x0c]
50 # CHECK-EL: jr16    $9              # encoding: [0x89,0x45]
51 # CHECK-EL: nop                     # encoding: [0x00,0x00,0x00,0x00]
52 # CHECK-EL: beqz16 $6, 20           # encoding: [0x0a,0x8f]
53 # CHECK-EL: nop                     # encoding: [0x00,0x00,0x00,0x00]
54 # CHECK-EL: bnez16 $6, 20           # encoding: [0x0a,0xaf]
55 # CHECK-EL: nop                     # encoding: [0x00,0x00,0x00,0x00]
56 # CHECK-EL: break16 8               # encoding: [0x88,0x46]
57 # CHECK-EL: sdbbp16 14              # encoding: [0xce,0x46]
58 #------------------------------------------------------------------------------
59 # Big endian
60 #------------------------------------------------------------------------------
61 # CHECK-EB: addu16  $6, $17, $4     # encoding: [0x07,0x42]
62 # CHECK-EB: subu16  $5, $16, $3     # encoding: [0x06,0xb1]
63 # CHECK-EB: andi16  $16, $2, 31     # encoding: [0x2c,0x29]
64 # CHECK-EB: and16   $16, $2         # encoding: [0x44,0x82]
65 # CHECK-EB: not16   $17, $3         # encoding: [0x44,0x0b]
66 # CHECK-EB: or16    $16, $4         # encoding: [0x44,0xc4]
67 # CHECK-EB: xor16   $17, $5         # encoding: [0x44,0x4d]
68 # CHECK-EB: sll16   $3, $16, 5      # encoding: [0x25,0x8a]
69 # CHECK-EB: srl16   $4, $17, 6      # encoding: [0x26,0x1d]
70 # CHECK-EB: lbu16   $3, 4($17)      # encoding: [0x09,0x94]
71 # CHECK-EB: lbu16   $3, -1($16)     # encoding: [0x09,0x8f]
72 # CHECK-EB: lhu16   $3, 4($16)      # encoding: [0x29,0x82]
73 # CHECK-EB: lw16    $4, 8($17)      # encoding: [0x6a,0x12]
74 # CHECK-EB: sb16    $3, 4($16)      # encoding: [0x89,0x84]
75 # CHECK-EB: sh16    $4, 8($17)      # encoding: [0xaa,0x14]
76 # CHECK-EB: sw16    $4, 4($17)      # encoding: [0xea,0x11]
77 # CHECK-EB: sw16    $zero, 4($17)   # encoding: [0xe8,0x11]
78 # CHECK-EB: lw      $3, 32($sp)     # encoding: [0x48,0x68]
79 # CHECK-EB: sw      $4, 124($sp)    # encoding: [0xc8,0x9f]
80 # CHECK-EB: li16    $3, -1          # encoding: [0xed,0xff]
81 # CHECK-EB: li16    $3, 126         # encoding: [0xed,0xfe]
82 # CHECK-EB: addiur1sp $7, 4         # encoding: [0x6f,0x83]
83 # CHECK-EB: addiur2 $6, $7, -1      # encoding: [0x6f,0x7e]
84 # CHECK-EB: addiur2 $6, $7, 12      # encoding: [0x6f,0x76]
85 # CHECK-EB: addius5 $7, -2          # encoding: [0x4c,0xfc]
86 # CHECK-EB: addiusp -1028           # encoding: [0x4f,0xff]
87 # CHECK-EB: addiusp -1032           # encoding: [0x4f,0xfd]
88 # CHECK-EB: addiusp 1024            # encoding: [0x4c,0x01]
89 # CHECK-EB: addiusp 1028            # encoding: [0x4c,0x03]
90 # CHECK-EB: addiusp -16             # encoding: [0x4f,0xf9]
91 # CHECK-EB: mfhi    $9              # encoding: [0x46,0x09]
92 # CHECK-EB: mflo    $9              # encoding: [0x46,0x49]
93 # CHECK-EB: move    $25, $1         # encoding: [0x0f,0x21]
94 # CHECK-EB: jrc     $9              # encoding: [0x45,0xa9]
95 # CHECK-NEXT: jalr    $9            # encoding: [0x45,0xc9]
96 # CHECK-EB: jraddiusp 20            # encoding: [0x47,0x05]
97 # CHECK-NEXT: jalrs16 $9            # encoding: [0x45,0xe9]
98 # CHECK-EB: nop                     # encoding: [0x0c,0x00]
99 # CHECK-EB: jr16    $9              # encoding: [0x45,0x89]
100 # CHECK-EB: nop                     # encoding: [0x00,0x00,0x00,0x00]
101 # CHECK-EB: beqz16 $6, 20           # encoding: [0x8f,0x0a]
102 # CHECK-EB: nop                     # encoding: [0x00,0x00,0x00,0x00]
103 # CHECK-EB: bnez16 $6, 20           # encoding: [0xaf,0x0a]
104 # CHECK-EB: nop                     # encoding: [0x00,0x00,0x00,0x00]
105 # CHECK-EB: break16 8               # encoding: [0x46,0x88]
106 # CHECK-EB: sdbbp16 14              # encoding: [0x46,0xce]
108     addu16  $6, $17, $4
109     subu16  $5, $16, $3
110     andi16  $16, $2, 31
111     and16   $16, $2
112     not16   $17, $3
113     or16    $16, $4
114     xor16   $17, $5
115     sll16   $3, $16, 5
116     srl16   $4, $17, 6
117     lbu16   $3, 4($17)
118     lbu16   $3, -1($16)
119     lhu16   $3, 4($16)
120     lw16    $4, 8($17)
121     sb16    $3, 4($16)
122     sh16    $4, 8($17)
123     sw16    $4, 4($17)
124     sw16    $0, 4($17)
125     lw      $3, 32($sp)
126     sw      $4, 124($sp)
127     li16    $3, -1
128     li16    $3, 126
129     addiur1sp $7, 4
130     addiur2 $6, $7, -1
131     addiur2 $6, $7, 12
132     addius5 $7, -2
133     addiusp -1028
134     addiusp -1032
135     addiusp 1024
136     addiusp 1028
137     addiusp -16
138     mfhi    $9
139     mflo    $9
140     move    $25, $1
141     jrc     $9
142     jalr    $9
143     jraddiusp 20
144     jalrs16 $9
145     jr16    $9
146     beqz16 $6, 20
147     bnez16 $6, 20
148     break16 8
149     sdbbp16 14