1 # RUN: llvm-mc -triple=hexagon -filetype=obj -o - %s | llvm-objdump -d - | FileCheck %s 2 # Hexagon Programmer's Reference Manual 11.10.8 XTYPE/SHIFT 3 4 # Shift by immediate 5 # CHECK: 10 df 14 80 6 r17:16 = asr(r21:20, #31) 7 # CHECK: 30 df 14 80 8 r17:16 = lsr(r21:20, #31) 9 # CHECK: 50 df 14 80 10 r17:16 = asl(r21:20, #31) 11 # CHECK: 11 df 15 8c 12 r17 = asr(r21, #31) 13 # CHECK: 31 df 15 8c 14 r17 = lsr(r21, #31) 15 # CHECK: 51 df 15 8c 16 r17 = asl(r21, #31) 17 18 # Shift by immediate and accumulate 19 # CHECK: 10 df 14 82 20 r17:16 -= asr(r21:20, #31) 21 # CHECK: 30 df 14 82 22 r17:16 -= lsr(r21:20, #31) 23 # CHECK: 50 df 14 82 24 r17:16 -= asl(r21:20, #31) 25 # CHECK: 90 df 14 82 26 r17:16 += asr(r21:20, #31) 27 # CHECK: b0 df 14 82 28 r17:16 += lsr(r21:20, #31) 29 # CHECK: d0 df 14 82 30 r17:16 += asl(r21:20, #31) 31 # CHECK: 11 df 15 8e 32 r17 -= asr(r21, #31) 33 # CHECK: 31 df 15 8e 34 r17 -= lsr(r21, #31) 35 # CHECK: 51 df 15 8e 36 r17 -= asl(r21, #31) 37 # CHECK: 91 df 15 8e 38 r17 += asr(r21, #31) 39 # CHECK: b1 df 15 8e 40 r17 += lsr(r21, #31) 41 # CHECK: d1 df 15 8e 42 r17 += asl(r21, #31) 43 # CHECK: 4c f7 11 de 44 r17 = add(#21, asl(r17, #23)) 45 # CHECK: 4e f7 11 de 46 r17 = sub(#21, asl(r17, #23)) 47 # CHECK: 5c f7 11 de 48 r17 = add(#21, lsr(r17, #23)) 49 # CHECK: 5e f7 11 de 50 r17 = sub(#21, lsr(r17, #23)) 51 52 # Shift by immediate and add 53 # CHECK: f1 d5 1f c4 54 r17 = addasl(r21, r31, #7) 55 56 # Shift by immediate and logical 57 # CHECK: 10 df 54 82 58 r17:16 &= asr(r21:20, #31) 59 # CHECK: 30 df 54 82 60 r17:16 &= lsr(r21:20, #31) 61 # CHECK: 50 df 54 82 62 r17:16 &= asl(r21:20, #31) 63 # CHECK: 90 df 54 82 64 r17:16 |= asr(r21:20, #31) 65 # CHECK: b0 df 54 82 66 r17:16 |= lsr(r21:20, #31) 67 # CHECK: d0 df 54 82 68 r17:16 |= asl(r21:20, #31) 69 # CHECK: 30 df 94 82 70 r17:16 ^= lsr(r21:20, #31) 71 # CHECK: 50 df 94 82 72 r17:16 ^= asl(r21:20, #31) 73 # CHECK: 11 df 55 8e 74 r17 &= asr(r21, #31) 75 # CHECK: 31 df 55 8e 76 r17 &= lsr(r21, #31) 77 # CHECK: 51 df 55 8e 78 r17 &= asl(r21, #31) 79 # CHECK: 91 df 55 8e 80 r17 |= asr(r21, #31) 81 # CHECK: b1 df 55 8e 82 r17 |= lsr(r21, #31) 83 # CHECK: d1 df 55 8e 84 r17 |= asl(r21, #31) 85 # CHECK: 31 df 95 8e 86 r17 ^= lsr(r21, #31) 87 # CHECK: 51 df 95 8e 88 r17 ^= asl(r21, #31) 89 # CHECK: 48 ff 11 de 90 r17 = and(#21, asl(r17, #31)) 91 # CHECK: 4a ff 11 de 92 r17 = or(#21, asl(r17, #31)) 93 # CHECK: 58 ff 11 de 94 r17 = and(#21, lsr(r17, #31)) 95 # CHECK: 5a ff 11 de 96 r17 = or(#21, lsr(r17, #31)) 97 98 # Shift right by immediate with rounding 99 # CHECK: f0 df d4 80 100 r17:16 = asr(r21:20, #31):rnd 101 # CHECK: 11 df 55 8c 102 r17 = asr(r21, #31):rnd 103 104 # Shift left by immediate with saturation 105 # CHECK: 51 df 55 8c 106 r17 = asl(r21, #31):sat 107 108 # Shift by register 109 # CHECK: 10 df 94 c3 110 r17:16 = asr(r21:20, r31) 111 # CHECK: 50 df 94 c3 112 r17:16 = lsr(r21:20, r31) 113 # CHECK: 90 df 94 c3 114 r17:16 = asl(r21:20, r31) 115 # CHECK: d0 df 94 c3 116 r17:16 = lsl(r21:20, r31) 117 # CHECK: 11 df 55 c6 118 r17 = asr(r21, r31) 119 # CHECK: 51 df 55 c6 120 r17 = lsr(r21, r31) 121 # CHECK: 91 df 55 c6 122 r17 = asl(r21, r31) 123 # CHECK: d1 df 55 c6 124 r17 = lsl(r21, r31) 125 # CHECK: f1 df 8a c6 126 r17 = lsl(#21, r31) 127 128 # Shift by register and accumulate 129 # CHECK: 10 df 94 cb 130 r17:16 -= asr(r21:20, r31) 131 # CHECK: 50 df 94 cb 132 r17:16 -= lsr(r21:20, r31) 133 # CHECK: 90 df 94 cb 134 r17:16 -= asl(r21:20, r31) 135 # CHECK: d0 df 94 cb 136 r17:16 -= lsl(r21:20, r31) 137 # CHECK: 10 df d4 cb 138 r17:16 += asr(r21:20, r31) 139 # CHECK: 50 df d4 cb 140 r17:16 += lsr(r21:20, r31) 141 # CHECK: 90 df d4 cb 142 r17:16 += asl(r21:20, r31) 143 # CHECK: d0 df d4 cb 144 r17:16 += lsl(r21:20, r31) 145 # CHECK: 11 df 95 cc 146 r17 -= asr(r21, r31) 147 # CHECK: 51 df 95 cc 148 r17 -= lsr(r21, r31) 149 # CHECK: 91 df 95 cc 150 r17 -= asl(r21, r31) 151 # CHECK: d1 df 95 cc 152 r17 -= lsl(r21, r31) 153 # CHECK: 11 df d5 cc 154 r17 += asr(r21, r31) 155 # CHECK: 51 df d5 cc 156 r17 += lsr(r21, r31) 157 # CHECK: 91 df d5 cc 158 r17 += asl(r21, r31) 159 # CHECK: d1 df d5 cc 160 r17 += lsl(r21, r31) 161 162 # Shift by register and logical 163 # CHECK: 10 df 14 cb 164 r17:16 |= asr(r21:20, r31) 165 # CHECK: 50 df 14 cb 166 r17:16 |= lsr(r21:20, r31) 167 # CHECK: 90 df 14 cb 168 r17:16 |= asl(r21:20, r31) 169 # CHECK: d0 df 14 cb 170 r17:16 |= lsl(r21:20, r31) 171 # CHECK: 10 df 54 cb 172 r17:16 &= asr(r21:20, r31) 173 # CHECK: 50 df 54 cb 174 r17:16 &= lsr(r21:20, r31) 175 # CHECK: 90 df 54 cb 176 r17:16 &= asl(r21:20, r31) 177 # CHECK: d0 df 54 cb 178 r17:16 &= lsl(r21:20, r31) 179 # CHECK: 10 df 74 cb 180 r17:16 ^= asr(r21:20, r31) 181 # CHECK: 50 df 74 cb 182 r17:16 ^= lsr(r21:20, r31) 183 # CHECK: 90 df 74 cb 184 r17:16 ^= asl(r21:20, r31) 185 # CHECK: d0 df 74 cb 186 r17:16 ^= lsl(r21:20, r31) 187 # CHECK: 11 df 15 cc 188 r17 |= asr(r21, r31) 189 # CHECK: 51 df 15 cc 190 r17 |= lsr(r21, r31) 191 # CHECK: 91 df 15 cc 192 r17 |= asl(r21, r31) 193 # CHECK: d1 df 15 cc 194 r17 |= lsl(r21, r31) 195 # CHECK: 11 df 55 cc 196 r17 &= asr(r21, r31) 197 # CHECK: 51 df 55 cc 198 r17 &= lsr(r21, r31) 199 # CHECK: 91 df 55 cc 200 r17 &= asl(r21, r31) 201 # CHECK: d1 df 55 cc 202 r17 &= lsl(r21, r31) 203 204 # Shift by register with saturation 205 # CHECK: 11 df 15 c6 206 r17 = asr(r21, r31):sat 207 # CHECK: 91 df 15 c6 208 r17 = asl(r21, r31):sat 209 210 # Vector shift halfwords by immediate 211 # CHECK: 10 c5 94 80 212 r17:16 = vasrh(r21:20, #5) 213 # CHECK: 30 c5 94 80 214 r17:16 = vlsrh(r21:20, #5) 215 # CHECK: 50 c5 94 80 216 r17:16 = vaslh(r21:20, #5) 217 218 # Vector arithmetic shift halfwords with round 219 # CHECK: 10 c5 34 80 220 r17:16 = vasrh(r21:20, #5):raw 221 222 # Vector arithmetic shift halfwords with saturate and pack 223 # CHECK: 91 c5 74 88 224 r17 = vasrhub(r21:20, #5):raw 225 # CHECK: b1 c5 74 88 226 r17 = vasrhub(r21:20, #5):sat 227 228 # Vector shift halfwords by register 229 # CHECK: 10 df 54 c3 230 r17:16 = vasrh(r21:20, r31) 231 # CHECK: 50 df 54 c3 232 r17:16 = vlsrh(r21:20, r31) 233 # CHECK: 90 df 54 c3 234 r17:16 = vaslh(r21:20, r31) 235 # CHECK: d0 df 54 c3 236 r17:16 = vlslh(r21:20, r31) 237 238 # Vector shift words by immediate 239 # CHECK: 10 df 54 80 240 r17:16 = vasrw(r21:20, #31) 241 # CHECK: 30 df 54 80 242 r17:16 = vlsrw(r21:20, #31) 243 # CHECK: 50 df 54 80 244 r17:16 = vaslw(r21:20, #31) 245 246 # Vector shift words by register 247 # CHECK: 10 df 14 c3 248 r17:16 = vasrw(r21:20, r31) 249 # CHECK: 50 df 14 c3 250 r17:16 = vlsrw(r21:20, r31) 251 # CHECK: 90 df 14 c3 252 r17:16 = vaslw(r21:20, r31) 253 # CHECK: d0 df 14 c3 254 r17:16 = vlslw(r21:20, r31) 255 256 # Vector shift words with truncate and pack 257 # CHECK: 51 df d4 88 258 r17 = vasrw(r21:20, #31) 259 # CHECK: 51 df 14 c5 260 r17 = vasrw(r21:20, r31) 261