1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -riscv-disable-using-constant-pool-for-large-ints -verify-machineinstrs < %s \
3 ; RUN: | FileCheck %s -check-prefix=RV32I
4 ; RUN: llc -mtriple=riscv64 -riscv-disable-using-constant-pool-for-large-ints -verify-machineinstrs < %s \
5 ; RUN: | FileCheck %s -check-prefixes=RV64I,RV64-NOPOOL
6 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
7 ; RUN: | FileCheck %s -check-prefixes=RV64I,RV64I-POOL
8 ; RUN: llc -mtriple=riscv64 -riscv-disable-using-constant-pool-for-large-ints -mattr=+zba \
9 ; RUN: -verify-machineinstrs < %s | FileCheck %s -check-prefix=RV64IZBA
10 ; RUN: llc -mtriple=riscv64 -riscv-disable-using-constant-pool-for-large-ints -mattr=+zbb \
11 ; RUN: -verify-machineinstrs < %s | FileCheck %s -check-prefix=RV64IZBB
12 ; RUN: llc -mtriple=riscv64 -riscv-disable-using-constant-pool-for-large-ints -mattr=+zbs \
13 ; RUN: -verify-machineinstrs < %s | FileCheck %s -check-prefix=RV64IZBS
14 ; RUN: llc -mtriple=riscv64 -riscv-disable-using-constant-pool-for-large-ints -mattr=+xtheadbb \
15 ; RUN: -verify-machineinstrs < %s | FileCheck %s -check-prefix=RV64IXTHEADBB
17 ; RUN: llc -mtriple=riscv32 -riscv-disable-using-constant-pool-for-large-ints -verify-machineinstrs < %s \
18 ; RUN: -riscv-use-rematerializable-movimm | FileCheck %s -check-prefix=RV32-REMAT
19 ; RUN: llc -mtriple=riscv64 -riscv-disable-using-constant-pool-for-large-ints -verify-machineinstrs < %s \
20 ; RUN: -riscv-use-rematerializable-movimm | FileCheck %s -check-prefix=RV64-REMAT
22 ; Materializing constants
24 ; TODO: It would be preferable if anyext constant returns were sign rather
25 ; than zero extended. See PR39092. For now, mark returns as explicitly signext
26 ; (this matches what Clang would generate for equivalent C/C++ anyway).
28 define signext i32 @zero() nounwind {
31 ; RV32I-NEXT: li a0, 0
36 ; RV64I-NEXT: li a0, 0
39 ; RV64IZBA-LABEL: zero:
41 ; RV64IZBA-NEXT: li a0, 0
44 ; RV64IZBB-LABEL: zero:
46 ; RV64IZBB-NEXT: li a0, 0
49 ; RV64IZBS-LABEL: zero:
51 ; RV64IZBS-NEXT: li a0, 0
54 ; RV64IXTHEADBB-LABEL: zero:
55 ; RV64IXTHEADBB: # %bb.0:
56 ; RV64IXTHEADBB-NEXT: li a0, 0
57 ; RV64IXTHEADBB-NEXT: ret
59 ; RV32-REMAT-LABEL: zero:
60 ; RV32-REMAT: # %bb.0:
61 ; RV32-REMAT-NEXT: li a0, 0
62 ; RV32-REMAT-NEXT: ret
64 ; RV64-REMAT-LABEL: zero:
65 ; RV64-REMAT: # %bb.0:
66 ; RV64-REMAT-NEXT: li a0, 0
67 ; RV64-REMAT-NEXT: ret
71 define signext i32 @pos_small() nounwind {
72 ; RV32I-LABEL: pos_small:
74 ; RV32I-NEXT: li a0, 2047
77 ; RV64I-LABEL: pos_small:
79 ; RV64I-NEXT: li a0, 2047
82 ; RV64IZBA-LABEL: pos_small:
84 ; RV64IZBA-NEXT: li a0, 2047
87 ; RV64IZBB-LABEL: pos_small:
89 ; RV64IZBB-NEXT: li a0, 2047
92 ; RV64IZBS-LABEL: pos_small:
94 ; RV64IZBS-NEXT: li a0, 2047
97 ; RV64IXTHEADBB-LABEL: pos_small:
98 ; RV64IXTHEADBB: # %bb.0:
99 ; RV64IXTHEADBB-NEXT: li a0, 2047
100 ; RV64IXTHEADBB-NEXT: ret
102 ; RV32-REMAT-LABEL: pos_small:
103 ; RV32-REMAT: # %bb.0:
104 ; RV32-REMAT-NEXT: li a0, 2047
105 ; RV32-REMAT-NEXT: ret
107 ; RV64-REMAT-LABEL: pos_small:
108 ; RV64-REMAT: # %bb.0:
109 ; RV64-REMAT-NEXT: li a0, 2047
110 ; RV64-REMAT-NEXT: ret
114 define signext i32 @neg_small() nounwind {
115 ; RV32I-LABEL: neg_small:
117 ; RV32I-NEXT: li a0, -2048
120 ; RV64I-LABEL: neg_small:
122 ; RV64I-NEXT: li a0, -2048
125 ; RV64IZBA-LABEL: neg_small:
127 ; RV64IZBA-NEXT: li a0, -2048
130 ; RV64IZBB-LABEL: neg_small:
132 ; RV64IZBB-NEXT: li a0, -2048
135 ; RV64IZBS-LABEL: neg_small:
137 ; RV64IZBS-NEXT: li a0, -2048
140 ; RV64IXTHEADBB-LABEL: neg_small:
141 ; RV64IXTHEADBB: # %bb.0:
142 ; RV64IXTHEADBB-NEXT: li a0, -2048
143 ; RV64IXTHEADBB-NEXT: ret
145 ; RV32-REMAT-LABEL: neg_small:
146 ; RV32-REMAT: # %bb.0:
147 ; RV32-REMAT-NEXT: li a0, -2048
148 ; RV32-REMAT-NEXT: ret
150 ; RV64-REMAT-LABEL: neg_small:
151 ; RV64-REMAT: # %bb.0:
152 ; RV64-REMAT-NEXT: li a0, -2048
153 ; RV64-REMAT-NEXT: ret
157 define signext i32 @pos_i32() nounwind {
158 ; RV32I-LABEL: pos_i32:
160 ; RV32I-NEXT: lui a0, 423811
161 ; RV32I-NEXT: addi a0, a0, -1297
164 ; RV64I-LABEL: pos_i32:
166 ; RV64I-NEXT: lui a0, 423811
167 ; RV64I-NEXT: addiw a0, a0, -1297
170 ; RV64IZBA-LABEL: pos_i32:
172 ; RV64IZBA-NEXT: lui a0, 423811
173 ; RV64IZBA-NEXT: addiw a0, a0, -1297
176 ; RV64IZBB-LABEL: pos_i32:
178 ; RV64IZBB-NEXT: lui a0, 423811
179 ; RV64IZBB-NEXT: addiw a0, a0, -1297
182 ; RV64IZBS-LABEL: pos_i32:
184 ; RV64IZBS-NEXT: lui a0, 423811
185 ; RV64IZBS-NEXT: addiw a0, a0, -1297
188 ; RV64IXTHEADBB-LABEL: pos_i32:
189 ; RV64IXTHEADBB: # %bb.0:
190 ; RV64IXTHEADBB-NEXT: lui a0, 423811
191 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1297
192 ; RV64IXTHEADBB-NEXT: ret
194 ; RV32-REMAT-LABEL: pos_i32:
195 ; RV32-REMAT: # %bb.0:
196 ; RV32-REMAT-NEXT: lui a0, 423811
197 ; RV32-REMAT-NEXT: addi a0, a0, -1297
198 ; RV32-REMAT-NEXT: ret
200 ; RV64-REMAT-LABEL: pos_i32:
201 ; RV64-REMAT: # %bb.0:
202 ; RV64-REMAT-NEXT: lui a0, 423811
203 ; RV64-REMAT-NEXT: addiw a0, a0, -1297
204 ; RV64-REMAT-NEXT: ret
208 define signext i32 @neg_i32() nounwind {
209 ; RV32I-LABEL: neg_i32:
211 ; RV32I-NEXT: lui a0, 912092
212 ; RV32I-NEXT: addi a0, a0, -273
215 ; RV64I-LABEL: neg_i32:
217 ; RV64I-NEXT: lui a0, 912092
218 ; RV64I-NEXT: addiw a0, a0, -273
221 ; RV64IZBA-LABEL: neg_i32:
223 ; RV64IZBA-NEXT: lui a0, 912092
224 ; RV64IZBA-NEXT: addiw a0, a0, -273
227 ; RV64IZBB-LABEL: neg_i32:
229 ; RV64IZBB-NEXT: lui a0, 912092
230 ; RV64IZBB-NEXT: addiw a0, a0, -273
233 ; RV64IZBS-LABEL: neg_i32:
235 ; RV64IZBS-NEXT: lui a0, 912092
236 ; RV64IZBS-NEXT: addiw a0, a0, -273
239 ; RV64IXTHEADBB-LABEL: neg_i32:
240 ; RV64IXTHEADBB: # %bb.0:
241 ; RV64IXTHEADBB-NEXT: lui a0, 912092
242 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -273
243 ; RV64IXTHEADBB-NEXT: ret
245 ; RV32-REMAT-LABEL: neg_i32:
246 ; RV32-REMAT: # %bb.0:
247 ; RV32-REMAT-NEXT: lui a0, 912092
248 ; RV32-REMAT-NEXT: addi a0, a0, -273
249 ; RV32-REMAT-NEXT: ret
251 ; RV64-REMAT-LABEL: neg_i32:
252 ; RV64-REMAT: # %bb.0:
253 ; RV64-REMAT-NEXT: lui a0, 912092
254 ; RV64-REMAT-NEXT: addiw a0, a0, -273
255 ; RV64-REMAT-NEXT: ret
259 define signext i32 @pos_i32_hi20_only() nounwind {
260 ; RV32I-LABEL: pos_i32_hi20_only:
262 ; RV32I-NEXT: lui a0, 16
265 ; RV64I-LABEL: pos_i32_hi20_only:
267 ; RV64I-NEXT: lui a0, 16
270 ; RV64IZBA-LABEL: pos_i32_hi20_only:
272 ; RV64IZBA-NEXT: lui a0, 16
275 ; RV64IZBB-LABEL: pos_i32_hi20_only:
277 ; RV64IZBB-NEXT: lui a0, 16
280 ; RV64IZBS-LABEL: pos_i32_hi20_only:
282 ; RV64IZBS-NEXT: lui a0, 16
285 ; RV64IXTHEADBB-LABEL: pos_i32_hi20_only:
286 ; RV64IXTHEADBB: # %bb.0:
287 ; RV64IXTHEADBB-NEXT: lui a0, 16
288 ; RV64IXTHEADBB-NEXT: ret
290 ; RV32-REMAT-LABEL: pos_i32_hi20_only:
291 ; RV32-REMAT: # %bb.0:
292 ; RV32-REMAT-NEXT: lui a0, 16
293 ; RV32-REMAT-NEXT: ret
295 ; RV64-REMAT-LABEL: pos_i32_hi20_only:
296 ; RV64-REMAT: # %bb.0:
297 ; RV64-REMAT-NEXT: lui a0, 16
298 ; RV64-REMAT-NEXT: ret
299 ret i32 65536 ; 0x10000
302 define signext i32 @neg_i32_hi20_only() nounwind {
303 ; RV32I-LABEL: neg_i32_hi20_only:
305 ; RV32I-NEXT: lui a0, 1048560
308 ; RV64I-LABEL: neg_i32_hi20_only:
310 ; RV64I-NEXT: lui a0, 1048560
313 ; RV64IZBA-LABEL: neg_i32_hi20_only:
315 ; RV64IZBA-NEXT: lui a0, 1048560
318 ; RV64IZBB-LABEL: neg_i32_hi20_only:
320 ; RV64IZBB-NEXT: lui a0, 1048560
323 ; RV64IZBS-LABEL: neg_i32_hi20_only:
325 ; RV64IZBS-NEXT: lui a0, 1048560
328 ; RV64IXTHEADBB-LABEL: neg_i32_hi20_only:
329 ; RV64IXTHEADBB: # %bb.0:
330 ; RV64IXTHEADBB-NEXT: lui a0, 1048560
331 ; RV64IXTHEADBB-NEXT: ret
333 ; RV32-REMAT-LABEL: neg_i32_hi20_only:
334 ; RV32-REMAT: # %bb.0:
335 ; RV32-REMAT-NEXT: lui a0, 1048560
336 ; RV32-REMAT-NEXT: ret
338 ; RV64-REMAT-LABEL: neg_i32_hi20_only:
339 ; RV64-REMAT: # %bb.0:
340 ; RV64-REMAT-NEXT: lui a0, 1048560
341 ; RV64-REMAT-NEXT: ret
342 ret i32 -65536 ; -0x10000
345 ; This can be materialized with ADDI+SLLI, improving compressibility.
347 define signext i32 @imm_left_shifted_addi() nounwind {
348 ; RV32I-LABEL: imm_left_shifted_addi:
350 ; RV32I-NEXT: lui a0, 32
351 ; RV32I-NEXT: addi a0, a0, -64
354 ; RV64I-LABEL: imm_left_shifted_addi:
356 ; RV64I-NEXT: lui a0, 32
357 ; RV64I-NEXT: addiw a0, a0, -64
360 ; RV64IZBA-LABEL: imm_left_shifted_addi:
362 ; RV64IZBA-NEXT: lui a0, 32
363 ; RV64IZBA-NEXT: addiw a0, a0, -64
366 ; RV64IZBB-LABEL: imm_left_shifted_addi:
368 ; RV64IZBB-NEXT: lui a0, 32
369 ; RV64IZBB-NEXT: addiw a0, a0, -64
372 ; RV64IZBS-LABEL: imm_left_shifted_addi:
374 ; RV64IZBS-NEXT: lui a0, 32
375 ; RV64IZBS-NEXT: addiw a0, a0, -64
378 ; RV64IXTHEADBB-LABEL: imm_left_shifted_addi:
379 ; RV64IXTHEADBB: # %bb.0:
380 ; RV64IXTHEADBB-NEXT: lui a0, 32
381 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -64
382 ; RV64IXTHEADBB-NEXT: ret
384 ; RV32-REMAT-LABEL: imm_left_shifted_addi:
385 ; RV32-REMAT: # %bb.0:
386 ; RV32-REMAT-NEXT: lui a0, 32
387 ; RV32-REMAT-NEXT: addi a0, a0, -64
388 ; RV32-REMAT-NEXT: ret
390 ; RV64-REMAT-LABEL: imm_left_shifted_addi:
391 ; RV64-REMAT: # %bb.0:
392 ; RV64-REMAT-NEXT: lui a0, 32
393 ; RV64-REMAT-NEXT: addiw a0, a0, -64
394 ; RV64-REMAT-NEXT: ret
395 ret i32 131008 ; 0x1FFC0
398 ; This can be materialized with ADDI+SRLI, improving compressibility.
400 define signext i32 @imm_right_shifted_addi() nounwind {
401 ; RV32I-LABEL: imm_right_shifted_addi:
403 ; RV32I-NEXT: lui a0, 524288
404 ; RV32I-NEXT: addi a0, a0, -1
407 ; RV64I-LABEL: imm_right_shifted_addi:
409 ; RV64I-NEXT: lui a0, 524288
410 ; RV64I-NEXT: addiw a0, a0, -1
413 ; RV64IZBA-LABEL: imm_right_shifted_addi:
415 ; RV64IZBA-NEXT: lui a0, 524288
416 ; RV64IZBA-NEXT: addiw a0, a0, -1
419 ; RV64IZBB-LABEL: imm_right_shifted_addi:
421 ; RV64IZBB-NEXT: lui a0, 524288
422 ; RV64IZBB-NEXT: addiw a0, a0, -1
425 ; RV64IZBS-LABEL: imm_right_shifted_addi:
427 ; RV64IZBS-NEXT: lui a0, 524288
428 ; RV64IZBS-NEXT: addiw a0, a0, -1
431 ; RV64IXTHEADBB-LABEL: imm_right_shifted_addi:
432 ; RV64IXTHEADBB: # %bb.0:
433 ; RV64IXTHEADBB-NEXT: lui a0, 524288
434 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1
435 ; RV64IXTHEADBB-NEXT: ret
437 ; RV32-REMAT-LABEL: imm_right_shifted_addi:
438 ; RV32-REMAT: # %bb.0:
439 ; RV32-REMAT-NEXT: lui a0, 524288
440 ; RV32-REMAT-NEXT: addi a0, a0, -1
441 ; RV32-REMAT-NEXT: ret
443 ; RV64-REMAT-LABEL: imm_right_shifted_addi:
444 ; RV64-REMAT: # %bb.0:
445 ; RV64-REMAT-NEXT: lui a0, 524288
446 ; RV64-REMAT-NEXT: addiw a0, a0, -1
447 ; RV64-REMAT-NEXT: ret
448 ret i32 2147483647 ; 0x7FFFFFFF
451 ; This can be materialized with LUI+SRLI, improving compressibility.
453 define signext i32 @imm_right_shifted_lui() nounwind {
454 ; RV32I-LABEL: imm_right_shifted_lui:
456 ; RV32I-NEXT: lui a0, 56
457 ; RV32I-NEXT: addi a0, a0, 580
460 ; RV64I-LABEL: imm_right_shifted_lui:
462 ; RV64I-NEXT: lui a0, 56
463 ; RV64I-NEXT: addiw a0, a0, 580
466 ; RV64IZBA-LABEL: imm_right_shifted_lui:
468 ; RV64IZBA-NEXT: lui a0, 56
469 ; RV64IZBA-NEXT: addiw a0, a0, 580
472 ; RV64IZBB-LABEL: imm_right_shifted_lui:
474 ; RV64IZBB-NEXT: lui a0, 56
475 ; RV64IZBB-NEXT: addiw a0, a0, 580
478 ; RV64IZBS-LABEL: imm_right_shifted_lui:
480 ; RV64IZBS-NEXT: lui a0, 56
481 ; RV64IZBS-NEXT: addiw a0, a0, 580
484 ; RV64IXTHEADBB-LABEL: imm_right_shifted_lui:
485 ; RV64IXTHEADBB: # %bb.0:
486 ; RV64IXTHEADBB-NEXT: lui a0, 56
487 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 580
488 ; RV64IXTHEADBB-NEXT: ret
490 ; RV32-REMAT-LABEL: imm_right_shifted_lui:
491 ; RV32-REMAT: # %bb.0:
492 ; RV32-REMAT-NEXT: lui a0, 56
493 ; RV32-REMAT-NEXT: addi a0, a0, 580
494 ; RV32-REMAT-NEXT: ret
496 ; RV64-REMAT-LABEL: imm_right_shifted_lui:
497 ; RV64-REMAT: # %bb.0:
498 ; RV64-REMAT-NEXT: lui a0, 56
499 ; RV64-REMAT-NEXT: addiw a0, a0, 580
500 ; RV64-REMAT-NEXT: ret
501 ret i32 229956 ; 0x38244
504 define i64 @imm64_1() nounwind {
505 ; RV32I-LABEL: imm64_1:
507 ; RV32I-NEXT: lui a0, 524288
508 ; RV32I-NEXT: li a1, 0
511 ; RV64I-LABEL: imm64_1:
513 ; RV64I-NEXT: li a0, 1
514 ; RV64I-NEXT: slli a0, a0, 31
517 ; RV64IZBA-LABEL: imm64_1:
519 ; RV64IZBA-NEXT: li a0, 1
520 ; RV64IZBA-NEXT: slli a0, a0, 31
523 ; RV64IZBB-LABEL: imm64_1:
525 ; RV64IZBB-NEXT: li a0, 1
526 ; RV64IZBB-NEXT: slli a0, a0, 31
529 ; RV64IZBS-LABEL: imm64_1:
531 ; RV64IZBS-NEXT: bseti a0, zero, 31
534 ; RV64IXTHEADBB-LABEL: imm64_1:
535 ; RV64IXTHEADBB: # %bb.0:
536 ; RV64IXTHEADBB-NEXT: li a0, 1
537 ; RV64IXTHEADBB-NEXT: slli a0, a0, 31
538 ; RV64IXTHEADBB-NEXT: ret
540 ; RV32-REMAT-LABEL: imm64_1:
541 ; RV32-REMAT: # %bb.0:
542 ; RV32-REMAT-NEXT: lui a0, 524288
543 ; RV32-REMAT-NEXT: li a1, 0
544 ; RV32-REMAT-NEXT: ret
546 ; RV64-REMAT-LABEL: imm64_1:
547 ; RV64-REMAT: # %bb.0:
548 ; RV64-REMAT-NEXT: li a0, 1
549 ; RV64-REMAT-NEXT: slli a0, a0, 31
550 ; RV64-REMAT-NEXT: ret
551 ret i64 2147483648 ; 0x8000_0000
554 define i64 @imm64_2() nounwind {
555 ; RV32I-LABEL: imm64_2:
557 ; RV32I-NEXT: li a0, -1
558 ; RV32I-NEXT: li a1, 0
561 ; RV64I-LABEL: imm64_2:
563 ; RV64I-NEXT: li a0, -1
564 ; RV64I-NEXT: srli a0, a0, 32
567 ; RV64IZBA-LABEL: imm64_2:
569 ; RV64IZBA-NEXT: li a0, -1
570 ; RV64IZBA-NEXT: srli a0, a0, 32
573 ; RV64IZBB-LABEL: imm64_2:
575 ; RV64IZBB-NEXT: li a0, -1
576 ; RV64IZBB-NEXT: srli a0, a0, 32
579 ; RV64IZBS-LABEL: imm64_2:
581 ; RV64IZBS-NEXT: li a0, -1
582 ; RV64IZBS-NEXT: srli a0, a0, 32
585 ; RV64IXTHEADBB-LABEL: imm64_2:
586 ; RV64IXTHEADBB: # %bb.0:
587 ; RV64IXTHEADBB-NEXT: li a0, -1
588 ; RV64IXTHEADBB-NEXT: srli a0, a0, 32
589 ; RV64IXTHEADBB-NEXT: ret
591 ; RV32-REMAT-LABEL: imm64_2:
592 ; RV32-REMAT: # %bb.0:
593 ; RV32-REMAT-NEXT: li a0, -1
594 ; RV32-REMAT-NEXT: li a1, 0
595 ; RV32-REMAT-NEXT: ret
597 ; RV64-REMAT-LABEL: imm64_2:
598 ; RV64-REMAT: # %bb.0:
599 ; RV64-REMAT-NEXT: li a0, -1
600 ; RV64-REMAT-NEXT: srli a0, a0, 32
601 ; RV64-REMAT-NEXT: ret
602 ret i64 4294967295 ; 0xFFFF_FFFF
605 define i64 @imm64_3() nounwind {
606 ; RV32I-LABEL: imm64_3:
608 ; RV32I-NEXT: li a1, 1
609 ; RV32I-NEXT: li a0, 0
612 ; RV64I-LABEL: imm64_3:
614 ; RV64I-NEXT: li a0, 1
615 ; RV64I-NEXT: slli a0, a0, 32
618 ; RV64IZBA-LABEL: imm64_3:
620 ; RV64IZBA-NEXT: li a0, 1
621 ; RV64IZBA-NEXT: slli a0, a0, 32
624 ; RV64IZBB-LABEL: imm64_3:
626 ; RV64IZBB-NEXT: li a0, 1
627 ; RV64IZBB-NEXT: slli a0, a0, 32
630 ; RV64IZBS-LABEL: imm64_3:
632 ; RV64IZBS-NEXT: bseti a0, zero, 32
635 ; RV64IXTHEADBB-LABEL: imm64_3:
636 ; RV64IXTHEADBB: # %bb.0:
637 ; RV64IXTHEADBB-NEXT: li a0, 1
638 ; RV64IXTHEADBB-NEXT: slli a0, a0, 32
639 ; RV64IXTHEADBB-NEXT: ret
641 ; RV32-REMAT-LABEL: imm64_3:
642 ; RV32-REMAT: # %bb.0:
643 ; RV32-REMAT-NEXT: li a1, 1
644 ; RV32-REMAT-NEXT: li a0, 0
645 ; RV32-REMAT-NEXT: ret
647 ; RV64-REMAT-LABEL: imm64_3:
648 ; RV64-REMAT: # %bb.0:
649 ; RV64-REMAT-NEXT: li a0, 1
650 ; RV64-REMAT-NEXT: slli a0, a0, 32
651 ; RV64-REMAT-NEXT: ret
652 ret i64 4294967296 ; 0x1_0000_0000
655 define i64 @imm64_4() nounwind {
656 ; RV32I-LABEL: imm64_4:
658 ; RV32I-NEXT: lui a1, 524288
659 ; RV32I-NEXT: li a0, 0
662 ; RV64I-LABEL: imm64_4:
664 ; RV64I-NEXT: li a0, -1
665 ; RV64I-NEXT: slli a0, a0, 63
668 ; RV64IZBA-LABEL: imm64_4:
670 ; RV64IZBA-NEXT: li a0, -1
671 ; RV64IZBA-NEXT: slli a0, a0, 63
674 ; RV64IZBB-LABEL: imm64_4:
676 ; RV64IZBB-NEXT: li a0, -1
677 ; RV64IZBB-NEXT: slli a0, a0, 63
680 ; RV64IZBS-LABEL: imm64_4:
682 ; RV64IZBS-NEXT: bseti a0, zero, 63
685 ; RV64IXTHEADBB-LABEL: imm64_4:
686 ; RV64IXTHEADBB: # %bb.0:
687 ; RV64IXTHEADBB-NEXT: li a0, -1
688 ; RV64IXTHEADBB-NEXT: slli a0, a0, 63
689 ; RV64IXTHEADBB-NEXT: ret
691 ; RV32-REMAT-LABEL: imm64_4:
692 ; RV32-REMAT: # %bb.0:
693 ; RV32-REMAT-NEXT: lui a1, 524288
694 ; RV32-REMAT-NEXT: li a0, 0
695 ; RV32-REMAT-NEXT: ret
697 ; RV64-REMAT-LABEL: imm64_4:
698 ; RV64-REMAT: # %bb.0:
699 ; RV64-REMAT-NEXT: li a0, -1
700 ; RV64-REMAT-NEXT: slli a0, a0, 63
701 ; RV64-REMAT-NEXT: ret
702 ret i64 9223372036854775808 ; 0x8000_0000_0000_0000
705 define i64 @imm64_5() nounwind {
706 ; RV32I-LABEL: imm64_5:
708 ; RV32I-NEXT: lui a1, 524288
709 ; RV32I-NEXT: li a0, 0
712 ; RV64I-LABEL: imm64_5:
714 ; RV64I-NEXT: li a0, -1
715 ; RV64I-NEXT: slli a0, a0, 63
718 ; RV64IZBA-LABEL: imm64_5:
720 ; RV64IZBA-NEXT: li a0, -1
721 ; RV64IZBA-NEXT: slli a0, a0, 63
724 ; RV64IZBB-LABEL: imm64_5:
726 ; RV64IZBB-NEXT: li a0, -1
727 ; RV64IZBB-NEXT: slli a0, a0, 63
730 ; RV64IZBS-LABEL: imm64_5:
732 ; RV64IZBS-NEXT: bseti a0, zero, 63
735 ; RV64IXTHEADBB-LABEL: imm64_5:
736 ; RV64IXTHEADBB: # %bb.0:
737 ; RV64IXTHEADBB-NEXT: li a0, -1
738 ; RV64IXTHEADBB-NEXT: slli a0, a0, 63
739 ; RV64IXTHEADBB-NEXT: ret
741 ; RV32-REMAT-LABEL: imm64_5:
742 ; RV32-REMAT: # %bb.0:
743 ; RV32-REMAT-NEXT: lui a1, 524288
744 ; RV32-REMAT-NEXT: li a0, 0
745 ; RV32-REMAT-NEXT: ret
747 ; RV64-REMAT-LABEL: imm64_5:
748 ; RV64-REMAT: # %bb.0:
749 ; RV64-REMAT-NEXT: li a0, -1
750 ; RV64-REMAT-NEXT: slli a0, a0, 63
751 ; RV64-REMAT-NEXT: ret
752 ret i64 -9223372036854775808 ; 0x8000_0000_0000_0000
755 define i64 @imm64_6() nounwind {
756 ; RV32I-LABEL: imm64_6:
758 ; RV32I-NEXT: lui a0, 74565
759 ; RV32I-NEXT: addi a1, a0, 1656
760 ; RV32I-NEXT: li a0, 0
763 ; RV64I-LABEL: imm64_6:
765 ; RV64I-NEXT: lui a0, 9321
766 ; RV64I-NEXT: addi a0, a0, -1329
767 ; RV64I-NEXT: slli a0, a0, 35
770 ; RV64IZBA-LABEL: imm64_6:
772 ; RV64IZBA-NEXT: lui a0, 9321
773 ; RV64IZBA-NEXT: addi a0, a0, -1329
774 ; RV64IZBA-NEXT: slli a0, a0, 35
777 ; RV64IZBB-LABEL: imm64_6:
779 ; RV64IZBB-NEXT: lui a0, 9321
780 ; RV64IZBB-NEXT: addi a0, a0, -1329
781 ; RV64IZBB-NEXT: slli a0, a0, 35
784 ; RV64IZBS-LABEL: imm64_6:
786 ; RV64IZBS-NEXT: lui a0, 9321
787 ; RV64IZBS-NEXT: addi a0, a0, -1329
788 ; RV64IZBS-NEXT: slli a0, a0, 35
791 ; RV64IXTHEADBB-LABEL: imm64_6:
792 ; RV64IXTHEADBB: # %bb.0:
793 ; RV64IXTHEADBB-NEXT: lui a0, 9321
794 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1329
795 ; RV64IXTHEADBB-NEXT: slli a0, a0, 35
796 ; RV64IXTHEADBB-NEXT: ret
798 ; RV32-REMAT-LABEL: imm64_6:
799 ; RV32-REMAT: # %bb.0:
800 ; RV32-REMAT-NEXT: lui a1, 74565
801 ; RV32-REMAT-NEXT: addi a1, a1, 1656
802 ; RV32-REMAT-NEXT: li a0, 0
803 ; RV32-REMAT-NEXT: ret
805 ; RV64-REMAT-LABEL: imm64_6:
806 ; RV64-REMAT: # %bb.0:
807 ; RV64-REMAT-NEXT: lui a0, 9321
808 ; RV64-REMAT-NEXT: addi a0, a0, -1329
809 ; RV64-REMAT-NEXT: slli a0, a0, 35
810 ; RV64-REMAT-NEXT: ret
811 ret i64 1311768464867721216 ; 0x1234_5678_0000_0000
814 define i64 @imm64_7() nounwind {
815 ; RV32I-LABEL: imm64_7:
817 ; RV32I-NEXT: lui a0, 45056
818 ; RV32I-NEXT: addi a0, a0, 15
819 ; RV32I-NEXT: lui a1, 458752
822 ; RV64I-LABEL: imm64_7:
824 ; RV64I-NEXT: li a0, 7
825 ; RV64I-NEXT: slli a0, a0, 36
826 ; RV64I-NEXT: addi a0, a0, 11
827 ; RV64I-NEXT: slli a0, a0, 24
828 ; RV64I-NEXT: addi a0, a0, 15
831 ; RV64IZBA-LABEL: imm64_7:
833 ; RV64IZBA-NEXT: li a0, 7
834 ; RV64IZBA-NEXT: slli a0, a0, 36
835 ; RV64IZBA-NEXT: addi a0, a0, 11
836 ; RV64IZBA-NEXT: slli a0, a0, 24
837 ; RV64IZBA-NEXT: addi a0, a0, 15
840 ; RV64IZBB-LABEL: imm64_7:
842 ; RV64IZBB-NEXT: li a0, 7
843 ; RV64IZBB-NEXT: slli a0, a0, 36
844 ; RV64IZBB-NEXT: addi a0, a0, 11
845 ; RV64IZBB-NEXT: slli a0, a0, 24
846 ; RV64IZBB-NEXT: addi a0, a0, 15
849 ; RV64IZBS-LABEL: imm64_7:
851 ; RV64IZBS-NEXT: li a0, 7
852 ; RV64IZBS-NEXT: slli a0, a0, 36
853 ; RV64IZBS-NEXT: addi a0, a0, 11
854 ; RV64IZBS-NEXT: slli a0, a0, 24
855 ; RV64IZBS-NEXT: addi a0, a0, 15
858 ; RV64IXTHEADBB-LABEL: imm64_7:
859 ; RV64IXTHEADBB: # %bb.0:
860 ; RV64IXTHEADBB-NEXT: li a0, 7
861 ; RV64IXTHEADBB-NEXT: slli a0, a0, 36
862 ; RV64IXTHEADBB-NEXT: addi a0, a0, 11
863 ; RV64IXTHEADBB-NEXT: slli a0, a0, 24
864 ; RV64IXTHEADBB-NEXT: addi a0, a0, 15
865 ; RV64IXTHEADBB-NEXT: ret
867 ; RV32-REMAT-LABEL: imm64_7:
868 ; RV32-REMAT: # %bb.0:
869 ; RV32-REMAT-NEXT: lui a0, 45056
870 ; RV32-REMAT-NEXT: addi a0, a0, 15
871 ; RV32-REMAT-NEXT: lui a1, 458752
872 ; RV32-REMAT-NEXT: ret
874 ; RV64-REMAT-LABEL: imm64_7:
875 ; RV64-REMAT: # %bb.0:
876 ; RV64-REMAT-NEXT: li a0, 7
877 ; RV64-REMAT-NEXT: slli a0, a0, 36
878 ; RV64-REMAT-NEXT: addi a0, a0, 11
879 ; RV64-REMAT-NEXT: slli a0, a0, 24
880 ; RV64-REMAT-NEXT: addi a0, a0, 15
881 ; RV64-REMAT-NEXT: ret
882 ret i64 8070450532432478223 ; 0x7000_0000_0B00_000F
885 ; TODO: it can be preferable to put constants that are expensive to materialise
886 ; into the constant pool, especially for -Os.
887 define i64 @imm64_8() nounwind {
888 ; RV32I-LABEL: imm64_8:
890 ; RV32I-NEXT: lui a0, 633806
891 ; RV32I-NEXT: addi a0, a0, -272
892 ; RV32I-NEXT: lui a1, 74565
893 ; RV32I-NEXT: addi a1, a1, 1656
896 ; RV64-NOPOOL-LABEL: imm64_8:
897 ; RV64-NOPOOL: # %bb.0:
898 ; RV64-NOPOOL-NEXT: lui a0, 583
899 ; RV64-NOPOOL-NEXT: addiw a0, a0, -1875
900 ; RV64-NOPOOL-NEXT: slli a0, a0, 14
901 ; RV64-NOPOOL-NEXT: addi a0, a0, -947
902 ; RV64-NOPOOL-NEXT: slli a0, a0, 12
903 ; RV64-NOPOOL-NEXT: addi a0, a0, 1511
904 ; RV64-NOPOOL-NEXT: slli a0, a0, 13
905 ; RV64-NOPOOL-NEXT: addi a0, a0, -272
906 ; RV64-NOPOOL-NEXT: ret
908 ; RV64I-POOL-LABEL: imm64_8:
909 ; RV64I-POOL: # %bb.0:
910 ; RV64I-POOL-NEXT: lui a0, %hi(.LCPI17_0)
911 ; RV64I-POOL-NEXT: ld a0, %lo(.LCPI17_0)(a0)
912 ; RV64I-POOL-NEXT: ret
914 ; RV64IZBA-LABEL: imm64_8:
916 ; RV64IZBA-NEXT: lui a0, 596523
917 ; RV64IZBA-NEXT: addi a0, a0, 965
918 ; RV64IZBA-NEXT: slli.uw a0, a0, 13
919 ; RV64IZBA-NEXT: addi a0, a0, -1347
920 ; RV64IZBA-NEXT: slli a0, a0, 12
921 ; RV64IZBA-NEXT: addi a0, a0, -529
922 ; RV64IZBA-NEXT: slli a0, a0, 4
925 ; RV64IZBB-LABEL: imm64_8:
927 ; RV64IZBB-NEXT: lui a0, 583
928 ; RV64IZBB-NEXT: addiw a0, a0, -1875
929 ; RV64IZBB-NEXT: slli a0, a0, 14
930 ; RV64IZBB-NEXT: addi a0, a0, -947
931 ; RV64IZBB-NEXT: slli a0, a0, 12
932 ; RV64IZBB-NEXT: addi a0, a0, 1511
933 ; RV64IZBB-NEXT: slli a0, a0, 13
934 ; RV64IZBB-NEXT: addi a0, a0, -272
937 ; RV64IZBS-LABEL: imm64_8:
939 ; RV64IZBS-NEXT: lui a0, 583
940 ; RV64IZBS-NEXT: addiw a0, a0, -1875
941 ; RV64IZBS-NEXT: slli a0, a0, 14
942 ; RV64IZBS-NEXT: addi a0, a0, -947
943 ; RV64IZBS-NEXT: slli a0, a0, 12
944 ; RV64IZBS-NEXT: addi a0, a0, 1511
945 ; RV64IZBS-NEXT: slli a0, a0, 13
946 ; RV64IZBS-NEXT: addi a0, a0, -272
949 ; RV64IXTHEADBB-LABEL: imm64_8:
950 ; RV64IXTHEADBB: # %bb.0:
951 ; RV64IXTHEADBB-NEXT: lui a0, 583
952 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1875
953 ; RV64IXTHEADBB-NEXT: slli a0, a0, 14
954 ; RV64IXTHEADBB-NEXT: addi a0, a0, -947
955 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
956 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1511
957 ; RV64IXTHEADBB-NEXT: slli a0, a0, 13
958 ; RV64IXTHEADBB-NEXT: addi a0, a0, -272
959 ; RV64IXTHEADBB-NEXT: ret
961 ; RV32-REMAT-LABEL: imm64_8:
962 ; RV32-REMAT: # %bb.0:
963 ; RV32-REMAT-NEXT: lui a0, 633806
964 ; RV32-REMAT-NEXT: addi a0, a0, -272
965 ; RV32-REMAT-NEXT: lui a1, 74565
966 ; RV32-REMAT-NEXT: addi a1, a1, 1656
967 ; RV32-REMAT-NEXT: ret
969 ; RV64-REMAT-LABEL: imm64_8:
970 ; RV64-REMAT: # %bb.0:
971 ; RV64-REMAT-NEXT: lui a0, 583
972 ; RV64-REMAT-NEXT: addiw a0, a0, -1875
973 ; RV64-REMAT-NEXT: slli a0, a0, 14
974 ; RV64-REMAT-NEXT: addi a0, a0, -947
975 ; RV64-REMAT-NEXT: slli a0, a0, 12
976 ; RV64-REMAT-NEXT: addi a0, a0, 1511
977 ; RV64-REMAT-NEXT: slli a0, a0, 13
978 ; RV64-REMAT-NEXT: addi a0, a0, -272
979 ; RV64-REMAT-NEXT: ret
980 ret i64 1311768467463790320 ; 0x1234_5678_9ABC_DEF0
983 define i64 @imm64_9() nounwind {
984 ; RV32I-LABEL: imm64_9:
986 ; RV32I-NEXT: li a0, -1
987 ; RV32I-NEXT: li a1, -1
990 ; RV64I-LABEL: imm64_9:
992 ; RV64I-NEXT: li a0, -1
995 ; RV64IZBA-LABEL: imm64_9:
997 ; RV64IZBA-NEXT: li a0, -1
1000 ; RV64IZBB-LABEL: imm64_9:
1001 ; RV64IZBB: # %bb.0:
1002 ; RV64IZBB-NEXT: li a0, -1
1003 ; RV64IZBB-NEXT: ret
1005 ; RV64IZBS-LABEL: imm64_9:
1006 ; RV64IZBS: # %bb.0:
1007 ; RV64IZBS-NEXT: li a0, -1
1008 ; RV64IZBS-NEXT: ret
1010 ; RV64IXTHEADBB-LABEL: imm64_9:
1011 ; RV64IXTHEADBB: # %bb.0:
1012 ; RV64IXTHEADBB-NEXT: li a0, -1
1013 ; RV64IXTHEADBB-NEXT: ret
1015 ; RV32-REMAT-LABEL: imm64_9:
1016 ; RV32-REMAT: # %bb.0:
1017 ; RV32-REMAT-NEXT: li a0, -1
1018 ; RV32-REMAT-NEXT: li a1, -1
1019 ; RV32-REMAT-NEXT: ret
1021 ; RV64-REMAT-LABEL: imm64_9:
1022 ; RV64-REMAT: # %bb.0:
1023 ; RV64-REMAT-NEXT: li a0, -1
1024 ; RV64-REMAT-NEXT: ret
1028 ; Various cases where extraneous ADDIs can be inserted where a (left shifted)
1031 define i64 @imm_left_shifted_lui_1() nounwind {
1032 ; RV32I-LABEL: imm_left_shifted_lui_1:
1034 ; RV32I-NEXT: lui a0, 524290
1035 ; RV32I-NEXT: li a1, 0
1038 ; RV64I-LABEL: imm_left_shifted_lui_1:
1040 ; RV64I-NEXT: lui a0, 262145
1041 ; RV64I-NEXT: slli a0, a0, 1
1044 ; RV64IZBA-LABEL: imm_left_shifted_lui_1:
1045 ; RV64IZBA: # %bb.0:
1046 ; RV64IZBA-NEXT: lui a0, 262145
1047 ; RV64IZBA-NEXT: slli a0, a0, 1
1048 ; RV64IZBA-NEXT: ret
1050 ; RV64IZBB-LABEL: imm_left_shifted_lui_1:
1051 ; RV64IZBB: # %bb.0:
1052 ; RV64IZBB-NEXT: lui a0, 262145
1053 ; RV64IZBB-NEXT: slli a0, a0, 1
1054 ; RV64IZBB-NEXT: ret
1056 ; RV64IZBS-LABEL: imm_left_shifted_lui_1:
1057 ; RV64IZBS: # %bb.0:
1058 ; RV64IZBS-NEXT: lui a0, 262145
1059 ; RV64IZBS-NEXT: slli a0, a0, 1
1060 ; RV64IZBS-NEXT: ret
1062 ; RV64IXTHEADBB-LABEL: imm_left_shifted_lui_1:
1063 ; RV64IXTHEADBB: # %bb.0:
1064 ; RV64IXTHEADBB-NEXT: lui a0, 262145
1065 ; RV64IXTHEADBB-NEXT: slli a0, a0, 1
1066 ; RV64IXTHEADBB-NEXT: ret
1068 ; RV32-REMAT-LABEL: imm_left_shifted_lui_1:
1069 ; RV32-REMAT: # %bb.0:
1070 ; RV32-REMAT-NEXT: lui a0, 524290
1071 ; RV32-REMAT-NEXT: li a1, 0
1072 ; RV32-REMAT-NEXT: ret
1074 ; RV64-REMAT-LABEL: imm_left_shifted_lui_1:
1075 ; RV64-REMAT: # %bb.0:
1076 ; RV64-REMAT-NEXT: lui a0, 262145
1077 ; RV64-REMAT-NEXT: slli a0, a0, 1
1078 ; RV64-REMAT-NEXT: ret
1079 ret i64 2147491840 ; 0x8000_2000
1082 define i64 @imm_left_shifted_lui_2() nounwind {
1083 ; RV32I-LABEL: imm_left_shifted_lui_2:
1085 ; RV32I-NEXT: lui a0, 4
1086 ; RV32I-NEXT: li a1, 1
1089 ; RV64I-LABEL: imm_left_shifted_lui_2:
1091 ; RV64I-NEXT: lui a0, 262145
1092 ; RV64I-NEXT: slli a0, a0, 2
1095 ; RV64IZBA-LABEL: imm_left_shifted_lui_2:
1096 ; RV64IZBA: # %bb.0:
1097 ; RV64IZBA-NEXT: lui a0, 262145
1098 ; RV64IZBA-NEXT: slli a0, a0, 2
1099 ; RV64IZBA-NEXT: ret
1101 ; RV64IZBB-LABEL: imm_left_shifted_lui_2:
1102 ; RV64IZBB: # %bb.0:
1103 ; RV64IZBB-NEXT: lui a0, 262145
1104 ; RV64IZBB-NEXT: slli a0, a0, 2
1105 ; RV64IZBB-NEXT: ret
1107 ; RV64IZBS-LABEL: imm_left_shifted_lui_2:
1108 ; RV64IZBS: # %bb.0:
1109 ; RV64IZBS-NEXT: lui a0, 262145
1110 ; RV64IZBS-NEXT: slli a0, a0, 2
1111 ; RV64IZBS-NEXT: ret
1113 ; RV64IXTHEADBB-LABEL: imm_left_shifted_lui_2:
1114 ; RV64IXTHEADBB: # %bb.0:
1115 ; RV64IXTHEADBB-NEXT: lui a0, 262145
1116 ; RV64IXTHEADBB-NEXT: slli a0, a0, 2
1117 ; RV64IXTHEADBB-NEXT: ret
1119 ; RV32-REMAT-LABEL: imm_left_shifted_lui_2:
1120 ; RV32-REMAT: # %bb.0:
1121 ; RV32-REMAT-NEXT: lui a0, 4
1122 ; RV32-REMAT-NEXT: li a1, 1
1123 ; RV32-REMAT-NEXT: ret
1125 ; RV64-REMAT-LABEL: imm_left_shifted_lui_2:
1126 ; RV64-REMAT: # %bb.0:
1127 ; RV64-REMAT-NEXT: lui a0, 262145
1128 ; RV64-REMAT-NEXT: slli a0, a0, 2
1129 ; RV64-REMAT-NEXT: ret
1130 ret i64 4294983680 ; 0x1_0000_4000
1133 define i64 @imm_left_shifted_lui_3() nounwind {
1134 ; RV32I-LABEL: imm_left_shifted_lui_3:
1136 ; RV32I-NEXT: lui a1, 1
1137 ; RV32I-NEXT: addi a1, a1, 1
1138 ; RV32I-NEXT: li a0, 0
1141 ; RV64I-LABEL: imm_left_shifted_lui_3:
1143 ; RV64I-NEXT: lui a0, 4097
1144 ; RV64I-NEXT: slli a0, a0, 20
1147 ; RV64IZBA-LABEL: imm_left_shifted_lui_3:
1148 ; RV64IZBA: # %bb.0:
1149 ; RV64IZBA-NEXT: lui a0, 4097
1150 ; RV64IZBA-NEXT: slli a0, a0, 20
1151 ; RV64IZBA-NEXT: ret
1153 ; RV64IZBB-LABEL: imm_left_shifted_lui_3:
1154 ; RV64IZBB: # %bb.0:
1155 ; RV64IZBB-NEXT: lui a0, 4097
1156 ; RV64IZBB-NEXT: slli a0, a0, 20
1157 ; RV64IZBB-NEXT: ret
1159 ; RV64IZBS-LABEL: imm_left_shifted_lui_3:
1160 ; RV64IZBS: # %bb.0:
1161 ; RV64IZBS-NEXT: lui a0, 4097
1162 ; RV64IZBS-NEXT: slli a0, a0, 20
1163 ; RV64IZBS-NEXT: ret
1165 ; RV64IXTHEADBB-LABEL: imm_left_shifted_lui_3:
1166 ; RV64IXTHEADBB: # %bb.0:
1167 ; RV64IXTHEADBB-NEXT: lui a0, 4097
1168 ; RV64IXTHEADBB-NEXT: slli a0, a0, 20
1169 ; RV64IXTHEADBB-NEXT: ret
1171 ; RV32-REMAT-LABEL: imm_left_shifted_lui_3:
1172 ; RV32-REMAT: # %bb.0:
1173 ; RV32-REMAT-NEXT: lui a1, 1
1174 ; RV32-REMAT-NEXT: addi a1, a1, 1
1175 ; RV32-REMAT-NEXT: li a0, 0
1176 ; RV32-REMAT-NEXT: ret
1178 ; RV64-REMAT-LABEL: imm_left_shifted_lui_3:
1179 ; RV64-REMAT: # %bb.0:
1180 ; RV64-REMAT-NEXT: lui a0, 4097
1181 ; RV64-REMAT-NEXT: slli a0, a0, 20
1182 ; RV64-REMAT-NEXT: ret
1183 ret i64 17596481011712 ; 0x1001_0000_0000
1186 ; Various cases where extraneous ADDIs can be inserted where a (right shifted)
1187 ; LUI suffices, or where multiple ADDIs can be used instead of a single LUI.
1189 define i64 @imm_right_shifted_lui_1() nounwind {
1190 ; RV32I-LABEL: imm_right_shifted_lui_1:
1192 ; RV32I-NEXT: lui a0, 1048575
1193 ; RV32I-NEXT: addi a0, a0, 1
1194 ; RV32I-NEXT: lui a1, 16
1195 ; RV32I-NEXT: addi a1, a1, -1
1198 ; RV64I-LABEL: imm_right_shifted_lui_1:
1200 ; RV64I-NEXT: lui a0, 983056
1201 ; RV64I-NEXT: srli a0, a0, 16
1204 ; RV64IZBA-LABEL: imm_right_shifted_lui_1:
1205 ; RV64IZBA: # %bb.0:
1206 ; RV64IZBA-NEXT: lui a0, 983056
1207 ; RV64IZBA-NEXT: srli a0, a0, 16
1208 ; RV64IZBA-NEXT: ret
1210 ; RV64IZBB-LABEL: imm_right_shifted_lui_1:
1211 ; RV64IZBB: # %bb.0:
1212 ; RV64IZBB-NEXT: lui a0, 983056
1213 ; RV64IZBB-NEXT: srli a0, a0, 16
1214 ; RV64IZBB-NEXT: ret
1216 ; RV64IZBS-LABEL: imm_right_shifted_lui_1:
1217 ; RV64IZBS: # %bb.0:
1218 ; RV64IZBS-NEXT: lui a0, 983056
1219 ; RV64IZBS-NEXT: srli a0, a0, 16
1220 ; RV64IZBS-NEXT: ret
1222 ; RV64IXTHEADBB-LABEL: imm_right_shifted_lui_1:
1223 ; RV64IXTHEADBB: # %bb.0:
1224 ; RV64IXTHEADBB-NEXT: lui a0, 983056
1225 ; RV64IXTHEADBB-NEXT: srli a0, a0, 16
1226 ; RV64IXTHEADBB-NEXT: ret
1228 ; RV32-REMAT-LABEL: imm_right_shifted_lui_1:
1229 ; RV32-REMAT: # %bb.0:
1230 ; RV32-REMAT-NEXT: lui a0, 1048575
1231 ; RV32-REMAT-NEXT: addi a0, a0, 1
1232 ; RV32-REMAT-NEXT: lui a1, 16
1233 ; RV32-REMAT-NEXT: addi a1, a1, -1
1234 ; RV32-REMAT-NEXT: ret
1236 ; RV64-REMAT-LABEL: imm_right_shifted_lui_1:
1237 ; RV64-REMAT: # %bb.0:
1238 ; RV64-REMAT-NEXT: lui a0, 983056
1239 ; RV64-REMAT-NEXT: srli a0, a0, 16
1240 ; RV64-REMAT-NEXT: ret
1241 ret i64 281474976706561 ; 0xFFFF_FFFF_F001
1244 define i64 @imm_right_shifted_lui_2() nounwind {
1245 ; RV32I-LABEL: imm_right_shifted_lui_2:
1247 ; RV32I-NEXT: lui a0, 1048575
1248 ; RV32I-NEXT: addi a0, a0, 1
1249 ; RV32I-NEXT: li a1, 255
1252 ; RV64I-LABEL: imm_right_shifted_lui_2:
1254 ; RV64I-NEXT: lui a0, 1044481
1255 ; RV64I-NEXT: slli a0, a0, 12
1256 ; RV64I-NEXT: srli a0, a0, 24
1259 ; RV64IZBA-LABEL: imm_right_shifted_lui_2:
1260 ; RV64IZBA: # %bb.0:
1261 ; RV64IZBA-NEXT: lui a0, 1044481
1262 ; RV64IZBA-NEXT: slli a0, a0, 12
1263 ; RV64IZBA-NEXT: srli a0, a0, 24
1264 ; RV64IZBA-NEXT: ret
1266 ; RV64IZBB-LABEL: imm_right_shifted_lui_2:
1267 ; RV64IZBB: # %bb.0:
1268 ; RV64IZBB-NEXT: lui a0, 1044481
1269 ; RV64IZBB-NEXT: slli a0, a0, 12
1270 ; RV64IZBB-NEXT: srli a0, a0, 24
1271 ; RV64IZBB-NEXT: ret
1273 ; RV64IZBS-LABEL: imm_right_shifted_lui_2:
1274 ; RV64IZBS: # %bb.0:
1275 ; RV64IZBS-NEXT: lui a0, 1044481
1276 ; RV64IZBS-NEXT: slli a0, a0, 12
1277 ; RV64IZBS-NEXT: srli a0, a0, 24
1278 ; RV64IZBS-NEXT: ret
1280 ; RV64IXTHEADBB-LABEL: imm_right_shifted_lui_2:
1281 ; RV64IXTHEADBB: # %bb.0:
1282 ; RV64IXTHEADBB-NEXT: lui a0, 1044481
1283 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
1284 ; RV64IXTHEADBB-NEXT: srli a0, a0, 24
1285 ; RV64IXTHEADBB-NEXT: ret
1287 ; RV32-REMAT-LABEL: imm_right_shifted_lui_2:
1288 ; RV32-REMAT: # %bb.0:
1289 ; RV32-REMAT-NEXT: lui a0, 1048575
1290 ; RV32-REMAT-NEXT: addi a0, a0, 1
1291 ; RV32-REMAT-NEXT: li a1, 255
1292 ; RV32-REMAT-NEXT: ret
1294 ; RV64-REMAT-LABEL: imm_right_shifted_lui_2:
1295 ; RV64-REMAT: # %bb.0:
1296 ; RV64-REMAT-NEXT: lui a0, 1044481
1297 ; RV64-REMAT-NEXT: slli a0, a0, 12
1298 ; RV64-REMAT-NEXT: srli a0, a0, 24
1299 ; RV64-REMAT-NEXT: ret
1300 ret i64 1099511623681 ; 0xFF_FFFF_F001
1303 ; We can materialize the upper bits with a single (shifted) LUI, but that option
1304 ; can be missed due to the lower bits, which aren't just 1s or just 0s.
1306 define i64 @imm_decoupled_lui_addi() nounwind {
1307 ; RV32I-LABEL: imm_decoupled_lui_addi:
1309 ; RV32I-NEXT: li a0, -3
1310 ; RV32I-NEXT: lui a1, 1
1313 ; RV64I-LABEL: imm_decoupled_lui_addi:
1315 ; RV64I-NEXT: lui a0, 4097
1316 ; RV64I-NEXT: slli a0, a0, 20
1317 ; RV64I-NEXT: addi a0, a0, -3
1320 ; RV64IZBA-LABEL: imm_decoupled_lui_addi:
1321 ; RV64IZBA: # %bb.0:
1322 ; RV64IZBA-NEXT: lui a0, 4097
1323 ; RV64IZBA-NEXT: slli a0, a0, 20
1324 ; RV64IZBA-NEXT: addi a0, a0, -3
1325 ; RV64IZBA-NEXT: ret
1327 ; RV64IZBB-LABEL: imm_decoupled_lui_addi:
1328 ; RV64IZBB: # %bb.0:
1329 ; RV64IZBB-NEXT: lui a0, 4097
1330 ; RV64IZBB-NEXT: slli a0, a0, 20
1331 ; RV64IZBB-NEXT: addi a0, a0, -3
1332 ; RV64IZBB-NEXT: ret
1334 ; RV64IZBS-LABEL: imm_decoupled_lui_addi:
1335 ; RV64IZBS: # %bb.0:
1336 ; RV64IZBS-NEXT: lui a0, 4097
1337 ; RV64IZBS-NEXT: slli a0, a0, 20
1338 ; RV64IZBS-NEXT: addi a0, a0, -3
1339 ; RV64IZBS-NEXT: ret
1341 ; RV64IXTHEADBB-LABEL: imm_decoupled_lui_addi:
1342 ; RV64IXTHEADBB: # %bb.0:
1343 ; RV64IXTHEADBB-NEXT: lui a0, 4097
1344 ; RV64IXTHEADBB-NEXT: slli a0, a0, 20
1345 ; RV64IXTHEADBB-NEXT: addi a0, a0, -3
1346 ; RV64IXTHEADBB-NEXT: ret
1348 ; RV32-REMAT-LABEL: imm_decoupled_lui_addi:
1349 ; RV32-REMAT: # %bb.0:
1350 ; RV32-REMAT-NEXT: li a0, -3
1351 ; RV32-REMAT-NEXT: lui a1, 1
1352 ; RV32-REMAT-NEXT: ret
1354 ; RV64-REMAT-LABEL: imm_decoupled_lui_addi:
1355 ; RV64-REMAT: # %bb.0:
1356 ; RV64-REMAT-NEXT: lui a0, 4097
1357 ; RV64-REMAT-NEXT: slli a0, a0, 20
1358 ; RV64-REMAT-NEXT: addi a0, a0, -3
1359 ; RV64-REMAT-NEXT: ret
1360 ret i64 17596481011709 ; 0x1000_FFFF_FFFD
1363 ; This constant can be materialized for RV64 with LUI+SRLI+XORI.
1365 define i64 @imm_end_xori_1() nounwind {
1366 ; RV32I-LABEL: imm_end_xori_1:
1368 ; RV32I-NEXT: lui a0, 8192
1369 ; RV32I-NEXT: addi a0, a0, -1
1370 ; RV32I-NEXT: lui a1, 917504
1373 ; RV64I-LABEL: imm_end_xori_1:
1375 ; RV64I-NEXT: lui a0, 983040
1376 ; RV64I-NEXT: srli a0, a0, 3
1377 ; RV64I-NEXT: not a0, a0
1380 ; RV64IZBA-LABEL: imm_end_xori_1:
1381 ; RV64IZBA: # %bb.0:
1382 ; RV64IZBA-NEXT: lui a0, 983040
1383 ; RV64IZBA-NEXT: srli a0, a0, 3
1384 ; RV64IZBA-NEXT: not a0, a0
1385 ; RV64IZBA-NEXT: ret
1387 ; RV64IZBB-LABEL: imm_end_xori_1:
1388 ; RV64IZBB: # %bb.0:
1389 ; RV64IZBB-NEXT: lui a0, 983040
1390 ; RV64IZBB-NEXT: srli a0, a0, 3
1391 ; RV64IZBB-NEXT: not a0, a0
1392 ; RV64IZBB-NEXT: ret
1394 ; RV64IZBS-LABEL: imm_end_xori_1:
1395 ; RV64IZBS: # %bb.0:
1396 ; RV64IZBS-NEXT: lui a0, 983040
1397 ; RV64IZBS-NEXT: srli a0, a0, 3
1398 ; RV64IZBS-NEXT: not a0, a0
1399 ; RV64IZBS-NEXT: ret
1401 ; RV64IXTHEADBB-LABEL: imm_end_xori_1:
1402 ; RV64IXTHEADBB: # %bb.0:
1403 ; RV64IXTHEADBB-NEXT: lui a0, 983040
1404 ; RV64IXTHEADBB-NEXT: srli a0, a0, 3
1405 ; RV64IXTHEADBB-NEXT: not a0, a0
1406 ; RV64IXTHEADBB-NEXT: ret
1408 ; RV32-REMAT-LABEL: imm_end_xori_1:
1409 ; RV32-REMAT: # %bb.0:
1410 ; RV32-REMAT-NEXT: lui a0, 8192
1411 ; RV32-REMAT-NEXT: addi a0, a0, -1
1412 ; RV32-REMAT-NEXT: lui a1, 917504
1413 ; RV32-REMAT-NEXT: ret
1415 ; RV64-REMAT-LABEL: imm_end_xori_1:
1416 ; RV64-REMAT: # %bb.0:
1417 ; RV64-REMAT-NEXT: lui a0, 983040
1418 ; RV64-REMAT-NEXT: srli a0, a0, 3
1419 ; RV64-REMAT-NEXT: not a0, a0
1420 ; RV64-REMAT-NEXT: ret
1421 ret i64 -2305843009180139521 ; 0xE000_0000_01FF_FFFF
1424 ; This constant can be materialized for RV64 with ADDI+SLLI+ADDI+ADDI.
1426 define i64 @imm_end_2addi_1() nounwind {
1427 ; RV32I-LABEL: imm_end_2addi_1:
1429 ; RV32I-NEXT: lui a0, 1048575
1430 ; RV32I-NEXT: addi a0, a0, 2047
1431 ; RV32I-NEXT: lui a1, 1048512
1432 ; RV32I-NEXT: addi a1, a1, 127
1435 ; RV64I-LABEL: imm_end_2addi_1:
1437 ; RV64I-NEXT: li a0, -2047
1438 ; RV64I-NEXT: slli a0, a0, 39
1439 ; RV64I-NEXT: addi a0, a0, -2048
1440 ; RV64I-NEXT: addi a0, a0, -1
1443 ; RV64IZBA-LABEL: imm_end_2addi_1:
1444 ; RV64IZBA: # %bb.0:
1445 ; RV64IZBA-NEXT: li a0, -2047
1446 ; RV64IZBA-NEXT: slli a0, a0, 39
1447 ; RV64IZBA-NEXT: addi a0, a0, -2048
1448 ; RV64IZBA-NEXT: addi a0, a0, -1
1449 ; RV64IZBA-NEXT: ret
1451 ; RV64IZBB-LABEL: imm_end_2addi_1:
1452 ; RV64IZBB: # %bb.0:
1453 ; RV64IZBB-NEXT: li a0, -2047
1454 ; RV64IZBB-NEXT: slli a0, a0, 39
1455 ; RV64IZBB-NEXT: addi a0, a0, -2048
1456 ; RV64IZBB-NEXT: addi a0, a0, -1
1457 ; RV64IZBB-NEXT: ret
1459 ; RV64IZBS-LABEL: imm_end_2addi_1:
1460 ; RV64IZBS: # %bb.0:
1461 ; RV64IZBS-NEXT: li a0, -2047
1462 ; RV64IZBS-NEXT: slli a0, a0, 39
1463 ; RV64IZBS-NEXT: addi a0, a0, -2048
1464 ; RV64IZBS-NEXT: addi a0, a0, -1
1465 ; RV64IZBS-NEXT: ret
1467 ; RV64IXTHEADBB-LABEL: imm_end_2addi_1:
1468 ; RV64IXTHEADBB: # %bb.0:
1469 ; RV64IXTHEADBB-NEXT: li a0, -2047
1470 ; RV64IXTHEADBB-NEXT: slli a0, a0, 39
1471 ; RV64IXTHEADBB-NEXT: addi a0, a0, -2048
1472 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1
1473 ; RV64IXTHEADBB-NEXT: ret
1475 ; RV32-REMAT-LABEL: imm_end_2addi_1:
1476 ; RV32-REMAT: # %bb.0:
1477 ; RV32-REMAT-NEXT: lui a0, 1048575
1478 ; RV32-REMAT-NEXT: addi a0, a0, 2047
1479 ; RV32-REMAT-NEXT: lui a1, 1048512
1480 ; RV32-REMAT-NEXT: addi a1, a1, 127
1481 ; RV32-REMAT-NEXT: ret
1483 ; RV64-REMAT-LABEL: imm_end_2addi_1:
1484 ; RV64-REMAT: # %bb.0:
1485 ; RV64-REMAT-NEXT: li a0, -2047
1486 ; RV64-REMAT-NEXT: slli a0, a0, 39
1487 ; RV64-REMAT-NEXT: addi a0, a0, -2048
1488 ; RV64-REMAT-NEXT: addi a0, a0, -1
1489 ; RV64-REMAT-NEXT: ret
1490 ret i64 -1125350151030785 ; 0xFFFC_007F_FFFF_F7FF
1493 ; This constant can be more efficiently materialized for RV64 if we use two
1494 ; registers instead of one.
1496 define i64 @imm_2reg_1() nounwind {
1497 ; RV32I-LABEL: imm_2reg_1:
1499 ; RV32I-NEXT: lui a0, 74565
1500 ; RV32I-NEXT: addi a0, a0, 1656
1501 ; RV32I-NEXT: lui a1, 983040
1504 ; RV64I-LABEL: imm_2reg_1:
1506 ; RV64I-NEXT: lui a0, 74565
1507 ; RV64I-NEXT: addiw a0, a0, 1656
1508 ; RV64I-NEXT: slli a1, a0, 57
1509 ; RV64I-NEXT: add a0, a0, a1
1512 ; RV64IZBA-LABEL: imm_2reg_1:
1513 ; RV64IZBA: # %bb.0:
1514 ; RV64IZBA-NEXT: lui a0, 74565
1515 ; RV64IZBA-NEXT: addiw a0, a0, 1656
1516 ; RV64IZBA-NEXT: slli a1, a0, 57
1517 ; RV64IZBA-NEXT: add a0, a0, a1
1518 ; RV64IZBA-NEXT: ret
1520 ; RV64IZBB-LABEL: imm_2reg_1:
1521 ; RV64IZBB: # %bb.0:
1522 ; RV64IZBB-NEXT: lui a0, 74565
1523 ; RV64IZBB-NEXT: addiw a0, a0, 1656
1524 ; RV64IZBB-NEXT: slli a1, a0, 57
1525 ; RV64IZBB-NEXT: add a0, a0, a1
1526 ; RV64IZBB-NEXT: ret
1528 ; RV64IZBS-LABEL: imm_2reg_1:
1529 ; RV64IZBS: # %bb.0:
1530 ; RV64IZBS-NEXT: lui a0, 74565
1531 ; RV64IZBS-NEXT: addiw a0, a0, 1656
1532 ; RV64IZBS-NEXT: slli a1, a0, 57
1533 ; RV64IZBS-NEXT: add a0, a0, a1
1534 ; RV64IZBS-NEXT: ret
1536 ; RV64IXTHEADBB-LABEL: imm_2reg_1:
1537 ; RV64IXTHEADBB: # %bb.0:
1538 ; RV64IXTHEADBB-NEXT: lui a0, 74565
1539 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 1656
1540 ; RV64IXTHEADBB-NEXT: slli a1, a0, 57
1541 ; RV64IXTHEADBB-NEXT: add a0, a0, a1
1542 ; RV64IXTHEADBB-NEXT: ret
1544 ; RV32-REMAT-LABEL: imm_2reg_1:
1545 ; RV32-REMAT: # %bb.0:
1546 ; RV32-REMAT-NEXT: lui a0, 74565
1547 ; RV32-REMAT-NEXT: addi a0, a0, 1656
1548 ; RV32-REMAT-NEXT: lui a1, 983040
1549 ; RV32-REMAT-NEXT: ret
1551 ; RV64-REMAT-LABEL: imm_2reg_1:
1552 ; RV64-REMAT: # %bb.0:
1553 ; RV64-REMAT-NEXT: lui a0, 74565
1554 ; RV64-REMAT-NEXT: addiw a0, a0, 1656
1555 ; RV64-REMAT-NEXT: slli a1, a0, 57
1556 ; RV64-REMAT-NEXT: add a0, a0, a1
1557 ; RV64-REMAT-NEXT: ret
1558 ret i64 -1152921504301427080 ; 0xF000_0000_1234_5678
1561 ; FIXME: This should use a single ADDI for the immediate.
1562 define void @imm_store_i16_neg1(ptr %p) nounwind {
1563 ; RV32I-LABEL: imm_store_i16_neg1:
1565 ; RV32I-NEXT: li a1, -1
1566 ; RV32I-NEXT: sh a1, 0(a0)
1569 ; RV64I-LABEL: imm_store_i16_neg1:
1571 ; RV64I-NEXT: li a1, -1
1572 ; RV64I-NEXT: sh a1, 0(a0)
1575 ; RV64IZBA-LABEL: imm_store_i16_neg1:
1576 ; RV64IZBA: # %bb.0:
1577 ; RV64IZBA-NEXT: li a1, -1
1578 ; RV64IZBA-NEXT: sh a1, 0(a0)
1579 ; RV64IZBA-NEXT: ret
1581 ; RV64IZBB-LABEL: imm_store_i16_neg1:
1582 ; RV64IZBB: # %bb.0:
1583 ; RV64IZBB-NEXT: li a1, -1
1584 ; RV64IZBB-NEXT: sh a1, 0(a0)
1585 ; RV64IZBB-NEXT: ret
1587 ; RV64IZBS-LABEL: imm_store_i16_neg1:
1588 ; RV64IZBS: # %bb.0:
1589 ; RV64IZBS-NEXT: li a1, -1
1590 ; RV64IZBS-NEXT: sh a1, 0(a0)
1591 ; RV64IZBS-NEXT: ret
1593 ; RV64IXTHEADBB-LABEL: imm_store_i16_neg1:
1594 ; RV64IXTHEADBB: # %bb.0:
1595 ; RV64IXTHEADBB-NEXT: li a1, -1
1596 ; RV64IXTHEADBB-NEXT: sh a1, 0(a0)
1597 ; RV64IXTHEADBB-NEXT: ret
1599 ; RV32-REMAT-LABEL: imm_store_i16_neg1:
1600 ; RV32-REMAT: # %bb.0:
1601 ; RV32-REMAT-NEXT: li a1, -1
1602 ; RV32-REMAT-NEXT: sh a1, 0(a0)
1603 ; RV32-REMAT-NEXT: ret
1605 ; RV64-REMAT-LABEL: imm_store_i16_neg1:
1606 ; RV64-REMAT: # %bb.0:
1607 ; RV64-REMAT-NEXT: li a1, -1
1608 ; RV64-REMAT-NEXT: sh a1, 0(a0)
1609 ; RV64-REMAT-NEXT: ret
1610 store i16 -1, ptr %p
1614 ; FIXME: This should use a single ADDI for the immediate.
1615 define void @imm_store_i32_neg1(ptr %p) nounwind {
1616 ; RV32I-LABEL: imm_store_i32_neg1:
1618 ; RV32I-NEXT: li a1, -1
1619 ; RV32I-NEXT: sw a1, 0(a0)
1622 ; RV64I-LABEL: imm_store_i32_neg1:
1624 ; RV64I-NEXT: li a1, -1
1625 ; RV64I-NEXT: sw a1, 0(a0)
1628 ; RV64IZBA-LABEL: imm_store_i32_neg1:
1629 ; RV64IZBA: # %bb.0:
1630 ; RV64IZBA-NEXT: li a1, -1
1631 ; RV64IZBA-NEXT: sw a1, 0(a0)
1632 ; RV64IZBA-NEXT: ret
1634 ; RV64IZBB-LABEL: imm_store_i32_neg1:
1635 ; RV64IZBB: # %bb.0:
1636 ; RV64IZBB-NEXT: li a1, -1
1637 ; RV64IZBB-NEXT: sw a1, 0(a0)
1638 ; RV64IZBB-NEXT: ret
1640 ; RV64IZBS-LABEL: imm_store_i32_neg1:
1641 ; RV64IZBS: # %bb.0:
1642 ; RV64IZBS-NEXT: li a1, -1
1643 ; RV64IZBS-NEXT: sw a1, 0(a0)
1644 ; RV64IZBS-NEXT: ret
1646 ; RV64IXTHEADBB-LABEL: imm_store_i32_neg1:
1647 ; RV64IXTHEADBB: # %bb.0:
1648 ; RV64IXTHEADBB-NEXT: li a1, -1
1649 ; RV64IXTHEADBB-NEXT: sw a1, 0(a0)
1650 ; RV64IXTHEADBB-NEXT: ret
1652 ; RV32-REMAT-LABEL: imm_store_i32_neg1:
1653 ; RV32-REMAT: # %bb.0:
1654 ; RV32-REMAT-NEXT: li a1, -1
1655 ; RV32-REMAT-NEXT: sw a1, 0(a0)
1656 ; RV32-REMAT-NEXT: ret
1658 ; RV64-REMAT-LABEL: imm_store_i32_neg1:
1659 ; RV64-REMAT: # %bb.0:
1660 ; RV64-REMAT-NEXT: li a1, -1
1661 ; RV64-REMAT-NEXT: sw a1, 0(a0)
1662 ; RV64-REMAT-NEXT: ret
1663 store i32 -1, ptr %p
1667 define i64 @imm_5372288229() {
1668 ; RV32I-LABEL: imm_5372288229:
1670 ; RV32I-NEXT: lui a0, 263018
1671 ; RV32I-NEXT: addi a0, a0, -795
1672 ; RV32I-NEXT: li a1, 1
1675 ; RV64I-LABEL: imm_5372288229:
1677 ; RV64I-NEXT: lui a0, 160
1678 ; RV64I-NEXT: addiw a0, a0, 437
1679 ; RV64I-NEXT: slli a0, a0, 13
1680 ; RV64I-NEXT: addi a0, a0, -795
1683 ; RV64IZBA-LABEL: imm_5372288229:
1684 ; RV64IZBA: # %bb.0:
1685 ; RV64IZBA-NEXT: lui a0, 655797
1686 ; RV64IZBA-NEXT: slli.uw a0, a0, 1
1687 ; RV64IZBA-NEXT: addi a0, a0, -795
1688 ; RV64IZBA-NEXT: ret
1690 ; RV64IZBB-LABEL: imm_5372288229:
1691 ; RV64IZBB: # %bb.0:
1692 ; RV64IZBB-NEXT: lui a0, 160
1693 ; RV64IZBB-NEXT: addiw a0, a0, 437
1694 ; RV64IZBB-NEXT: slli a0, a0, 13
1695 ; RV64IZBB-NEXT: addi a0, a0, -795
1696 ; RV64IZBB-NEXT: ret
1698 ; RV64IZBS-LABEL: imm_5372288229:
1699 ; RV64IZBS: # %bb.0:
1700 ; RV64IZBS-NEXT: lui a0, 263018
1701 ; RV64IZBS-NEXT: addiw a0, a0, -795
1702 ; RV64IZBS-NEXT: bseti a0, a0, 32
1703 ; RV64IZBS-NEXT: ret
1705 ; RV64IXTHEADBB-LABEL: imm_5372288229:
1706 ; RV64IXTHEADBB: # %bb.0:
1707 ; RV64IXTHEADBB-NEXT: lui a0, 160
1708 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 437
1709 ; RV64IXTHEADBB-NEXT: slli a0, a0, 13
1710 ; RV64IXTHEADBB-NEXT: addi a0, a0, -795
1711 ; RV64IXTHEADBB-NEXT: ret
1713 ; RV32-REMAT-LABEL: imm_5372288229:
1714 ; RV32-REMAT: # %bb.0:
1715 ; RV32-REMAT-NEXT: lui a0, 263018
1716 ; RV32-REMAT-NEXT: addi a0, a0, -795
1717 ; RV32-REMAT-NEXT: li a1, 1
1718 ; RV32-REMAT-NEXT: ret
1720 ; RV64-REMAT-LABEL: imm_5372288229:
1721 ; RV64-REMAT: # %bb.0:
1722 ; RV64-REMAT-NEXT: lui a0, 160
1723 ; RV64-REMAT-NEXT: addiw a0, a0, 437
1724 ; RV64-REMAT-NEXT: slli a0, a0, 13
1725 ; RV64-REMAT-NEXT: addi a0, a0, -795
1726 ; RV64-REMAT-NEXT: ret
1730 define i64 @imm_neg_5372288229() {
1731 ; RV32I-LABEL: imm_neg_5372288229:
1733 ; RV32I-NEXT: lui a0, 785558
1734 ; RV32I-NEXT: addi a0, a0, 795
1735 ; RV32I-NEXT: li a1, -2
1738 ; RV64I-LABEL: imm_neg_5372288229:
1740 ; RV64I-NEXT: lui a0, 1048416
1741 ; RV64I-NEXT: addiw a0, a0, -437
1742 ; RV64I-NEXT: slli a0, a0, 13
1743 ; RV64I-NEXT: addi a0, a0, 795
1746 ; RV64IZBA-LABEL: imm_neg_5372288229:
1747 ; RV64IZBA: # %bb.0:
1748 ; RV64IZBA-NEXT: lui a0, 611378
1749 ; RV64IZBA-NEXT: addiw a0, a0, 265
1750 ; RV64IZBA-NEXT: sh1add a0, a0, a0
1751 ; RV64IZBA-NEXT: ret
1753 ; RV64IZBB-LABEL: imm_neg_5372288229:
1754 ; RV64IZBB: # %bb.0:
1755 ; RV64IZBB-NEXT: lui a0, 1048416
1756 ; RV64IZBB-NEXT: addiw a0, a0, -437
1757 ; RV64IZBB-NEXT: slli a0, a0, 13
1758 ; RV64IZBB-NEXT: addi a0, a0, 795
1759 ; RV64IZBB-NEXT: ret
1761 ; RV64IZBS-LABEL: imm_neg_5372288229:
1762 ; RV64IZBS: # %bb.0:
1763 ; RV64IZBS-NEXT: lui a0, 785558
1764 ; RV64IZBS-NEXT: addiw a0, a0, 795
1765 ; RV64IZBS-NEXT: bclri a0, a0, 32
1766 ; RV64IZBS-NEXT: ret
1768 ; RV64IXTHEADBB-LABEL: imm_neg_5372288229:
1769 ; RV64IXTHEADBB: # %bb.0:
1770 ; RV64IXTHEADBB-NEXT: lui a0, 1048416
1771 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -437
1772 ; RV64IXTHEADBB-NEXT: slli a0, a0, 13
1773 ; RV64IXTHEADBB-NEXT: addi a0, a0, 795
1774 ; RV64IXTHEADBB-NEXT: ret
1776 ; RV32-REMAT-LABEL: imm_neg_5372288229:
1777 ; RV32-REMAT: # %bb.0:
1778 ; RV32-REMAT-NEXT: lui a0, 785558
1779 ; RV32-REMAT-NEXT: addi a0, a0, 795
1780 ; RV32-REMAT-NEXT: li a1, -2
1781 ; RV32-REMAT-NEXT: ret
1783 ; RV64-REMAT-LABEL: imm_neg_5372288229:
1784 ; RV64-REMAT: # %bb.0:
1785 ; RV64-REMAT-NEXT: lui a0, 1048416
1786 ; RV64-REMAT-NEXT: addiw a0, a0, -437
1787 ; RV64-REMAT-NEXT: slli a0, a0, 13
1788 ; RV64-REMAT-NEXT: addi a0, a0, 795
1789 ; RV64-REMAT-NEXT: ret
1793 define i64 @imm_8953813715() {
1794 ; RV32I-LABEL: imm_8953813715:
1796 ; RV32I-NEXT: lui a0, 88838
1797 ; RV32I-NEXT: addi a0, a0, -1325
1798 ; RV32I-NEXT: li a1, 2
1801 ; RV64I-LABEL: imm_8953813715:
1803 ; RV64I-NEXT: lui a0, 267
1804 ; RV64I-NEXT: addiw a0, a0, -637
1805 ; RV64I-NEXT: slli a0, a0, 13
1806 ; RV64I-NEXT: addi a0, a0, -1325
1809 ; RV64IZBA-LABEL: imm_8953813715:
1810 ; RV64IZBA: # %bb.0:
1811 ; RV64IZBA-NEXT: lui a0, 437198
1812 ; RV64IZBA-NEXT: addiw a0, a0, -265
1813 ; RV64IZBA-NEXT: sh2add a0, a0, a0
1814 ; RV64IZBA-NEXT: ret
1816 ; RV64IZBB-LABEL: imm_8953813715:
1817 ; RV64IZBB: # %bb.0:
1818 ; RV64IZBB-NEXT: lui a0, 267
1819 ; RV64IZBB-NEXT: addiw a0, a0, -637
1820 ; RV64IZBB-NEXT: slli a0, a0, 13
1821 ; RV64IZBB-NEXT: addi a0, a0, -1325
1822 ; RV64IZBB-NEXT: ret
1824 ; RV64IZBS-LABEL: imm_8953813715:
1825 ; RV64IZBS: # %bb.0:
1826 ; RV64IZBS-NEXT: lui a0, 88838
1827 ; RV64IZBS-NEXT: addiw a0, a0, -1325
1828 ; RV64IZBS-NEXT: bseti a0, a0, 33
1829 ; RV64IZBS-NEXT: ret
1831 ; RV64IXTHEADBB-LABEL: imm_8953813715:
1832 ; RV64IXTHEADBB: # %bb.0:
1833 ; RV64IXTHEADBB-NEXT: lui a0, 267
1834 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -637
1835 ; RV64IXTHEADBB-NEXT: slli a0, a0, 13
1836 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1325
1837 ; RV64IXTHEADBB-NEXT: ret
1839 ; RV32-REMAT-LABEL: imm_8953813715:
1840 ; RV32-REMAT: # %bb.0:
1841 ; RV32-REMAT-NEXT: lui a0, 88838
1842 ; RV32-REMAT-NEXT: addi a0, a0, -1325
1843 ; RV32-REMAT-NEXT: li a1, 2
1844 ; RV32-REMAT-NEXT: ret
1846 ; RV64-REMAT-LABEL: imm_8953813715:
1847 ; RV64-REMAT: # %bb.0:
1848 ; RV64-REMAT-NEXT: lui a0, 267
1849 ; RV64-REMAT-NEXT: addiw a0, a0, -637
1850 ; RV64-REMAT-NEXT: slli a0, a0, 13
1851 ; RV64-REMAT-NEXT: addi a0, a0, -1325
1852 ; RV64-REMAT-NEXT: ret
1856 define i64 @imm_neg_8953813715() {
1857 ; RV32I-LABEL: imm_neg_8953813715:
1859 ; RV32I-NEXT: lui a0, 959738
1860 ; RV32I-NEXT: addi a0, a0, 1325
1861 ; RV32I-NEXT: li a1, -3
1864 ; RV64I-LABEL: imm_neg_8953813715:
1866 ; RV64I-NEXT: lui a0, 1048309
1867 ; RV64I-NEXT: addiw a0, a0, 637
1868 ; RV64I-NEXT: slli a0, a0, 13
1869 ; RV64I-NEXT: addi a0, a0, 1325
1872 ; RV64IZBA-LABEL: imm_neg_8953813715:
1873 ; RV64IZBA: # %bb.0:
1874 ; RV64IZBA-NEXT: lui a0, 611378
1875 ; RV64IZBA-NEXT: addiw a0, a0, 265
1876 ; RV64IZBA-NEXT: sh2add a0, a0, a0
1877 ; RV64IZBA-NEXT: ret
1879 ; RV64IZBB-LABEL: imm_neg_8953813715:
1880 ; RV64IZBB: # %bb.0:
1881 ; RV64IZBB-NEXT: lui a0, 1048309
1882 ; RV64IZBB-NEXT: addiw a0, a0, 637
1883 ; RV64IZBB-NEXT: slli a0, a0, 13
1884 ; RV64IZBB-NEXT: addi a0, a0, 1325
1885 ; RV64IZBB-NEXT: ret
1887 ; RV64IZBS-LABEL: imm_neg_8953813715:
1888 ; RV64IZBS: # %bb.0:
1889 ; RV64IZBS-NEXT: lui a0, 959738
1890 ; RV64IZBS-NEXT: addiw a0, a0, 1325
1891 ; RV64IZBS-NEXT: bclri a0, a0, 33
1892 ; RV64IZBS-NEXT: ret
1894 ; RV64IXTHEADBB-LABEL: imm_neg_8953813715:
1895 ; RV64IXTHEADBB: # %bb.0:
1896 ; RV64IXTHEADBB-NEXT: lui a0, 1048309
1897 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 637
1898 ; RV64IXTHEADBB-NEXT: slli a0, a0, 13
1899 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1325
1900 ; RV64IXTHEADBB-NEXT: ret
1902 ; RV32-REMAT-LABEL: imm_neg_8953813715:
1903 ; RV32-REMAT: # %bb.0:
1904 ; RV32-REMAT-NEXT: lui a0, 959738
1905 ; RV32-REMAT-NEXT: addi a0, a0, 1325
1906 ; RV32-REMAT-NEXT: li a1, -3
1907 ; RV32-REMAT-NEXT: ret
1909 ; RV64-REMAT-LABEL: imm_neg_8953813715:
1910 ; RV64-REMAT: # %bb.0:
1911 ; RV64-REMAT-NEXT: lui a0, 1048309
1912 ; RV64-REMAT-NEXT: addiw a0, a0, 637
1913 ; RV64-REMAT-NEXT: slli a0, a0, 13
1914 ; RV64-REMAT-NEXT: addi a0, a0, 1325
1915 ; RV64-REMAT-NEXT: ret
1919 define i64 @imm_16116864687() {
1920 ; RV32I-LABEL: imm_16116864687:
1922 ; RV32I-NEXT: lui a0, 789053
1923 ; RV32I-NEXT: addi a0, a0, 1711
1924 ; RV32I-NEXT: li a1, 3
1927 ; RV64I-LABEL: imm_16116864687:
1929 ; RV64I-NEXT: lui a0, 961
1930 ; RV64I-NEXT: addiw a0, a0, -1475
1931 ; RV64I-NEXT: slli a0, a0, 12
1932 ; RV64I-NEXT: addi a0, a0, 1711
1935 ; RV64IZBA-LABEL: imm_16116864687:
1936 ; RV64IZBA: # %bb.0:
1937 ; RV64IZBA-NEXT: lui a0, 437198
1938 ; RV64IZBA-NEXT: addiw a0, a0, -265
1939 ; RV64IZBA-NEXT: sh3add a0, a0, a0
1940 ; RV64IZBA-NEXT: ret
1942 ; RV64IZBB-LABEL: imm_16116864687:
1943 ; RV64IZBB: # %bb.0:
1944 ; RV64IZBB-NEXT: lui a0, 961
1945 ; RV64IZBB-NEXT: addiw a0, a0, -1475
1946 ; RV64IZBB-NEXT: slli a0, a0, 12
1947 ; RV64IZBB-NEXT: addi a0, a0, 1711
1948 ; RV64IZBB-NEXT: ret
1950 ; RV64IZBS-LABEL: imm_16116864687:
1951 ; RV64IZBS: # %bb.0:
1952 ; RV64IZBS-NEXT: lui a0, 961
1953 ; RV64IZBS-NEXT: addiw a0, a0, -1475
1954 ; RV64IZBS-NEXT: slli a0, a0, 12
1955 ; RV64IZBS-NEXT: addi a0, a0, 1711
1956 ; RV64IZBS-NEXT: ret
1958 ; RV64IXTHEADBB-LABEL: imm_16116864687:
1959 ; RV64IXTHEADBB: # %bb.0:
1960 ; RV64IXTHEADBB-NEXT: lui a0, 961
1961 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1475
1962 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
1963 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1711
1964 ; RV64IXTHEADBB-NEXT: ret
1966 ; RV32-REMAT-LABEL: imm_16116864687:
1967 ; RV32-REMAT: # %bb.0:
1968 ; RV32-REMAT-NEXT: lui a0, 789053
1969 ; RV32-REMAT-NEXT: addi a0, a0, 1711
1970 ; RV32-REMAT-NEXT: li a1, 3
1971 ; RV32-REMAT-NEXT: ret
1973 ; RV64-REMAT-LABEL: imm_16116864687:
1974 ; RV64-REMAT: # %bb.0:
1975 ; RV64-REMAT-NEXT: lui a0, 961
1976 ; RV64-REMAT-NEXT: addiw a0, a0, -1475
1977 ; RV64-REMAT-NEXT: slli a0, a0, 12
1978 ; RV64-REMAT-NEXT: addi a0, a0, 1711
1979 ; RV64-REMAT-NEXT: ret
1983 define i64 @imm_neg_16116864687() {
1984 ; RV32I-LABEL: imm_neg_16116864687:
1986 ; RV32I-NEXT: lui a0, 259523
1987 ; RV32I-NEXT: addi a0, a0, -1711
1988 ; RV32I-NEXT: li a1, -4
1991 ; RV64I-LABEL: imm_neg_16116864687:
1993 ; RV64I-NEXT: lui a0, 1047615
1994 ; RV64I-NEXT: addiw a0, a0, 1475
1995 ; RV64I-NEXT: slli a0, a0, 12
1996 ; RV64I-NEXT: addi a0, a0, -1711
1999 ; RV64IZBA-LABEL: imm_neg_16116864687:
2000 ; RV64IZBA: # %bb.0:
2001 ; RV64IZBA-NEXT: lui a0, 611378
2002 ; RV64IZBA-NEXT: addiw a0, a0, 265
2003 ; RV64IZBA-NEXT: sh3add a0, a0, a0
2004 ; RV64IZBA-NEXT: ret
2006 ; RV64IZBB-LABEL: imm_neg_16116864687:
2007 ; RV64IZBB: # %bb.0:
2008 ; RV64IZBB-NEXT: lui a0, 1047615
2009 ; RV64IZBB-NEXT: addiw a0, a0, 1475
2010 ; RV64IZBB-NEXT: slli a0, a0, 12
2011 ; RV64IZBB-NEXT: addi a0, a0, -1711
2012 ; RV64IZBB-NEXT: ret
2014 ; RV64IZBS-LABEL: imm_neg_16116864687:
2015 ; RV64IZBS: # %bb.0:
2016 ; RV64IZBS-NEXT: lui a0, 1047615
2017 ; RV64IZBS-NEXT: addiw a0, a0, 1475
2018 ; RV64IZBS-NEXT: slli a0, a0, 12
2019 ; RV64IZBS-NEXT: addi a0, a0, -1711
2020 ; RV64IZBS-NEXT: ret
2022 ; RV64IXTHEADBB-LABEL: imm_neg_16116864687:
2023 ; RV64IXTHEADBB: # %bb.0:
2024 ; RV64IXTHEADBB-NEXT: lui a0, 1047615
2025 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 1475
2026 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
2027 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1711
2028 ; RV64IXTHEADBB-NEXT: ret
2030 ; RV32-REMAT-LABEL: imm_neg_16116864687:
2031 ; RV32-REMAT: # %bb.0:
2032 ; RV32-REMAT-NEXT: lui a0, 259523
2033 ; RV32-REMAT-NEXT: addi a0, a0, -1711
2034 ; RV32-REMAT-NEXT: li a1, -4
2035 ; RV32-REMAT-NEXT: ret
2037 ; RV64-REMAT-LABEL: imm_neg_16116864687:
2038 ; RV64-REMAT: # %bb.0:
2039 ; RV64-REMAT-NEXT: lui a0, 1047615
2040 ; RV64-REMAT-NEXT: addiw a0, a0, 1475
2041 ; RV64-REMAT-NEXT: slli a0, a0, 12
2042 ; RV64-REMAT-NEXT: addi a0, a0, -1711
2043 ; RV64-REMAT-NEXT: ret
2044 ret i64 -16116864687
2047 define i64 @imm_2344336315() {
2048 ; RV32I-LABEL: imm_2344336315:
2050 ; RV32I-NEXT: lui a0, 572348
2051 ; RV32I-NEXT: addi a0, a0, -1093
2052 ; RV32I-NEXT: li a1, 0
2055 ; RV64I-LABEL: imm_2344336315:
2057 ; RV64I-NEXT: lui a0, 143087
2058 ; RV64I-NEXT: slli a0, a0, 2
2059 ; RV64I-NEXT: addi a0, a0, -1093
2062 ; RV64IZBA-LABEL: imm_2344336315:
2063 ; RV64IZBA: # %bb.0:
2064 ; RV64IZBA-NEXT: lui a0, 143087
2065 ; RV64IZBA-NEXT: slli a0, a0, 2
2066 ; RV64IZBA-NEXT: addi a0, a0, -1093
2067 ; RV64IZBA-NEXT: ret
2069 ; RV64IZBB-LABEL: imm_2344336315:
2070 ; RV64IZBB: # %bb.0:
2071 ; RV64IZBB-NEXT: lui a0, 143087
2072 ; RV64IZBB-NEXT: slli a0, a0, 2
2073 ; RV64IZBB-NEXT: addi a0, a0, -1093
2074 ; RV64IZBB-NEXT: ret
2076 ; RV64IZBS-LABEL: imm_2344336315:
2077 ; RV64IZBS: # %bb.0:
2078 ; RV64IZBS-NEXT: lui a0, 143087
2079 ; RV64IZBS-NEXT: slli a0, a0, 2
2080 ; RV64IZBS-NEXT: addi a0, a0, -1093
2081 ; RV64IZBS-NEXT: ret
2083 ; RV64IXTHEADBB-LABEL: imm_2344336315:
2084 ; RV64IXTHEADBB: # %bb.0:
2085 ; RV64IXTHEADBB-NEXT: lui a0, 143087
2086 ; RV64IXTHEADBB-NEXT: slli a0, a0, 2
2087 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
2088 ; RV64IXTHEADBB-NEXT: ret
2090 ; RV32-REMAT-LABEL: imm_2344336315:
2091 ; RV32-REMAT: # %bb.0:
2092 ; RV32-REMAT-NEXT: lui a0, 572348
2093 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2094 ; RV32-REMAT-NEXT: li a1, 0
2095 ; RV32-REMAT-NEXT: ret
2097 ; RV64-REMAT-LABEL: imm_2344336315:
2098 ; RV64-REMAT: # %bb.0:
2099 ; RV64-REMAT-NEXT: lui a0, 143087
2100 ; RV64-REMAT-NEXT: slli a0, a0, 2
2101 ; RV64-REMAT-NEXT: addi a0, a0, -1093
2102 ; RV64-REMAT-NEXT: ret
2103 ret i64 2344336315 ; 0x8bbbbbbb
2106 define i64 @imm_70370820078523() {
2107 ; RV32I-LABEL: imm_70370820078523:
2109 ; RV32I-NEXT: lui a0, 506812
2110 ; RV32I-NEXT: addi a0, a0, -1093
2111 ; RV32I-NEXT: lui a1, 4
2114 ; RV64-NOPOOL-LABEL: imm_70370820078523:
2115 ; RV64-NOPOOL: # %bb.0:
2116 ; RV64-NOPOOL-NEXT: lui a0, 256
2117 ; RV64-NOPOOL-NEXT: addiw a0, a0, 31
2118 ; RV64-NOPOOL-NEXT: slli a0, a0, 12
2119 ; RV64-NOPOOL-NEXT: addi a0, a0, -273
2120 ; RV64-NOPOOL-NEXT: slli a0, a0, 14
2121 ; RV64-NOPOOL-NEXT: addi a0, a0, -1093
2122 ; RV64-NOPOOL-NEXT: ret
2124 ; RV64I-POOL-LABEL: imm_70370820078523:
2125 ; RV64I-POOL: # %bb.0:
2126 ; RV64I-POOL-NEXT: lui a0, %hi(.LCPI37_0)
2127 ; RV64I-POOL-NEXT: ld a0, %lo(.LCPI37_0)(a0)
2128 ; RV64I-POOL-NEXT: ret
2130 ; RV64IZBA-LABEL: imm_70370820078523:
2131 ; RV64IZBA: # %bb.0:
2132 ; RV64IZBA-NEXT: lui a0, 256
2133 ; RV64IZBA-NEXT: addiw a0, a0, 31
2134 ; RV64IZBA-NEXT: slli a0, a0, 12
2135 ; RV64IZBA-NEXT: addi a0, a0, -273
2136 ; RV64IZBA-NEXT: slli a0, a0, 14
2137 ; RV64IZBA-NEXT: addi a0, a0, -1093
2138 ; RV64IZBA-NEXT: ret
2140 ; RV64IZBB-LABEL: imm_70370820078523:
2141 ; RV64IZBB: # %bb.0:
2142 ; RV64IZBB-NEXT: lui a0, 256
2143 ; RV64IZBB-NEXT: addiw a0, a0, 31
2144 ; RV64IZBB-NEXT: slli a0, a0, 12
2145 ; RV64IZBB-NEXT: addi a0, a0, -273
2146 ; RV64IZBB-NEXT: slli a0, a0, 14
2147 ; RV64IZBB-NEXT: addi a0, a0, -1093
2148 ; RV64IZBB-NEXT: ret
2150 ; RV64IZBS-LABEL: imm_70370820078523:
2151 ; RV64IZBS: # %bb.0:
2152 ; RV64IZBS-NEXT: lui a0, 506812
2153 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2154 ; RV64IZBS-NEXT: bseti a0, a0, 46
2155 ; RV64IZBS-NEXT: ret
2157 ; RV64IXTHEADBB-LABEL: imm_70370820078523:
2158 ; RV64IXTHEADBB: # %bb.0:
2159 ; RV64IXTHEADBB-NEXT: lui a0, 256
2160 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 31
2161 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
2162 ; RV64IXTHEADBB-NEXT: addi a0, a0, -273
2163 ; RV64IXTHEADBB-NEXT: slli a0, a0, 14
2164 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
2165 ; RV64IXTHEADBB-NEXT: ret
2167 ; RV32-REMAT-LABEL: imm_70370820078523:
2168 ; RV32-REMAT: # %bb.0:
2169 ; RV32-REMAT-NEXT: lui a0, 506812
2170 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2171 ; RV32-REMAT-NEXT: lui a1, 4
2172 ; RV32-REMAT-NEXT: ret
2174 ; RV64-REMAT-LABEL: imm_70370820078523:
2175 ; RV64-REMAT: # %bb.0:
2176 ; RV64-REMAT-NEXT: lui a0, 256
2177 ; RV64-REMAT-NEXT: addiw a0, a0, 31
2178 ; RV64-REMAT-NEXT: slli a0, a0, 12
2179 ; RV64-REMAT-NEXT: addi a0, a0, -273
2180 ; RV64-REMAT-NEXT: slli a0, a0, 14
2181 ; RV64-REMAT-NEXT: addi a0, a0, -1093
2182 ; RV64-REMAT-NEXT: ret
2183 ret i64 70370820078523 ; 0x40007bbbbbbb
2186 define i64 @imm_neg_9223372034778874949() {
2187 ; RV32I-LABEL: imm_neg_9223372034778874949:
2189 ; RV32I-NEXT: lui a0, 506812
2190 ; RV32I-NEXT: addi a0, a0, -1093
2191 ; RV32I-NEXT: lui a1, 524288
2194 ; RV64I-LABEL: imm_neg_9223372034778874949:
2196 ; RV64I-NEXT: lui a0, 506812
2197 ; RV64I-NEXT: addiw a0, a0, -1093
2198 ; RV64I-NEXT: slli a1, a0, 63
2199 ; RV64I-NEXT: add a0, a0, a1
2202 ; RV64IZBA-LABEL: imm_neg_9223372034778874949:
2203 ; RV64IZBA: # %bb.0:
2204 ; RV64IZBA-NEXT: lui a0, 506812
2205 ; RV64IZBA-NEXT: addiw a0, a0, -1093
2206 ; RV64IZBA-NEXT: slli a1, a0, 63
2207 ; RV64IZBA-NEXT: add a0, a0, a1
2208 ; RV64IZBA-NEXT: ret
2210 ; RV64IZBB-LABEL: imm_neg_9223372034778874949:
2211 ; RV64IZBB: # %bb.0:
2212 ; RV64IZBB-NEXT: lui a0, 506812
2213 ; RV64IZBB-NEXT: addiw a0, a0, -1093
2214 ; RV64IZBB-NEXT: slli a1, a0, 63
2215 ; RV64IZBB-NEXT: add a0, a0, a1
2216 ; RV64IZBB-NEXT: ret
2218 ; RV64IZBS-LABEL: imm_neg_9223372034778874949:
2219 ; RV64IZBS: # %bb.0:
2220 ; RV64IZBS-NEXT: lui a0, 506812
2221 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2222 ; RV64IZBS-NEXT: bseti a0, a0, 63
2223 ; RV64IZBS-NEXT: ret
2225 ; RV64IXTHEADBB-LABEL: imm_neg_9223372034778874949:
2226 ; RV64IXTHEADBB: # %bb.0:
2227 ; RV64IXTHEADBB-NEXT: lui a0, 506812
2228 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1093
2229 ; RV64IXTHEADBB-NEXT: slli a1, a0, 63
2230 ; RV64IXTHEADBB-NEXT: add a0, a0, a1
2231 ; RV64IXTHEADBB-NEXT: ret
2233 ; RV32-REMAT-LABEL: imm_neg_9223372034778874949:
2234 ; RV32-REMAT: # %bb.0:
2235 ; RV32-REMAT-NEXT: lui a0, 506812
2236 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2237 ; RV32-REMAT-NEXT: lui a1, 524288
2238 ; RV32-REMAT-NEXT: ret
2240 ; RV64-REMAT-LABEL: imm_neg_9223372034778874949:
2241 ; RV64-REMAT: # %bb.0:
2242 ; RV64-REMAT-NEXT: lui a0, 506812
2243 ; RV64-REMAT-NEXT: addiw a0, a0, -1093
2244 ; RV64-REMAT-NEXT: slli a1, a0, 63
2245 ; RV64-REMAT-NEXT: add a0, a0, a1
2246 ; RV64-REMAT-NEXT: ret
2247 ret i64 -9223372034778874949 ; 0x800000007bbbbbbb
2250 define i64 @imm_neg_9223301666034697285() {
2251 ; RV32I-LABEL: imm_neg_9223301666034697285:
2253 ; RV32I-NEXT: lui a0, 506812
2254 ; RV32I-NEXT: addi a0, a0, -1093
2255 ; RV32I-NEXT: lui a1, 524292
2258 ; RV64-NOPOOL-LABEL: imm_neg_9223301666034697285:
2259 ; RV64-NOPOOL: # %bb.0:
2260 ; RV64-NOPOOL-NEXT: lui a0, 917505
2261 ; RV64-NOPOOL-NEXT: slli a0, a0, 8
2262 ; RV64-NOPOOL-NEXT: addi a0, a0, 31
2263 ; RV64-NOPOOL-NEXT: slli a0, a0, 12
2264 ; RV64-NOPOOL-NEXT: addi a0, a0, -273
2265 ; RV64-NOPOOL-NEXT: slli a0, a0, 14
2266 ; RV64-NOPOOL-NEXT: addi a0, a0, -1093
2267 ; RV64-NOPOOL-NEXT: ret
2269 ; RV64I-POOL-LABEL: imm_neg_9223301666034697285:
2270 ; RV64I-POOL: # %bb.0:
2271 ; RV64I-POOL-NEXT: lui a0, %hi(.LCPI39_0)
2272 ; RV64I-POOL-NEXT: ld a0, %lo(.LCPI39_0)(a0)
2273 ; RV64I-POOL-NEXT: ret
2275 ; RV64IZBA-LABEL: imm_neg_9223301666034697285:
2276 ; RV64IZBA: # %bb.0:
2277 ; RV64IZBA-NEXT: lui a0, 917505
2278 ; RV64IZBA-NEXT: slli a0, a0, 8
2279 ; RV64IZBA-NEXT: addi a0, a0, 31
2280 ; RV64IZBA-NEXT: slli a0, a0, 12
2281 ; RV64IZBA-NEXT: addi a0, a0, -273
2282 ; RV64IZBA-NEXT: slli a0, a0, 14
2283 ; RV64IZBA-NEXT: addi a0, a0, -1093
2284 ; RV64IZBA-NEXT: ret
2286 ; RV64IZBB-LABEL: imm_neg_9223301666034697285:
2287 ; RV64IZBB: # %bb.0:
2288 ; RV64IZBB-NEXT: lui a0, 917505
2289 ; RV64IZBB-NEXT: slli a0, a0, 8
2290 ; RV64IZBB-NEXT: addi a0, a0, 31
2291 ; RV64IZBB-NEXT: slli a0, a0, 12
2292 ; RV64IZBB-NEXT: addi a0, a0, -273
2293 ; RV64IZBB-NEXT: slli a0, a0, 14
2294 ; RV64IZBB-NEXT: addi a0, a0, -1093
2295 ; RV64IZBB-NEXT: ret
2297 ; RV64IZBS-LABEL: imm_neg_9223301666034697285:
2298 ; RV64IZBS: # %bb.0:
2299 ; RV64IZBS-NEXT: lui a0, 506812
2300 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2301 ; RV64IZBS-NEXT: bseti a0, a0, 46
2302 ; RV64IZBS-NEXT: bseti a0, a0, 63
2303 ; RV64IZBS-NEXT: ret
2305 ; RV64IXTHEADBB-LABEL: imm_neg_9223301666034697285:
2306 ; RV64IXTHEADBB: # %bb.0:
2307 ; RV64IXTHEADBB-NEXT: lui a0, 917505
2308 ; RV64IXTHEADBB-NEXT: slli a0, a0, 8
2309 ; RV64IXTHEADBB-NEXT: addi a0, a0, 31
2310 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
2311 ; RV64IXTHEADBB-NEXT: addi a0, a0, -273
2312 ; RV64IXTHEADBB-NEXT: slli a0, a0, 14
2313 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
2314 ; RV64IXTHEADBB-NEXT: ret
2316 ; RV32-REMAT-LABEL: imm_neg_9223301666034697285:
2317 ; RV32-REMAT: # %bb.0:
2318 ; RV32-REMAT-NEXT: lui a0, 506812
2319 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2320 ; RV32-REMAT-NEXT: lui a1, 524292
2321 ; RV32-REMAT-NEXT: ret
2323 ; RV64-REMAT-LABEL: imm_neg_9223301666034697285:
2324 ; RV64-REMAT: # %bb.0:
2325 ; RV64-REMAT-NEXT: lui a0, 917505
2326 ; RV64-REMAT-NEXT: slli a0, a0, 8
2327 ; RV64-REMAT-NEXT: addi a0, a0, 31
2328 ; RV64-REMAT-NEXT: slli a0, a0, 12
2329 ; RV64-REMAT-NEXT: addi a0, a0, -273
2330 ; RV64-REMAT-NEXT: slli a0, a0, 14
2331 ; RV64-REMAT-NEXT: addi a0, a0, -1093
2332 ; RV64-REMAT-NEXT: ret
2333 ret i64 -9223301666034697285 ; 0x800040007bbbbbbb
2336 define i64 @imm_neg_2219066437() {
2337 ; RV32I-LABEL: imm_neg_2219066437:
2339 ; RV32I-NEXT: lui a0, 506812
2340 ; RV32I-NEXT: addi a0, a0, -1093
2341 ; RV32I-NEXT: li a1, -1
2344 ; RV64I-LABEL: imm_neg_2219066437:
2346 ; RV64I-NEXT: lui a0, 913135
2347 ; RV64I-NEXT: slli a0, a0, 2
2348 ; RV64I-NEXT: addi a0, a0, -1093
2351 ; RV64IZBA-LABEL: imm_neg_2219066437:
2352 ; RV64IZBA: # %bb.0:
2353 ; RV64IZBA-NEXT: lui a0, 913135
2354 ; RV64IZBA-NEXT: slli a0, a0, 2
2355 ; RV64IZBA-NEXT: addi a0, a0, -1093
2356 ; RV64IZBA-NEXT: ret
2358 ; RV64IZBB-LABEL: imm_neg_2219066437:
2359 ; RV64IZBB: # %bb.0:
2360 ; RV64IZBB-NEXT: lui a0, 913135
2361 ; RV64IZBB-NEXT: slli a0, a0, 2
2362 ; RV64IZBB-NEXT: addi a0, a0, -1093
2363 ; RV64IZBB-NEXT: ret
2365 ; RV64IZBS-LABEL: imm_neg_2219066437:
2366 ; RV64IZBS: # %bb.0:
2367 ; RV64IZBS-NEXT: lui a0, 913135
2368 ; RV64IZBS-NEXT: slli a0, a0, 2
2369 ; RV64IZBS-NEXT: addi a0, a0, -1093
2370 ; RV64IZBS-NEXT: ret
2372 ; RV64IXTHEADBB-LABEL: imm_neg_2219066437:
2373 ; RV64IXTHEADBB: # %bb.0:
2374 ; RV64IXTHEADBB-NEXT: lui a0, 913135
2375 ; RV64IXTHEADBB-NEXT: slli a0, a0, 2
2376 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
2377 ; RV64IXTHEADBB-NEXT: ret
2379 ; RV32-REMAT-LABEL: imm_neg_2219066437:
2380 ; RV32-REMAT: # %bb.0:
2381 ; RV32-REMAT-NEXT: lui a0, 506812
2382 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2383 ; RV32-REMAT-NEXT: li a1, -1
2384 ; RV32-REMAT-NEXT: ret
2386 ; RV64-REMAT-LABEL: imm_neg_2219066437:
2387 ; RV64-REMAT: # %bb.0:
2388 ; RV64-REMAT-NEXT: lui a0, 913135
2389 ; RV64-REMAT-NEXT: slli a0, a0, 2
2390 ; RV64-REMAT-NEXT: addi a0, a0, -1093
2391 ; RV64-REMAT-NEXT: ret
2392 ret i64 -2219066437 ; 0xffffffff7bbbbbbb
2395 define i64 @imm_neg_8798043653189() {
2396 ; RV32I-LABEL: imm_neg_8798043653189:
2398 ; RV32I-NEXT: lui a0, 572348
2399 ; RV32I-NEXT: addi a0, a0, -1093
2400 ; RV32I-NEXT: lui a1, 1048575
2401 ; RV32I-NEXT: addi a1, a1, 2047
2404 ; RV64I-LABEL: imm_neg_8798043653189:
2406 ; RV64I-NEXT: lui a0, 917475
2407 ; RV64I-NEXT: addiw a0, a0, -273
2408 ; RV64I-NEXT: slli a0, a0, 14
2409 ; RV64I-NEXT: addi a0, a0, -1093
2412 ; RV64IZBA-LABEL: imm_neg_8798043653189:
2413 ; RV64IZBA: # %bb.0:
2414 ; RV64IZBA-NEXT: lui a0, 917475
2415 ; RV64IZBA-NEXT: addiw a0, a0, -273
2416 ; RV64IZBA-NEXT: slli a0, a0, 14
2417 ; RV64IZBA-NEXT: addi a0, a0, -1093
2418 ; RV64IZBA-NEXT: ret
2420 ; RV64IZBB-LABEL: imm_neg_8798043653189:
2421 ; RV64IZBB: # %bb.0:
2422 ; RV64IZBB-NEXT: lui a0, 917475
2423 ; RV64IZBB-NEXT: addiw a0, a0, -273
2424 ; RV64IZBB-NEXT: slli a0, a0, 14
2425 ; RV64IZBB-NEXT: addi a0, a0, -1093
2426 ; RV64IZBB-NEXT: ret
2428 ; RV64IZBS-LABEL: imm_neg_8798043653189:
2429 ; RV64IZBS: # %bb.0:
2430 ; RV64IZBS-NEXT: lui a0, 572348
2431 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2432 ; RV64IZBS-NEXT: bclri a0, a0, 43
2433 ; RV64IZBS-NEXT: ret
2435 ; RV64IXTHEADBB-LABEL: imm_neg_8798043653189:
2436 ; RV64IXTHEADBB: # %bb.0:
2437 ; RV64IXTHEADBB-NEXT: lui a0, 917475
2438 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -273
2439 ; RV64IXTHEADBB-NEXT: slli a0, a0, 14
2440 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
2441 ; RV64IXTHEADBB-NEXT: ret
2443 ; RV32-REMAT-LABEL: imm_neg_8798043653189:
2444 ; RV32-REMAT: # %bb.0:
2445 ; RV32-REMAT-NEXT: lui a0, 572348
2446 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2447 ; RV32-REMAT-NEXT: lui a1, 1048575
2448 ; RV32-REMAT-NEXT: addi a1, a1, 2047
2449 ; RV32-REMAT-NEXT: ret
2451 ; RV64-REMAT-LABEL: imm_neg_8798043653189:
2452 ; RV64-REMAT: # %bb.0:
2453 ; RV64-REMAT-NEXT: lui a0, 917475
2454 ; RV64-REMAT-NEXT: addiw a0, a0, -273
2455 ; RV64-REMAT-NEXT: slli a0, a0, 14
2456 ; RV64-REMAT-NEXT: addi a0, a0, -1093
2457 ; RV64-REMAT-NEXT: ret
2458 ret i64 -8798043653189 ; 0xfffff7ff8bbbbbbb
2461 define i64 @imm_9223372034904144827() {
2462 ; RV32I-LABEL: imm_9223372034904144827:
2464 ; RV32I-NEXT: lui a0, 572348
2465 ; RV32I-NEXT: addi a0, a0, -1093
2466 ; RV32I-NEXT: lui a1, 524288
2467 ; RV32I-NEXT: addi a1, a1, -1
2470 ; RV64I-LABEL: imm_9223372034904144827:
2472 ; RV64I-NEXT: lui a0, 572348
2473 ; RV64I-NEXT: addiw a0, a0, -1093
2474 ; RV64I-NEXT: slli a1, a0, 63
2475 ; RV64I-NEXT: add a0, a0, a1
2478 ; RV64IZBA-LABEL: imm_9223372034904144827:
2479 ; RV64IZBA: # %bb.0:
2480 ; RV64IZBA-NEXT: lui a0, 572348
2481 ; RV64IZBA-NEXT: addiw a0, a0, -1093
2482 ; RV64IZBA-NEXT: slli a1, a0, 63
2483 ; RV64IZBA-NEXT: add a0, a0, a1
2484 ; RV64IZBA-NEXT: ret
2486 ; RV64IZBB-LABEL: imm_9223372034904144827:
2487 ; RV64IZBB: # %bb.0:
2488 ; RV64IZBB-NEXT: lui a0, 572348
2489 ; RV64IZBB-NEXT: addiw a0, a0, -1093
2490 ; RV64IZBB-NEXT: slli a1, a0, 63
2491 ; RV64IZBB-NEXT: add a0, a0, a1
2492 ; RV64IZBB-NEXT: ret
2494 ; RV64IZBS-LABEL: imm_9223372034904144827:
2495 ; RV64IZBS: # %bb.0:
2496 ; RV64IZBS-NEXT: lui a0, 572348
2497 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2498 ; RV64IZBS-NEXT: bclri a0, a0, 63
2499 ; RV64IZBS-NEXT: ret
2501 ; RV64IXTHEADBB-LABEL: imm_9223372034904144827:
2502 ; RV64IXTHEADBB: # %bb.0:
2503 ; RV64IXTHEADBB-NEXT: lui a0, 572348
2504 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1093
2505 ; RV64IXTHEADBB-NEXT: slli a1, a0, 63
2506 ; RV64IXTHEADBB-NEXT: add a0, a0, a1
2507 ; RV64IXTHEADBB-NEXT: ret
2509 ; RV32-REMAT-LABEL: imm_9223372034904144827:
2510 ; RV32-REMAT: # %bb.0:
2511 ; RV32-REMAT-NEXT: lui a0, 572348
2512 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2513 ; RV32-REMAT-NEXT: lui a1, 524288
2514 ; RV32-REMAT-NEXT: addi a1, a1, -1
2515 ; RV32-REMAT-NEXT: ret
2517 ; RV64-REMAT-LABEL: imm_9223372034904144827:
2518 ; RV64-REMAT: # %bb.0:
2519 ; RV64-REMAT-NEXT: lui a0, 572348
2520 ; RV64-REMAT-NEXT: addiw a0, a0, -1093
2521 ; RV64-REMAT-NEXT: slli a1, a0, 63
2522 ; RV64-REMAT-NEXT: add a0, a0, a1
2523 ; RV64-REMAT-NEXT: ret
2524 ret i64 9223372034904144827 ; 0x7fffffff8bbbbbbb
2527 define i64 @imm_neg_9223354442718100411() {
2528 ; RV32I-LABEL: imm_neg_9223354442718100411:
2530 ; RV32I-NEXT: lui a0, 572348
2531 ; RV32I-NEXT: addi a0, a0, -1093
2532 ; RV32I-NEXT: lui a1, 524287
2533 ; RV32I-NEXT: addi a1, a1, -1
2536 ; RV64-NOPOOL-LABEL: imm_neg_9223354442718100411:
2537 ; RV64-NOPOOL: # %bb.0:
2538 ; RV64-NOPOOL-NEXT: lui a0, 524287
2539 ; RV64-NOPOOL-NEXT: slli a0, a0, 6
2540 ; RV64-NOPOOL-NEXT: addi a0, a0, -29
2541 ; RV64-NOPOOL-NEXT: slli a0, a0, 12
2542 ; RV64-NOPOOL-NEXT: addi a0, a0, -273
2543 ; RV64-NOPOOL-NEXT: slli a0, a0, 14
2544 ; RV64-NOPOOL-NEXT: addi a0, a0, -1093
2545 ; RV64-NOPOOL-NEXT: ret
2547 ; RV64I-POOL-LABEL: imm_neg_9223354442718100411:
2548 ; RV64I-POOL: # %bb.0:
2549 ; RV64I-POOL-NEXT: lui a0, %hi(.LCPI43_0)
2550 ; RV64I-POOL-NEXT: ld a0, %lo(.LCPI43_0)(a0)
2551 ; RV64I-POOL-NEXT: ret
2553 ; RV64IZBA-LABEL: imm_neg_9223354442718100411:
2554 ; RV64IZBA: # %bb.0:
2555 ; RV64IZBA-NEXT: lui a0, 524287
2556 ; RV64IZBA-NEXT: slli a0, a0, 6
2557 ; RV64IZBA-NEXT: addi a0, a0, -29
2558 ; RV64IZBA-NEXT: slli a0, a0, 12
2559 ; RV64IZBA-NEXT: addi a0, a0, -273
2560 ; RV64IZBA-NEXT: slli a0, a0, 14
2561 ; RV64IZBA-NEXT: addi a0, a0, -1093
2562 ; RV64IZBA-NEXT: ret
2564 ; RV64IZBB-LABEL: imm_neg_9223354442718100411:
2565 ; RV64IZBB: # %bb.0:
2566 ; RV64IZBB-NEXT: lui a0, 524287
2567 ; RV64IZBB-NEXT: slli a0, a0, 6
2568 ; RV64IZBB-NEXT: addi a0, a0, -29
2569 ; RV64IZBB-NEXT: slli a0, a0, 12
2570 ; RV64IZBB-NEXT: addi a0, a0, -273
2571 ; RV64IZBB-NEXT: slli a0, a0, 14
2572 ; RV64IZBB-NEXT: addi a0, a0, -1093
2573 ; RV64IZBB-NEXT: ret
2575 ; RV64IZBS-LABEL: imm_neg_9223354442718100411:
2576 ; RV64IZBS: # %bb.0:
2577 ; RV64IZBS-NEXT: lui a0, 572348
2578 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2579 ; RV64IZBS-NEXT: bclri a0, a0, 44
2580 ; RV64IZBS-NEXT: bclri a0, a0, 63
2581 ; RV64IZBS-NEXT: ret
2583 ; RV64IXTHEADBB-LABEL: imm_neg_9223354442718100411:
2584 ; RV64IXTHEADBB: # %bb.0:
2585 ; RV64IXTHEADBB-NEXT: lui a0, 524287
2586 ; RV64IXTHEADBB-NEXT: slli a0, a0, 6
2587 ; RV64IXTHEADBB-NEXT: addi a0, a0, -29
2588 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
2589 ; RV64IXTHEADBB-NEXT: addi a0, a0, -273
2590 ; RV64IXTHEADBB-NEXT: slli a0, a0, 14
2591 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
2592 ; RV64IXTHEADBB-NEXT: ret
2594 ; RV32-REMAT-LABEL: imm_neg_9223354442718100411:
2595 ; RV32-REMAT: # %bb.0:
2596 ; RV32-REMAT-NEXT: lui a0, 572348
2597 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2598 ; RV32-REMAT-NEXT: lui a1, 524287
2599 ; RV32-REMAT-NEXT: addi a1, a1, -1
2600 ; RV32-REMAT-NEXT: ret
2602 ; RV64-REMAT-LABEL: imm_neg_9223354442718100411:
2603 ; RV64-REMAT: # %bb.0:
2604 ; RV64-REMAT-NEXT: lui a0, 524287
2605 ; RV64-REMAT-NEXT: slli a0, a0, 6
2606 ; RV64-REMAT-NEXT: addi a0, a0, -29
2607 ; RV64-REMAT-NEXT: slli a0, a0, 12
2608 ; RV64-REMAT-NEXT: addi a0, a0, -273
2609 ; RV64-REMAT-NEXT: slli a0, a0, 14
2610 ; RV64-REMAT-NEXT: addi a0, a0, -1093
2611 ; RV64-REMAT-NEXT: ret
2612 ret i64 9223354442718100411 ; 0x7fffefff8bbbbbbb
2615 define i64 @imm_2863311530() {
2616 ; RV32I-LABEL: imm_2863311530:
2618 ; RV32I-NEXT: lui a0, 699051
2619 ; RV32I-NEXT: addi a0, a0, -1366
2620 ; RV32I-NEXT: li a1, 0
2623 ; RV64I-LABEL: imm_2863311530:
2625 ; RV64I-NEXT: lui a0, 349525
2626 ; RV64I-NEXT: addiw a0, a0, 1365
2627 ; RV64I-NEXT: slli a0, a0, 1
2630 ; RV64IZBA-LABEL: imm_2863311530:
2631 ; RV64IZBA: # %bb.0:
2632 ; RV64IZBA-NEXT: lui a0, 349525
2633 ; RV64IZBA-NEXT: addiw a0, a0, 1365
2634 ; RV64IZBA-NEXT: slli a0, a0, 1
2635 ; RV64IZBA-NEXT: ret
2637 ; RV64IZBB-LABEL: imm_2863311530:
2638 ; RV64IZBB: # %bb.0:
2639 ; RV64IZBB-NEXT: lui a0, 349525
2640 ; RV64IZBB-NEXT: addiw a0, a0, 1365
2641 ; RV64IZBB-NEXT: slli a0, a0, 1
2642 ; RV64IZBB-NEXT: ret
2644 ; RV64IZBS-LABEL: imm_2863311530:
2645 ; RV64IZBS: # %bb.0:
2646 ; RV64IZBS-NEXT: lui a0, 349525
2647 ; RV64IZBS-NEXT: addiw a0, a0, 1365
2648 ; RV64IZBS-NEXT: slli a0, a0, 1
2649 ; RV64IZBS-NEXT: ret
2651 ; RV64IXTHEADBB-LABEL: imm_2863311530:
2652 ; RV64IXTHEADBB: # %bb.0:
2653 ; RV64IXTHEADBB-NEXT: lui a0, 349525
2654 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 1365
2655 ; RV64IXTHEADBB-NEXT: slli a0, a0, 1
2656 ; RV64IXTHEADBB-NEXT: ret
2658 ; RV32-REMAT-LABEL: imm_2863311530:
2659 ; RV32-REMAT: # %bb.0:
2660 ; RV32-REMAT-NEXT: lui a0, 699051
2661 ; RV32-REMAT-NEXT: addi a0, a0, -1366
2662 ; RV32-REMAT-NEXT: li a1, 0
2663 ; RV32-REMAT-NEXT: ret
2665 ; RV64-REMAT-LABEL: imm_2863311530:
2666 ; RV64-REMAT: # %bb.0:
2667 ; RV64-REMAT-NEXT: lui a0, 349525
2668 ; RV64-REMAT-NEXT: addiw a0, a0, 1365
2669 ; RV64-REMAT-NEXT: slli a0, a0, 1
2670 ; RV64-REMAT-NEXT: ret
2671 ret i64 2863311530 ; #0xaaaaaaaa
2674 define i64 @imm_neg_2863311530() {
2675 ; RV32I-LABEL: imm_neg_2863311530:
2677 ; RV32I-NEXT: lui a0, 349525
2678 ; RV32I-NEXT: addi a0, a0, 1366
2679 ; RV32I-NEXT: li a1, -1
2682 ; RV64I-LABEL: imm_neg_2863311530:
2684 ; RV64I-NEXT: lui a0, 699051
2685 ; RV64I-NEXT: addiw a0, a0, -1365
2686 ; RV64I-NEXT: slli a0, a0, 1
2689 ; RV64IZBA-LABEL: imm_neg_2863311530:
2690 ; RV64IZBA: # %bb.0:
2691 ; RV64IZBA-NEXT: lui a0, 699051
2692 ; RV64IZBA-NEXT: addiw a0, a0, -1365
2693 ; RV64IZBA-NEXT: slli a0, a0, 1
2694 ; RV64IZBA-NEXT: ret
2696 ; RV64IZBB-LABEL: imm_neg_2863311530:
2697 ; RV64IZBB: # %bb.0:
2698 ; RV64IZBB-NEXT: lui a0, 699051
2699 ; RV64IZBB-NEXT: addiw a0, a0, -1365
2700 ; RV64IZBB-NEXT: slli a0, a0, 1
2701 ; RV64IZBB-NEXT: ret
2703 ; RV64IZBS-LABEL: imm_neg_2863311530:
2704 ; RV64IZBS: # %bb.0:
2705 ; RV64IZBS-NEXT: lui a0, 699051
2706 ; RV64IZBS-NEXT: addiw a0, a0, -1365
2707 ; RV64IZBS-NEXT: slli a0, a0, 1
2708 ; RV64IZBS-NEXT: ret
2710 ; RV64IXTHEADBB-LABEL: imm_neg_2863311530:
2711 ; RV64IXTHEADBB: # %bb.0:
2712 ; RV64IXTHEADBB-NEXT: lui a0, 699051
2713 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1365
2714 ; RV64IXTHEADBB-NEXT: slli a0, a0, 1
2715 ; RV64IXTHEADBB-NEXT: ret
2717 ; RV32-REMAT-LABEL: imm_neg_2863311530:
2718 ; RV32-REMAT: # %bb.0:
2719 ; RV32-REMAT-NEXT: lui a0, 349525
2720 ; RV32-REMAT-NEXT: addi a0, a0, 1366
2721 ; RV32-REMAT-NEXT: li a1, -1
2722 ; RV32-REMAT-NEXT: ret
2724 ; RV64-REMAT-LABEL: imm_neg_2863311530:
2725 ; RV64-REMAT: # %bb.0:
2726 ; RV64-REMAT-NEXT: lui a0, 699051
2727 ; RV64-REMAT-NEXT: addiw a0, a0, -1365
2728 ; RV64-REMAT-NEXT: slli a0, a0, 1
2729 ; RV64-REMAT-NEXT: ret
2730 ret i64 -2863311530 ; #0xffffffff55555556
2733 define i64 @imm_2147486378() {
2734 ; RV32I-LABEL: imm_2147486378:
2736 ; RV32I-NEXT: lui a0, 524288
2737 ; RV32I-NEXT: addi a0, a0, 1365
2738 ; RV32I-NEXT: li a1, 0
2741 ; RV64I-LABEL: imm_2147486378:
2743 ; RV64I-NEXT: li a0, 1
2744 ; RV64I-NEXT: slli a0, a0, 31
2745 ; RV64I-NEXT: addi a0, a0, 1365
2748 ; RV64IZBA-LABEL: imm_2147486378:
2749 ; RV64IZBA: # %bb.0:
2750 ; RV64IZBA-NEXT: li a0, 1
2751 ; RV64IZBA-NEXT: slli a0, a0, 31
2752 ; RV64IZBA-NEXT: addi a0, a0, 1365
2753 ; RV64IZBA-NEXT: ret
2755 ; RV64IZBB-LABEL: imm_2147486378:
2756 ; RV64IZBB: # %bb.0:
2757 ; RV64IZBB-NEXT: li a0, 1
2758 ; RV64IZBB-NEXT: slli a0, a0, 31
2759 ; RV64IZBB-NEXT: addi a0, a0, 1365
2760 ; RV64IZBB-NEXT: ret
2762 ; RV64IZBS-LABEL: imm_2147486378:
2763 ; RV64IZBS: # %bb.0:
2764 ; RV64IZBS-NEXT: li a0, 1365
2765 ; RV64IZBS-NEXT: bseti a0, a0, 31
2766 ; RV64IZBS-NEXT: ret
2768 ; RV64IXTHEADBB-LABEL: imm_2147486378:
2769 ; RV64IXTHEADBB: # %bb.0:
2770 ; RV64IXTHEADBB-NEXT: li a0, 1
2771 ; RV64IXTHEADBB-NEXT: slli a0, a0, 31
2772 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1365
2773 ; RV64IXTHEADBB-NEXT: ret
2775 ; RV32-REMAT-LABEL: imm_2147486378:
2776 ; RV32-REMAT: # %bb.0:
2777 ; RV32-REMAT-NEXT: lui a0, 524288
2778 ; RV32-REMAT-NEXT: addi a0, a0, 1365
2779 ; RV32-REMAT-NEXT: li a1, 0
2780 ; RV32-REMAT-NEXT: ret
2782 ; RV64-REMAT-LABEL: imm_2147486378:
2783 ; RV64-REMAT: # %bb.0:
2784 ; RV64-REMAT-NEXT: li a0, 1
2785 ; RV64-REMAT-NEXT: slli a0, a0, 31
2786 ; RV64-REMAT-NEXT: addi a0, a0, 1365
2787 ; RV64-REMAT-NEXT: ret
2791 define i64 @imm_neg_2147485013() {
2792 ; RV32I-LABEL: imm_neg_2147485013:
2794 ; RV32I-NEXT: lui a0, 524288
2795 ; RV32I-NEXT: addi a0, a0, -1365
2796 ; RV32I-NEXT: li a1, -1
2799 ; RV64I-LABEL: imm_neg_2147485013:
2801 ; RV64I-NEXT: lui a0, 524288
2802 ; RV64I-NEXT: addi a0, a0, -1365
2805 ; RV64IZBA-LABEL: imm_neg_2147485013:
2806 ; RV64IZBA: # %bb.0:
2807 ; RV64IZBA-NEXT: lui a0, 524288
2808 ; RV64IZBA-NEXT: addi a0, a0, -1365
2809 ; RV64IZBA-NEXT: ret
2811 ; RV64IZBB-LABEL: imm_neg_2147485013:
2812 ; RV64IZBB: # %bb.0:
2813 ; RV64IZBB-NEXT: lui a0, 524288
2814 ; RV64IZBB-NEXT: addi a0, a0, -1365
2815 ; RV64IZBB-NEXT: ret
2817 ; RV64IZBS-LABEL: imm_neg_2147485013:
2818 ; RV64IZBS: # %bb.0:
2819 ; RV64IZBS-NEXT: lui a0, 524288
2820 ; RV64IZBS-NEXT: addi a0, a0, -1365
2821 ; RV64IZBS-NEXT: ret
2823 ; RV64IXTHEADBB-LABEL: imm_neg_2147485013:
2824 ; RV64IXTHEADBB: # %bb.0:
2825 ; RV64IXTHEADBB-NEXT: lui a0, 524288
2826 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1365
2827 ; RV64IXTHEADBB-NEXT: ret
2829 ; RV32-REMAT-LABEL: imm_neg_2147485013:
2830 ; RV32-REMAT: # %bb.0:
2831 ; RV32-REMAT-NEXT: lui a0, 524288
2832 ; RV32-REMAT-NEXT: addi a0, a0, -1365
2833 ; RV32-REMAT-NEXT: li a1, -1
2834 ; RV32-REMAT-NEXT: ret
2836 ; RV64-REMAT-LABEL: imm_neg_2147485013:
2837 ; RV64-REMAT: # %bb.0:
2838 ; RV64-REMAT-NEXT: lui a0, 524288
2839 ; RV64-REMAT-NEXT: addi a0, a0, -1365
2840 ; RV64-REMAT-NEXT: ret
2844 define i64 @imm_12900924131259() {
2845 ; RV32I-LABEL: imm_12900924131259:
2847 ; RV32I-NEXT: lui a0, 765952
2848 ; RV32I-NEXT: addi a0, a0, 1979
2849 ; RV32I-NEXT: lui a1, 1
2850 ; RV32I-NEXT: addi a1, a1, -1093
2853 ; RV64I-LABEL: imm_12900924131259:
2855 ; RV64I-NEXT: lui a0, 188
2856 ; RV64I-NEXT: addiw a0, a0, -1093
2857 ; RV64I-NEXT: slli a0, a0, 24
2858 ; RV64I-NEXT: addi a0, a0, 1979
2861 ; RV64IZBA-LABEL: imm_12900924131259:
2862 ; RV64IZBA: # %bb.0:
2863 ; RV64IZBA-NEXT: lui a0, 768955
2864 ; RV64IZBA-NEXT: slli.uw a0, a0, 12
2865 ; RV64IZBA-NEXT: addi a0, a0, 1979
2866 ; RV64IZBA-NEXT: ret
2868 ; RV64IZBB-LABEL: imm_12900924131259:
2869 ; RV64IZBB: # %bb.0:
2870 ; RV64IZBB-NEXT: lui a0, 188
2871 ; RV64IZBB-NEXT: addiw a0, a0, -1093
2872 ; RV64IZBB-NEXT: slli a0, a0, 24
2873 ; RV64IZBB-NEXT: addi a0, a0, 1979
2874 ; RV64IZBB-NEXT: ret
2876 ; RV64IZBS-LABEL: imm_12900924131259:
2877 ; RV64IZBS: # %bb.0:
2878 ; RV64IZBS-NEXT: lui a0, 188
2879 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2880 ; RV64IZBS-NEXT: slli a0, a0, 24
2881 ; RV64IZBS-NEXT: addi a0, a0, 1979
2882 ; RV64IZBS-NEXT: ret
2884 ; RV64IXTHEADBB-LABEL: imm_12900924131259:
2885 ; RV64IXTHEADBB: # %bb.0:
2886 ; RV64IXTHEADBB-NEXT: lui a0, 188
2887 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1093
2888 ; RV64IXTHEADBB-NEXT: slli a0, a0, 24
2889 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1979
2890 ; RV64IXTHEADBB-NEXT: ret
2892 ; RV32-REMAT-LABEL: imm_12900924131259:
2893 ; RV32-REMAT: # %bb.0:
2894 ; RV32-REMAT-NEXT: lui a0, 765952
2895 ; RV32-REMAT-NEXT: addi a0, a0, 1979
2896 ; RV32-REMAT-NEXT: lui a1, 1
2897 ; RV32-REMAT-NEXT: addi a1, a1, -1093
2898 ; RV32-REMAT-NEXT: ret
2900 ; RV64-REMAT-LABEL: imm_12900924131259:
2901 ; RV64-REMAT: # %bb.0:
2902 ; RV64-REMAT-NEXT: lui a0, 188
2903 ; RV64-REMAT-NEXT: addiw a0, a0, -1093
2904 ; RV64-REMAT-NEXT: slli a0, a0, 24
2905 ; RV64-REMAT-NEXT: addi a0, a0, 1979
2906 ; RV64-REMAT-NEXT: ret
2907 ret i64 12900924131259
2910 define i64 @imm_50394234880() {
2911 ; RV32I-LABEL: imm_50394234880:
2913 ; RV32I-NEXT: lui a0, 768944
2914 ; RV32I-NEXT: li a1, 11
2917 ; RV64I-LABEL: imm_50394234880:
2919 ; RV64I-NEXT: lui a0, 188
2920 ; RV64I-NEXT: addiw a0, a0, -1093
2921 ; RV64I-NEXT: slli a0, a0, 16
2924 ; RV64IZBA-LABEL: imm_50394234880:
2925 ; RV64IZBA: # %bb.0:
2926 ; RV64IZBA-NEXT: lui a0, 768955
2927 ; RV64IZBA-NEXT: slli.uw a0, a0, 4
2928 ; RV64IZBA-NEXT: ret
2930 ; RV64IZBB-LABEL: imm_50394234880:
2931 ; RV64IZBB: # %bb.0:
2932 ; RV64IZBB-NEXT: lui a0, 188
2933 ; RV64IZBB-NEXT: addiw a0, a0, -1093
2934 ; RV64IZBB-NEXT: slli a0, a0, 16
2935 ; RV64IZBB-NEXT: ret
2937 ; RV64IZBS-LABEL: imm_50394234880:
2938 ; RV64IZBS: # %bb.0:
2939 ; RV64IZBS-NEXT: lui a0, 188
2940 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2941 ; RV64IZBS-NEXT: slli a0, a0, 16
2942 ; RV64IZBS-NEXT: ret
2944 ; RV64IXTHEADBB-LABEL: imm_50394234880:
2945 ; RV64IXTHEADBB: # %bb.0:
2946 ; RV64IXTHEADBB-NEXT: lui a0, 188
2947 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1093
2948 ; RV64IXTHEADBB-NEXT: slli a0, a0, 16
2949 ; RV64IXTHEADBB-NEXT: ret
2951 ; RV32-REMAT-LABEL: imm_50394234880:
2952 ; RV32-REMAT: # %bb.0:
2953 ; RV32-REMAT-NEXT: lui a0, 768944
2954 ; RV32-REMAT-NEXT: li a1, 11
2955 ; RV32-REMAT-NEXT: ret
2957 ; RV64-REMAT-LABEL: imm_50394234880:
2958 ; RV64-REMAT: # %bb.0:
2959 ; RV64-REMAT-NEXT: lui a0, 188
2960 ; RV64-REMAT-NEXT: addiw a0, a0, -1093
2961 ; RV64-REMAT-NEXT: slli a0, a0, 16
2962 ; RV64-REMAT-NEXT: ret
2966 define i64 @imm_12900936431479() {
2967 ; RV32I-LABEL: imm_12900936431479:
2969 ; RV32I-NEXT: lui a0, 768955
2970 ; RV32I-NEXT: addi a0, a0, 1911
2971 ; RV32I-NEXT: lui a1, 1
2972 ; RV32I-NEXT: addi a1, a1, -1093
2975 ; RV64I-LABEL: imm_12900936431479:
2977 ; RV64I-NEXT: lui a0, 192239
2978 ; RV64I-NEXT: slli a0, a0, 2
2979 ; RV64I-NEXT: addi a0, a0, -1093
2980 ; RV64I-NEXT: slli a0, a0, 12
2981 ; RV64I-NEXT: addi a0, a0, 1911
2984 ; RV64IZBA-LABEL: imm_12900936431479:
2985 ; RV64IZBA: # %bb.0:
2986 ; RV64IZBA-NEXT: lui a0, 768956
2987 ; RV64IZBA-NEXT: addi a0, a0, -1093
2988 ; RV64IZBA-NEXT: slli.uw a0, a0, 12
2989 ; RV64IZBA-NEXT: addi a0, a0, 1911
2990 ; RV64IZBA-NEXT: ret
2992 ; RV64IZBB-LABEL: imm_12900936431479:
2993 ; RV64IZBB: # %bb.0:
2994 ; RV64IZBB-NEXT: lui a0, 192239
2995 ; RV64IZBB-NEXT: slli a0, a0, 2
2996 ; RV64IZBB-NEXT: addi a0, a0, -1093
2997 ; RV64IZBB-NEXT: slli a0, a0, 12
2998 ; RV64IZBB-NEXT: addi a0, a0, 1911
2999 ; RV64IZBB-NEXT: ret
3001 ; RV64IZBS-LABEL: imm_12900936431479:
3002 ; RV64IZBS: # %bb.0:
3003 ; RV64IZBS-NEXT: lui a0, 192239
3004 ; RV64IZBS-NEXT: slli a0, a0, 2
3005 ; RV64IZBS-NEXT: addi a0, a0, -1093
3006 ; RV64IZBS-NEXT: slli a0, a0, 12
3007 ; RV64IZBS-NEXT: addi a0, a0, 1911
3008 ; RV64IZBS-NEXT: ret
3010 ; RV64IXTHEADBB-LABEL: imm_12900936431479:
3011 ; RV64IXTHEADBB: # %bb.0:
3012 ; RV64IXTHEADBB-NEXT: lui a0, 192239
3013 ; RV64IXTHEADBB-NEXT: slli a0, a0, 2
3014 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
3015 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3016 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1911
3017 ; RV64IXTHEADBB-NEXT: ret
3019 ; RV32-REMAT-LABEL: imm_12900936431479:
3020 ; RV32-REMAT: # %bb.0:
3021 ; RV32-REMAT-NEXT: lui a0, 768955
3022 ; RV32-REMAT-NEXT: addi a0, a0, 1911
3023 ; RV32-REMAT-NEXT: lui a1, 1
3024 ; RV32-REMAT-NEXT: addi a1, a1, -1093
3025 ; RV32-REMAT-NEXT: ret
3027 ; RV64-REMAT-LABEL: imm_12900936431479:
3028 ; RV64-REMAT: # %bb.0:
3029 ; RV64-REMAT-NEXT: lui a0, 192239
3030 ; RV64-REMAT-NEXT: slli a0, a0, 2
3031 ; RV64-REMAT-NEXT: addi a0, a0, -1093
3032 ; RV64-REMAT-NEXT: slli a0, a0, 12
3033 ; RV64-REMAT-NEXT: addi a0, a0, 1911
3034 ; RV64-REMAT-NEXT: ret
3035 ret i64 12900936431479
3038 define i64 @imm_12900918536874() {
3039 ; RV32I-LABEL: imm_12900918536874:
3041 ; RV32I-NEXT: lui a0, 764587
3042 ; RV32I-NEXT: addi a0, a0, -1366
3043 ; RV32I-NEXT: lui a1, 1
3044 ; RV32I-NEXT: addi a1, a1, -1093
3047 ; RV64I-LABEL: imm_12900918536874:
3049 ; RV64I-NEXT: lui a0, 384477
3050 ; RV64I-NEXT: addiw a0, a0, 1365
3051 ; RV64I-NEXT: slli a0, a0, 12
3052 ; RV64I-NEXT: addi a0, a0, 1365
3053 ; RV64I-NEXT: slli a0, a0, 1
3056 ; RV64IZBA-LABEL: imm_12900918536874:
3057 ; RV64IZBA: # %bb.0:
3058 ; RV64IZBA-NEXT: lui a0, 768955
3059 ; RV64IZBA-NEXT: addi a0, a0, -1365
3060 ; RV64IZBA-NEXT: slli.uw a0, a0, 12
3061 ; RV64IZBA-NEXT: addi a0, a0, -1366
3062 ; RV64IZBA-NEXT: ret
3064 ; RV64IZBB-LABEL: imm_12900918536874:
3065 ; RV64IZBB: # %bb.0:
3066 ; RV64IZBB-NEXT: lui a0, 384477
3067 ; RV64IZBB-NEXT: addiw a0, a0, 1365
3068 ; RV64IZBB-NEXT: slli a0, a0, 12
3069 ; RV64IZBB-NEXT: addi a0, a0, 1365
3070 ; RV64IZBB-NEXT: slli a0, a0, 1
3071 ; RV64IZBB-NEXT: ret
3073 ; RV64IZBS-LABEL: imm_12900918536874:
3074 ; RV64IZBS: # %bb.0:
3075 ; RV64IZBS-NEXT: lui a0, 384477
3076 ; RV64IZBS-NEXT: addiw a0, a0, 1365
3077 ; RV64IZBS-NEXT: slli a0, a0, 12
3078 ; RV64IZBS-NEXT: addi a0, a0, 1365
3079 ; RV64IZBS-NEXT: slli a0, a0, 1
3080 ; RV64IZBS-NEXT: ret
3082 ; RV64IXTHEADBB-LABEL: imm_12900918536874:
3083 ; RV64IXTHEADBB: # %bb.0:
3084 ; RV64IXTHEADBB-NEXT: lui a0, 384477
3085 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 1365
3086 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3087 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1365
3088 ; RV64IXTHEADBB-NEXT: slli a0, a0, 1
3089 ; RV64IXTHEADBB-NEXT: ret
3091 ; RV32-REMAT-LABEL: imm_12900918536874:
3092 ; RV32-REMAT: # %bb.0:
3093 ; RV32-REMAT-NEXT: lui a0, 764587
3094 ; RV32-REMAT-NEXT: addi a0, a0, -1366
3095 ; RV32-REMAT-NEXT: lui a1, 1
3096 ; RV32-REMAT-NEXT: addi a1, a1, -1093
3097 ; RV32-REMAT-NEXT: ret
3099 ; RV64-REMAT-LABEL: imm_12900918536874:
3100 ; RV64-REMAT: # %bb.0:
3101 ; RV64-REMAT-NEXT: lui a0, 384477
3102 ; RV64-REMAT-NEXT: addiw a0, a0, 1365
3103 ; RV64-REMAT-NEXT: slli a0, a0, 12
3104 ; RV64-REMAT-NEXT: addi a0, a0, 1365
3105 ; RV64-REMAT-NEXT: slli a0, a0, 1
3106 ; RV64-REMAT-NEXT: ret
3107 ret i64 12900918536874
3110 define i64 @imm_12900925247761() {
3111 ; RV32I-LABEL: imm_12900925247761:
3113 ; RV32I-NEXT: lui a0, 766225
3114 ; RV32I-NEXT: addi a0, a0, 273
3115 ; RV32I-NEXT: lui a1, 1
3116 ; RV32I-NEXT: addi a1, a1, -1093
3119 ; RV64I-LABEL: imm_12900925247761:
3121 ; RV64I-NEXT: lui a0, 384478
3122 ; RV64I-NEXT: addiw a0, a0, -1911
3123 ; RV64I-NEXT: slli a0, a0, 13
3124 ; RV64I-NEXT: addi a0, a0, -2048
3125 ; RV64I-NEXT: addi a0, a0, -1775
3128 ; RV64IZBA-LABEL: imm_12900925247761:
3129 ; RV64IZBA: # %bb.0:
3130 ; RV64IZBA-NEXT: lui a0, 768955
3131 ; RV64IZBA-NEXT: addi a0, a0, 273
3132 ; RV64IZBA-NEXT: slli.uw a0, a0, 12
3133 ; RV64IZBA-NEXT: addi a0, a0, 273
3134 ; RV64IZBA-NEXT: ret
3136 ; RV64IZBB-LABEL: imm_12900925247761:
3137 ; RV64IZBB: # %bb.0:
3138 ; RV64IZBB-NEXT: lui a0, 384478
3139 ; RV64IZBB-NEXT: addiw a0, a0, -1911
3140 ; RV64IZBB-NEXT: slli a0, a0, 13
3141 ; RV64IZBB-NEXT: addi a0, a0, -2048
3142 ; RV64IZBB-NEXT: addi a0, a0, -1775
3143 ; RV64IZBB-NEXT: ret
3145 ; RV64IZBS-LABEL: imm_12900925247761:
3146 ; RV64IZBS: # %bb.0:
3147 ; RV64IZBS-NEXT: lui a0, 384478
3148 ; RV64IZBS-NEXT: addiw a0, a0, -1911
3149 ; RV64IZBS-NEXT: slli a0, a0, 13
3150 ; RV64IZBS-NEXT: addi a0, a0, -2048
3151 ; RV64IZBS-NEXT: addi a0, a0, -1775
3152 ; RV64IZBS-NEXT: ret
3154 ; RV64IXTHEADBB-LABEL: imm_12900925247761:
3155 ; RV64IXTHEADBB: # %bb.0:
3156 ; RV64IXTHEADBB-NEXT: lui a0, 384478
3157 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1911
3158 ; RV64IXTHEADBB-NEXT: slli a0, a0, 13
3159 ; RV64IXTHEADBB-NEXT: addi a0, a0, -2048
3160 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1775
3161 ; RV64IXTHEADBB-NEXT: ret
3163 ; RV32-REMAT-LABEL: imm_12900925247761:
3164 ; RV32-REMAT: # %bb.0:
3165 ; RV32-REMAT-NEXT: lui a0, 766225
3166 ; RV32-REMAT-NEXT: addi a0, a0, 273
3167 ; RV32-REMAT-NEXT: lui a1, 1
3168 ; RV32-REMAT-NEXT: addi a1, a1, -1093
3169 ; RV32-REMAT-NEXT: ret
3171 ; RV64-REMAT-LABEL: imm_12900925247761:
3172 ; RV64-REMAT: # %bb.0:
3173 ; RV64-REMAT-NEXT: lui a0, 384478
3174 ; RV64-REMAT-NEXT: addiw a0, a0, -1911
3175 ; RV64-REMAT-NEXT: slli a0, a0, 13
3176 ; RV64-REMAT-NEXT: addi a0, a0, -2048
3177 ; RV64-REMAT-NEXT: addi a0, a0, -1775
3178 ; RV64-REMAT-NEXT: ret
3179 ret i64 12900925247761
3182 define i64 @imm_7158272001() {
3183 ; RV32I-LABEL: imm_7158272001:
3185 ; RV32I-NEXT: lui a0, 699049
3186 ; RV32I-NEXT: addi a0, a0, 1
3187 ; RV32I-NEXT: li a1, 1
3190 ; RV64I-LABEL: imm_7158272001:
3192 ; RV64I-NEXT: lui a0, 427
3193 ; RV64I-NEXT: addiw a0, a0, -1367
3194 ; RV64I-NEXT: slli a0, a0, 12
3195 ; RV64I-NEXT: addi a0, a0, 1
3198 ; RV64IZBA-LABEL: imm_7158272001:
3199 ; RV64IZBA: # %bb.0:
3200 ; RV64IZBA-NEXT: lui a0, 349525
3201 ; RV64IZBA-NEXT: sh2add a0, a0, a0
3202 ; RV64IZBA-NEXT: addi a0, a0, 1
3203 ; RV64IZBA-NEXT: ret
3205 ; RV64IZBB-LABEL: imm_7158272001:
3206 ; RV64IZBB: # %bb.0:
3207 ; RV64IZBB-NEXT: lui a0, 427
3208 ; RV64IZBB-NEXT: addiw a0, a0, -1367
3209 ; RV64IZBB-NEXT: slli a0, a0, 12
3210 ; RV64IZBB-NEXT: addi a0, a0, 1
3211 ; RV64IZBB-NEXT: ret
3213 ; RV64IZBS-LABEL: imm_7158272001:
3214 ; RV64IZBS: # %bb.0:
3215 ; RV64IZBS-NEXT: lui a0, 427
3216 ; RV64IZBS-NEXT: addiw a0, a0, -1367
3217 ; RV64IZBS-NEXT: slli a0, a0, 12
3218 ; RV64IZBS-NEXT: addi a0, a0, 1
3219 ; RV64IZBS-NEXT: ret
3221 ; RV64IXTHEADBB-LABEL: imm_7158272001:
3222 ; RV64IXTHEADBB: # %bb.0:
3223 ; RV64IXTHEADBB-NEXT: lui a0, 427
3224 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1367
3225 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3226 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1
3227 ; RV64IXTHEADBB-NEXT: ret
3229 ; RV32-REMAT-LABEL: imm_7158272001:
3230 ; RV32-REMAT: # %bb.0:
3231 ; RV32-REMAT-NEXT: lui a0, 699049
3232 ; RV32-REMAT-NEXT: addi a0, a0, 1
3233 ; RV32-REMAT-NEXT: li a1, 1
3234 ; RV32-REMAT-NEXT: ret
3236 ; RV64-REMAT-LABEL: imm_7158272001:
3237 ; RV64-REMAT: # %bb.0:
3238 ; RV64-REMAT-NEXT: lui a0, 427
3239 ; RV64-REMAT-NEXT: addiw a0, a0, -1367
3240 ; RV64-REMAT-NEXT: slli a0, a0, 12
3241 ; RV64-REMAT-NEXT: addi a0, a0, 1
3242 ; RV64-REMAT-NEXT: ret
3243 ret i64 7158272001 ; 0x0000_0001_aaaa_9001
3246 define i64 @imm_12884889601() {
3247 ; RV32I-LABEL: imm_12884889601:
3249 ; RV32I-NEXT: lui a0, 1048573
3250 ; RV32I-NEXT: addi a0, a0, 1
3251 ; RV32I-NEXT: li a1, 2
3254 ; RV64I-LABEL: imm_12884889601:
3256 ; RV64I-NEXT: lui a0, 768
3257 ; RV64I-NEXT: addiw a0, a0, -3
3258 ; RV64I-NEXT: slli a0, a0, 12
3259 ; RV64I-NEXT: addi a0, a0, 1
3262 ; RV64IZBA-LABEL: imm_12884889601:
3263 ; RV64IZBA: # %bb.0:
3264 ; RV64IZBA-NEXT: lui a0, 349525
3265 ; RV64IZBA-NEXT: sh3add a0, a0, a0
3266 ; RV64IZBA-NEXT: addi a0, a0, 1
3267 ; RV64IZBA-NEXT: ret
3269 ; RV64IZBB-LABEL: imm_12884889601:
3270 ; RV64IZBB: # %bb.0:
3271 ; RV64IZBB-NEXT: lui a0, 768
3272 ; RV64IZBB-NEXT: addiw a0, a0, -3
3273 ; RV64IZBB-NEXT: slli a0, a0, 12
3274 ; RV64IZBB-NEXT: addi a0, a0, 1
3275 ; RV64IZBB-NEXT: ret
3277 ; RV64IZBS-LABEL: imm_12884889601:
3278 ; RV64IZBS: # %bb.0:
3279 ; RV64IZBS-NEXT: lui a0, 768
3280 ; RV64IZBS-NEXT: addiw a0, a0, -3
3281 ; RV64IZBS-NEXT: slli a0, a0, 12
3282 ; RV64IZBS-NEXT: addi a0, a0, 1
3283 ; RV64IZBS-NEXT: ret
3285 ; RV64IXTHEADBB-LABEL: imm_12884889601:
3286 ; RV64IXTHEADBB: # %bb.0:
3287 ; RV64IXTHEADBB-NEXT: lui a0, 768
3288 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -3
3289 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3290 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1
3291 ; RV64IXTHEADBB-NEXT: ret
3293 ; RV32-REMAT-LABEL: imm_12884889601:
3294 ; RV32-REMAT: # %bb.0:
3295 ; RV32-REMAT-NEXT: lui a0, 1048573
3296 ; RV32-REMAT-NEXT: addi a0, a0, 1
3297 ; RV32-REMAT-NEXT: li a1, 2
3298 ; RV32-REMAT-NEXT: ret
3300 ; RV64-REMAT-LABEL: imm_12884889601:
3301 ; RV64-REMAT: # %bb.0:
3302 ; RV64-REMAT-NEXT: lui a0, 768
3303 ; RV64-REMAT-NEXT: addiw a0, a0, -3
3304 ; RV64-REMAT-NEXT: slli a0, a0, 12
3305 ; RV64-REMAT-NEXT: addi a0, a0, 1
3306 ; RV64-REMAT-NEXT: ret
3307 ret i64 12884889601 ; 0x0000_0002_ffff_d001
3310 define i64 @imm_neg_3435982847() {
3311 ; RV32I-LABEL: imm_neg_3435982847:
3313 ; RV32I-NEXT: lui a0, 209713
3314 ; RV32I-NEXT: addi a0, a0, 1
3315 ; RV32I-NEXT: li a1, -1
3318 ; RV64I-LABEL: imm_neg_3435982847:
3320 ; RV64I-NEXT: lui a0, 1048371
3321 ; RV64I-NEXT: addiw a0, a0, 817
3322 ; RV64I-NEXT: slli a0, a0, 12
3323 ; RV64I-NEXT: addi a0, a0, 1
3326 ; RV64IZBA-LABEL: imm_neg_3435982847:
3327 ; RV64IZBA: # %bb.0:
3328 ; RV64IZBA-NEXT: lui a0, 768955
3329 ; RV64IZBA-NEXT: sh1add a0, a0, a0
3330 ; RV64IZBA-NEXT: addi a0, a0, 1
3331 ; RV64IZBA-NEXT: ret
3333 ; RV64IZBB-LABEL: imm_neg_3435982847:
3334 ; RV64IZBB: # %bb.0:
3335 ; RV64IZBB-NEXT: lui a0, 1048371
3336 ; RV64IZBB-NEXT: addiw a0, a0, 817
3337 ; RV64IZBB-NEXT: slli a0, a0, 12
3338 ; RV64IZBB-NEXT: addi a0, a0, 1
3339 ; RV64IZBB-NEXT: ret
3341 ; RV64IZBS-LABEL: imm_neg_3435982847:
3342 ; RV64IZBS: # %bb.0:
3343 ; RV64IZBS-NEXT: lui a0, 734001
3344 ; RV64IZBS-NEXT: addiw a0, a0, 1
3345 ; RV64IZBS-NEXT: bclri a0, a0, 31
3346 ; RV64IZBS-NEXT: ret
3348 ; RV64IXTHEADBB-LABEL: imm_neg_3435982847:
3349 ; RV64IXTHEADBB: # %bb.0:
3350 ; RV64IXTHEADBB-NEXT: lui a0, 1048371
3351 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 817
3352 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3353 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1
3354 ; RV64IXTHEADBB-NEXT: ret
3356 ; RV32-REMAT-LABEL: imm_neg_3435982847:
3357 ; RV32-REMAT: # %bb.0:
3358 ; RV32-REMAT-NEXT: lui a0, 209713
3359 ; RV32-REMAT-NEXT: addi a0, a0, 1
3360 ; RV32-REMAT-NEXT: li a1, -1
3361 ; RV32-REMAT-NEXT: ret
3363 ; RV64-REMAT-LABEL: imm_neg_3435982847:
3364 ; RV64-REMAT: # %bb.0:
3365 ; RV64-REMAT-NEXT: lui a0, 1048371
3366 ; RV64-REMAT-NEXT: addiw a0, a0, 817
3367 ; RV64-REMAT-NEXT: slli a0, a0, 12
3368 ; RV64-REMAT-NEXT: addi a0, a0, 1
3369 ; RV64-REMAT-NEXT: ret
3370 ret i64 -3435982847 ; 0xffff_ffff_3333_1001
3373 define i64 @imm_neg_5726842879() {
3374 ; RV32I-LABEL: imm_neg_5726842879:
3376 ; RV32I-NEXT: lui a0, 698997
3377 ; RV32I-NEXT: addi a0, a0, 1
3378 ; RV32I-NEXT: li a1, -2
3381 ; RV64I-LABEL: imm_neg_5726842879:
3383 ; RV64I-NEXT: lui a0, 1048235
3384 ; RV64I-NEXT: addiw a0, a0, -1419
3385 ; RV64I-NEXT: slli a0, a0, 12
3386 ; RV64I-NEXT: addi a0, a0, 1
3389 ; RV64IZBA-LABEL: imm_neg_5726842879:
3390 ; RV64IZBA: # %bb.0:
3391 ; RV64IZBA-NEXT: lui a0, 768945
3392 ; RV64IZBA-NEXT: sh2add a0, a0, a0
3393 ; RV64IZBA-NEXT: addi a0, a0, 1
3394 ; RV64IZBA-NEXT: ret
3396 ; RV64IZBB-LABEL: imm_neg_5726842879:
3397 ; RV64IZBB: # %bb.0:
3398 ; RV64IZBB-NEXT: lui a0, 1048235
3399 ; RV64IZBB-NEXT: addiw a0, a0, -1419
3400 ; RV64IZBB-NEXT: slli a0, a0, 12
3401 ; RV64IZBB-NEXT: addi a0, a0, 1
3402 ; RV64IZBB-NEXT: ret
3404 ; RV64IZBS-LABEL: imm_neg_5726842879:
3405 ; RV64IZBS: # %bb.0:
3406 ; RV64IZBS-NEXT: lui a0, 698997
3407 ; RV64IZBS-NEXT: addiw a0, a0, 1
3408 ; RV64IZBS-NEXT: bclri a0, a0, 32
3409 ; RV64IZBS-NEXT: ret
3411 ; RV64IXTHEADBB-LABEL: imm_neg_5726842879:
3412 ; RV64IXTHEADBB: # %bb.0:
3413 ; RV64IXTHEADBB-NEXT: lui a0, 1048235
3414 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1419
3415 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3416 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1
3417 ; RV64IXTHEADBB-NEXT: ret
3419 ; RV32-REMAT-LABEL: imm_neg_5726842879:
3420 ; RV32-REMAT: # %bb.0:
3421 ; RV32-REMAT-NEXT: lui a0, 698997
3422 ; RV32-REMAT-NEXT: addi a0, a0, 1
3423 ; RV32-REMAT-NEXT: li a1, -2
3424 ; RV32-REMAT-NEXT: ret
3426 ; RV64-REMAT-LABEL: imm_neg_5726842879:
3427 ; RV64-REMAT: # %bb.0:
3428 ; RV64-REMAT-NEXT: lui a0, 1048235
3429 ; RV64-REMAT-NEXT: addiw a0, a0, -1419
3430 ; RV64-REMAT-NEXT: slli a0, a0, 12
3431 ; RV64-REMAT-NEXT: addi a0, a0, 1
3432 ; RV64-REMAT-NEXT: ret
3433 ret i64 -5726842879 ; 0xffff_fffe_aaa7_5001
3436 define i64 @imm_neg_10307948543() {
3437 ; RV32I-LABEL: imm_neg_10307948543:
3439 ; RV32I-NEXT: lui a0, 629139
3440 ; RV32I-NEXT: addi a0, a0, 1
3441 ; RV32I-NEXT: li a1, -3
3444 ; RV64I-LABEL: imm_neg_10307948543:
3446 ; RV64I-NEXT: lui a0, 1047962
3447 ; RV64I-NEXT: addiw a0, a0, -1645
3448 ; RV64I-NEXT: slli a0, a0, 12
3449 ; RV64I-NEXT: addi a0, a0, 1
3452 ; RV64IZBA-LABEL: imm_neg_10307948543:
3453 ; RV64IZBA: # %bb.0:
3454 ; RV64IZBA-NEXT: lui a0, 768955
3455 ; RV64IZBA-NEXT: sh3add a0, a0, a0
3456 ; RV64IZBA-NEXT: addi a0, a0, 1
3457 ; RV64IZBA-NEXT: ret
3459 ; RV64IZBB-LABEL: imm_neg_10307948543:
3460 ; RV64IZBB: # %bb.0:
3461 ; RV64IZBB-NEXT: lui a0, 1047962
3462 ; RV64IZBB-NEXT: addiw a0, a0, -1645
3463 ; RV64IZBB-NEXT: slli a0, a0, 12
3464 ; RV64IZBB-NEXT: addi a0, a0, 1
3465 ; RV64IZBB-NEXT: ret
3467 ; RV64IZBS-LABEL: imm_neg_10307948543:
3468 ; RV64IZBS: # %bb.0:
3469 ; RV64IZBS-NEXT: lui a0, 629139
3470 ; RV64IZBS-NEXT: addiw a0, a0, 1
3471 ; RV64IZBS-NEXT: bclri a0, a0, 33
3472 ; RV64IZBS-NEXT: ret
3474 ; RV64IXTHEADBB-LABEL: imm_neg_10307948543:
3475 ; RV64IXTHEADBB: # %bb.0:
3476 ; RV64IXTHEADBB-NEXT: lui a0, 1047962
3477 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1645
3478 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3479 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1
3480 ; RV64IXTHEADBB-NEXT: ret
3482 ; RV32-REMAT-LABEL: imm_neg_10307948543:
3483 ; RV32-REMAT: # %bb.0:
3484 ; RV32-REMAT-NEXT: lui a0, 629139
3485 ; RV32-REMAT-NEXT: addi a0, a0, 1
3486 ; RV32-REMAT-NEXT: li a1, -3
3487 ; RV32-REMAT-NEXT: ret
3489 ; RV64-REMAT-LABEL: imm_neg_10307948543:
3490 ; RV64-REMAT: # %bb.0:
3491 ; RV64-REMAT-NEXT: lui a0, 1047962
3492 ; RV64-REMAT-NEXT: addiw a0, a0, -1645
3493 ; RV64-REMAT-NEXT: slli a0, a0, 12
3494 ; RV64-REMAT-NEXT: addi a0, a0, 1
3495 ; RV64-REMAT-NEXT: ret
3496 ret i64 -10307948543 ; 0xffff_fffd_9999_3001
3499 define i64 @li_rori_1() {
3500 ; RV32I-LABEL: li_rori_1:
3502 ; RV32I-NEXT: lui a0, 1048567
3503 ; RV32I-NEXT: addi a1, a0, 2047
3504 ; RV32I-NEXT: li a0, -1
3507 ; RV64I-LABEL: li_rori_1:
3509 ; RV64I-NEXT: li a0, -17
3510 ; RV64I-NEXT: slli a0, a0, 43
3511 ; RV64I-NEXT: addi a0, a0, -1
3514 ; RV64IZBA-LABEL: li_rori_1:
3515 ; RV64IZBA: # %bb.0:
3516 ; RV64IZBA-NEXT: li a0, -17
3517 ; RV64IZBA-NEXT: slli a0, a0, 43
3518 ; RV64IZBA-NEXT: addi a0, a0, -1
3519 ; RV64IZBA-NEXT: ret
3521 ; RV64IZBB-LABEL: li_rori_1:
3522 ; RV64IZBB: # %bb.0:
3523 ; RV64IZBB-NEXT: li a0, -18
3524 ; RV64IZBB-NEXT: rori a0, a0, 21
3525 ; RV64IZBB-NEXT: ret
3527 ; RV64IZBS-LABEL: li_rori_1:
3528 ; RV64IZBS: # %bb.0:
3529 ; RV64IZBS-NEXT: li a0, -17
3530 ; RV64IZBS-NEXT: slli a0, a0, 43
3531 ; RV64IZBS-NEXT: addi a0, a0, -1
3532 ; RV64IZBS-NEXT: ret
3534 ; RV64IXTHEADBB-LABEL: li_rori_1:
3535 ; RV64IXTHEADBB: # %bb.0:
3536 ; RV64IXTHEADBB-NEXT: li a0, -18
3537 ; RV64IXTHEADBB-NEXT: th.srri a0, a0, 21
3538 ; RV64IXTHEADBB-NEXT: ret
3540 ; RV32-REMAT-LABEL: li_rori_1:
3541 ; RV32-REMAT: # %bb.0:
3542 ; RV32-REMAT-NEXT: lui a1, 1048567
3543 ; RV32-REMAT-NEXT: addi a1, a1, 2047
3544 ; RV32-REMAT-NEXT: li a0, -1
3545 ; RV32-REMAT-NEXT: ret
3547 ; RV64-REMAT-LABEL: li_rori_1:
3548 ; RV64-REMAT: # %bb.0:
3549 ; RV64-REMAT-NEXT: li a0, -17
3550 ; RV64-REMAT-NEXT: slli a0, a0, 43
3551 ; RV64-REMAT-NEXT: addi a0, a0, -1
3552 ; RV64-REMAT-NEXT: ret
3553 ret i64 -149533581377537
3556 define i64 @li_rori_2() {
3557 ; RV32I-LABEL: li_rori_2:
3559 ; RV32I-NEXT: lui a1, 720896
3560 ; RV32I-NEXT: addi a1, a1, -1
3561 ; RV32I-NEXT: li a0, -6
3564 ; RV64I-LABEL: li_rori_2:
3566 ; RV64I-NEXT: li a0, -5
3567 ; RV64I-NEXT: slli a0, a0, 60
3568 ; RV64I-NEXT: addi a0, a0, -6
3571 ; RV64IZBA-LABEL: li_rori_2:
3572 ; RV64IZBA: # %bb.0:
3573 ; RV64IZBA-NEXT: li a0, -5
3574 ; RV64IZBA-NEXT: slli a0, a0, 60
3575 ; RV64IZBA-NEXT: addi a0, a0, -6
3576 ; RV64IZBA-NEXT: ret
3578 ; RV64IZBB-LABEL: li_rori_2:
3579 ; RV64IZBB: # %bb.0:
3580 ; RV64IZBB-NEXT: li a0, -86
3581 ; RV64IZBB-NEXT: rori a0, a0, 4
3582 ; RV64IZBB-NEXT: ret
3584 ; RV64IZBS-LABEL: li_rori_2:
3585 ; RV64IZBS: # %bb.0:
3586 ; RV64IZBS-NEXT: li a0, -5
3587 ; RV64IZBS-NEXT: slli a0, a0, 60
3588 ; RV64IZBS-NEXT: addi a0, a0, -6
3589 ; RV64IZBS-NEXT: ret
3591 ; RV64IXTHEADBB-LABEL: li_rori_2:
3592 ; RV64IXTHEADBB: # %bb.0:
3593 ; RV64IXTHEADBB-NEXT: li a0, -86
3594 ; RV64IXTHEADBB-NEXT: th.srri a0, a0, 4
3595 ; RV64IXTHEADBB-NEXT: ret
3597 ; RV32-REMAT-LABEL: li_rori_2:
3598 ; RV32-REMAT: # %bb.0:
3599 ; RV32-REMAT-NEXT: lui a1, 720896
3600 ; RV32-REMAT-NEXT: addi a1, a1, -1
3601 ; RV32-REMAT-NEXT: li a0, -6
3602 ; RV32-REMAT-NEXT: ret
3604 ; RV64-REMAT-LABEL: li_rori_2:
3605 ; RV64-REMAT: # %bb.0:
3606 ; RV64-REMAT-NEXT: li a0, -5
3607 ; RV64-REMAT-NEXT: slli a0, a0, 60
3608 ; RV64-REMAT-NEXT: addi a0, a0, -6
3609 ; RV64-REMAT-NEXT: ret
3610 ret i64 -5764607523034234886
3613 define i64 @li_rori_3() {
3614 ; RV32I-LABEL: li_rori_3:
3616 ; RV32I-NEXT: lui a0, 491520
3617 ; RV32I-NEXT: addi a0, a0, -1
3618 ; RV32I-NEXT: li a1, -1
3621 ; RV64I-LABEL: li_rori_3:
3623 ; RV64I-NEXT: li a0, -17
3624 ; RV64I-NEXT: slli a0, a0, 27
3625 ; RV64I-NEXT: addi a0, a0, -1
3628 ; RV64IZBA-LABEL: li_rori_3:
3629 ; RV64IZBA: # %bb.0:
3630 ; RV64IZBA-NEXT: li a0, -17
3631 ; RV64IZBA-NEXT: slli a0, a0, 27
3632 ; RV64IZBA-NEXT: addi a0, a0, -1
3633 ; RV64IZBA-NEXT: ret
3635 ; RV64IZBB-LABEL: li_rori_3:
3636 ; RV64IZBB: # %bb.0:
3637 ; RV64IZBB-NEXT: li a0, -18
3638 ; RV64IZBB-NEXT: rori a0, a0, 37
3639 ; RV64IZBB-NEXT: ret
3641 ; RV64IZBS-LABEL: li_rori_3:
3642 ; RV64IZBS: # %bb.0:
3643 ; RV64IZBS-NEXT: li a0, -17
3644 ; RV64IZBS-NEXT: slli a0, a0, 27
3645 ; RV64IZBS-NEXT: addi a0, a0, -1
3646 ; RV64IZBS-NEXT: ret
3648 ; RV64IXTHEADBB-LABEL: li_rori_3:
3649 ; RV64IXTHEADBB: # %bb.0:
3650 ; RV64IXTHEADBB-NEXT: li a0, -18
3651 ; RV64IXTHEADBB-NEXT: th.srri a0, a0, 37
3652 ; RV64IXTHEADBB-NEXT: ret
3654 ; RV32-REMAT-LABEL: li_rori_3:
3655 ; RV32-REMAT: # %bb.0:
3656 ; RV32-REMAT-NEXT: lui a0, 491520
3657 ; RV32-REMAT-NEXT: addi a0, a0, -1
3658 ; RV32-REMAT-NEXT: li a1, -1
3659 ; RV32-REMAT-NEXT: ret
3661 ; RV64-REMAT-LABEL: li_rori_3:
3662 ; RV64-REMAT: # %bb.0:
3663 ; RV64-REMAT-NEXT: li a0, -17
3664 ; RV64-REMAT-NEXT: slli a0, a0, 27
3665 ; RV64-REMAT-NEXT: addi a0, a0, -1
3666 ; RV64-REMAT-NEXT: ret
3670 ; This used to assert when compiled with Zba.
3671 define i64 @PR54812() {
3672 ; RV32I-LABEL: PR54812:
3674 ; RV32I-NEXT: lui a0, 521599
3675 ; RV32I-NEXT: li a1, -1
3678 ; RV64I-LABEL: PR54812:
3680 ; RV64I-NEXT: lui a0, 1048447
3681 ; RV64I-NEXT: addiw a0, a0, 1407
3682 ; RV64I-NEXT: slli a0, a0, 12
3685 ; RV64IZBA-LABEL: PR54812:
3686 ; RV64IZBA: # %bb.0:
3687 ; RV64IZBA-NEXT: lui a0, 872917
3688 ; RV64IZBA-NEXT: sh1add a0, a0, a0
3689 ; RV64IZBA-NEXT: ret
3691 ; RV64IZBB-LABEL: PR54812:
3692 ; RV64IZBB: # %bb.0:
3693 ; RV64IZBB-NEXT: lui a0, 1048447
3694 ; RV64IZBB-NEXT: addiw a0, a0, 1407
3695 ; RV64IZBB-NEXT: slli a0, a0, 12
3696 ; RV64IZBB-NEXT: ret
3698 ; RV64IZBS-LABEL: PR54812:
3699 ; RV64IZBS: # %bb.0:
3700 ; RV64IZBS-NEXT: lui a0, 1045887
3701 ; RV64IZBS-NEXT: bclri a0, a0, 31
3702 ; RV64IZBS-NEXT: ret
3704 ; RV64IXTHEADBB-LABEL: PR54812:
3705 ; RV64IXTHEADBB: # %bb.0:
3706 ; RV64IXTHEADBB-NEXT: lui a0, 1048447
3707 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 1407
3708 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3709 ; RV64IXTHEADBB-NEXT: ret
3711 ; RV32-REMAT-LABEL: PR54812:
3712 ; RV32-REMAT: # %bb.0:
3713 ; RV32-REMAT-NEXT: lui a0, 521599
3714 ; RV32-REMAT-NEXT: li a1, -1
3715 ; RV32-REMAT-NEXT: ret
3717 ; RV64-REMAT-LABEL: PR54812:
3718 ; RV64-REMAT: # %bb.0:
3719 ; RV64-REMAT-NEXT: lui a0, 1048447
3720 ; RV64-REMAT-NEXT: addiw a0, a0, 1407
3721 ; RV64-REMAT-NEXT: slli a0, a0, 12
3722 ; RV64-REMAT-NEXT: ret
3723 ret i64 -2158497792;
3726 define signext i32 @pos_2048() nounwind {
3727 ; RV32I-LABEL: pos_2048:
3729 ; RV32I-NEXT: li a0, 1
3730 ; RV32I-NEXT: slli a0, a0, 11
3733 ; RV64I-LABEL: pos_2048:
3735 ; RV64I-NEXT: li a0, 1
3736 ; RV64I-NEXT: slli a0, a0, 11
3739 ; RV64IZBA-LABEL: pos_2048:
3740 ; RV64IZBA: # %bb.0:
3741 ; RV64IZBA-NEXT: li a0, 1
3742 ; RV64IZBA-NEXT: slli a0, a0, 11
3743 ; RV64IZBA-NEXT: ret
3745 ; RV64IZBB-LABEL: pos_2048:
3746 ; RV64IZBB: # %bb.0:
3747 ; RV64IZBB-NEXT: li a0, 1
3748 ; RV64IZBB-NEXT: slli a0, a0, 11
3749 ; RV64IZBB-NEXT: ret
3751 ; RV64IZBS-LABEL: pos_2048:
3752 ; RV64IZBS: # %bb.0:
3753 ; RV64IZBS-NEXT: bseti a0, zero, 11
3754 ; RV64IZBS-NEXT: ret
3756 ; RV64IXTHEADBB-LABEL: pos_2048:
3757 ; RV64IXTHEADBB: # %bb.0:
3758 ; RV64IXTHEADBB-NEXT: li a0, 1
3759 ; RV64IXTHEADBB-NEXT: slli a0, a0, 11
3760 ; RV64IXTHEADBB-NEXT: ret
3762 ; RV32-REMAT-LABEL: pos_2048:
3763 ; RV32-REMAT: # %bb.0:
3764 ; RV32-REMAT-NEXT: li a0, 1
3765 ; RV32-REMAT-NEXT: slli a0, a0, 11
3766 ; RV32-REMAT-NEXT: ret
3768 ; RV64-REMAT-LABEL: pos_2048:
3769 ; RV64-REMAT: # %bb.0:
3770 ; RV64-REMAT-NEXT: li a0, 1
3771 ; RV64-REMAT-NEXT: slli a0, a0, 11
3772 ; RV64-REMAT-NEXT: ret
3776 define i64 @imm64_same_lo_hi() nounwind {
3777 ; RV32I-LABEL: imm64_same_lo_hi:
3779 ; RV32I-NEXT: lui a0, 65793
3780 ; RV32I-NEXT: addi a0, a0, 16
3781 ; RV32I-NEXT: mv a1, a0
3784 ; RV64I-LABEL: imm64_same_lo_hi:
3786 ; RV64I-NEXT: lui a0, 65793
3787 ; RV64I-NEXT: addiw a0, a0, 16
3788 ; RV64I-NEXT: slli a1, a0, 32
3789 ; RV64I-NEXT: add a0, a0, a1
3792 ; RV64IZBA-LABEL: imm64_same_lo_hi:
3793 ; RV64IZBA: # %bb.0:
3794 ; RV64IZBA-NEXT: lui a0, 65793
3795 ; RV64IZBA-NEXT: addiw a0, a0, 16
3796 ; RV64IZBA-NEXT: slli a1, a0, 32
3797 ; RV64IZBA-NEXT: add a0, a0, a1
3798 ; RV64IZBA-NEXT: ret
3800 ; RV64IZBB-LABEL: imm64_same_lo_hi:
3801 ; RV64IZBB: # %bb.0:
3802 ; RV64IZBB-NEXT: lui a0, 65793
3803 ; RV64IZBB-NEXT: addiw a0, a0, 16
3804 ; RV64IZBB-NEXT: slli a1, a0, 32
3805 ; RV64IZBB-NEXT: add a0, a0, a1
3806 ; RV64IZBB-NEXT: ret
3808 ; RV64IZBS-LABEL: imm64_same_lo_hi:
3809 ; RV64IZBS: # %bb.0:
3810 ; RV64IZBS-NEXT: lui a0, 65793
3811 ; RV64IZBS-NEXT: addiw a0, a0, 16
3812 ; RV64IZBS-NEXT: slli a1, a0, 32
3813 ; RV64IZBS-NEXT: add a0, a0, a1
3814 ; RV64IZBS-NEXT: ret
3816 ; RV64IXTHEADBB-LABEL: imm64_same_lo_hi:
3817 ; RV64IXTHEADBB: # %bb.0:
3818 ; RV64IXTHEADBB-NEXT: lui a0, 65793
3819 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 16
3820 ; RV64IXTHEADBB-NEXT: slli a1, a0, 32
3821 ; RV64IXTHEADBB-NEXT: add a0, a0, a1
3822 ; RV64IXTHEADBB-NEXT: ret
3824 ; RV32-REMAT-LABEL: imm64_same_lo_hi:
3825 ; RV32-REMAT: # %bb.0:
3826 ; RV32-REMAT-NEXT: lui a0, 65793
3827 ; RV32-REMAT-NEXT: addi a0, a0, 16
3828 ; RV32-REMAT-NEXT: mv a1, a0
3829 ; RV32-REMAT-NEXT: ret
3831 ; RV64-REMAT-LABEL: imm64_same_lo_hi:
3832 ; RV64-REMAT: # %bb.0:
3833 ; RV64-REMAT-NEXT: lui a0, 65793
3834 ; RV64-REMAT-NEXT: addiw a0, a0, 16
3835 ; RV64-REMAT-NEXT: slli a1, a0, 32
3836 ; RV64-REMAT-NEXT: add a0, a0, a1
3837 ; RV64-REMAT-NEXT: ret
3838 ret i64 1157442765409226768 ; 0x0101010101010101
3841 ; Same as above with optsize. Make sure we use constant pool on RV64
3842 define i64 @imm64_same_lo_hi_optsize() nounwind optsize {
3843 ; RV32I-LABEL: imm64_same_lo_hi_optsize:
3845 ; RV32I-NEXT: lui a0, 65793
3846 ; RV32I-NEXT: addi a0, a0, 16
3847 ; RV32I-NEXT: mv a1, a0
3850 ; RV64-NOPOOL-LABEL: imm64_same_lo_hi_optsize:
3851 ; RV64-NOPOOL: # %bb.0:
3852 ; RV64-NOPOOL-NEXT: lui a0, 65793
3853 ; RV64-NOPOOL-NEXT: addiw a0, a0, 16
3854 ; RV64-NOPOOL-NEXT: slli a1, a0, 32
3855 ; RV64-NOPOOL-NEXT: add a0, a0, a1
3856 ; RV64-NOPOOL-NEXT: ret
3858 ; RV64I-POOL-LABEL: imm64_same_lo_hi_optsize:
3859 ; RV64I-POOL: # %bb.0:
3860 ; RV64I-POOL-NEXT: lui a0, %hi(.LCPI64_0)
3861 ; RV64I-POOL-NEXT: ld a0, %lo(.LCPI64_0)(a0)
3862 ; RV64I-POOL-NEXT: ret
3864 ; RV64IZBA-LABEL: imm64_same_lo_hi_optsize:
3865 ; RV64IZBA: # %bb.0:
3866 ; RV64IZBA-NEXT: lui a0, 65793
3867 ; RV64IZBA-NEXT: addiw a0, a0, 16
3868 ; RV64IZBA-NEXT: slli a1, a0, 32
3869 ; RV64IZBA-NEXT: add a0, a0, a1
3870 ; RV64IZBA-NEXT: ret
3872 ; RV64IZBB-LABEL: imm64_same_lo_hi_optsize:
3873 ; RV64IZBB: # %bb.0:
3874 ; RV64IZBB-NEXT: lui a0, 65793
3875 ; RV64IZBB-NEXT: addiw a0, a0, 16
3876 ; RV64IZBB-NEXT: slli a1, a0, 32
3877 ; RV64IZBB-NEXT: add a0, a0, a1
3878 ; RV64IZBB-NEXT: ret
3880 ; RV64IZBS-LABEL: imm64_same_lo_hi_optsize:
3881 ; RV64IZBS: # %bb.0:
3882 ; RV64IZBS-NEXT: lui a0, 65793
3883 ; RV64IZBS-NEXT: addiw a0, a0, 16
3884 ; RV64IZBS-NEXT: slli a1, a0, 32
3885 ; RV64IZBS-NEXT: add a0, a0, a1
3886 ; RV64IZBS-NEXT: ret
3888 ; RV64IXTHEADBB-LABEL: imm64_same_lo_hi_optsize:
3889 ; RV64IXTHEADBB: # %bb.0:
3890 ; RV64IXTHEADBB-NEXT: lui a0, 65793
3891 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 16
3892 ; RV64IXTHEADBB-NEXT: slli a1, a0, 32
3893 ; RV64IXTHEADBB-NEXT: add a0, a0, a1
3894 ; RV64IXTHEADBB-NEXT: ret
3896 ; RV32-REMAT-LABEL: imm64_same_lo_hi_optsize:
3897 ; RV32-REMAT: # %bb.0:
3898 ; RV32-REMAT-NEXT: lui a0, 65793
3899 ; RV32-REMAT-NEXT: addi a0, a0, 16
3900 ; RV32-REMAT-NEXT: mv a1, a0
3901 ; RV32-REMAT-NEXT: ret
3903 ; RV64-REMAT-LABEL: imm64_same_lo_hi_optsize:
3904 ; RV64-REMAT: # %bb.0:
3905 ; RV64-REMAT-NEXT: lui a0, 65793
3906 ; RV64-REMAT-NEXT: addiw a0, a0, 16
3907 ; RV64-REMAT-NEXT: slli a1, a0, 32
3908 ; RV64-REMAT-NEXT: add a0, a0, a1
3909 ; RV64-REMAT-NEXT: ret
3910 ret i64 1157442765409226768 ; 0x0101010101010101
3913 ; Hi and lo are the same and also negative.
3914 define i64 @imm64_same_lo_hi_negative() nounwind {
3915 ; RV32I-LABEL: imm64_same_lo_hi_negative:
3917 ; RV32I-NEXT: lui a0, 526344
3918 ; RV32I-NEXT: addi a0, a0, 128
3919 ; RV32I-NEXT: mv a1, a0
3922 ; RV64-NOPOOL-LABEL: imm64_same_lo_hi_negative:
3923 ; RV64-NOPOOL: # %bb.0:
3924 ; RV64-NOPOOL-NEXT: lui a0, 983297
3925 ; RV64-NOPOOL-NEXT: slli a0, a0, 4
3926 ; RV64-NOPOOL-NEXT: addi a0, a0, 257
3927 ; RV64-NOPOOL-NEXT: slli a0, a0, 16
3928 ; RV64-NOPOOL-NEXT: addi a0, a0, 257
3929 ; RV64-NOPOOL-NEXT: slli a0, a0, 15
3930 ; RV64-NOPOOL-NEXT: addi a0, a0, 128
3931 ; RV64-NOPOOL-NEXT: ret
3933 ; RV64I-POOL-LABEL: imm64_same_lo_hi_negative:
3934 ; RV64I-POOL: # %bb.0:
3935 ; RV64I-POOL-NEXT: lui a0, %hi(.LCPI65_0)
3936 ; RV64I-POOL-NEXT: ld a0, %lo(.LCPI65_0)(a0)
3937 ; RV64I-POOL-NEXT: ret
3939 ; RV64IZBA-LABEL: imm64_same_lo_hi_negative:
3940 ; RV64IZBA: # %bb.0:
3941 ; RV64IZBA-NEXT: lui a0, 526344
3942 ; RV64IZBA-NEXT: addi a0, a0, 128
3943 ; RV64IZBA-NEXT: slli a1, a0, 32
3944 ; RV64IZBA-NEXT: add.uw a0, a0, a1
3945 ; RV64IZBA-NEXT: ret
3947 ; RV64IZBB-LABEL: imm64_same_lo_hi_negative:
3948 ; RV64IZBB: # %bb.0:
3949 ; RV64IZBB-NEXT: lui a0, 983297
3950 ; RV64IZBB-NEXT: slli a0, a0, 4
3951 ; RV64IZBB-NEXT: addi a0, a0, 257
3952 ; RV64IZBB-NEXT: slli a0, a0, 16
3953 ; RV64IZBB-NEXT: addi a0, a0, 257
3954 ; RV64IZBB-NEXT: slli a0, a0, 15
3955 ; RV64IZBB-NEXT: addi a0, a0, 128
3956 ; RV64IZBB-NEXT: ret
3958 ; RV64IZBS-LABEL: imm64_same_lo_hi_negative:
3959 ; RV64IZBS: # %bb.0:
3960 ; RV64IZBS-NEXT: lui a0, 983297
3961 ; RV64IZBS-NEXT: slli a0, a0, 4
3962 ; RV64IZBS-NEXT: addi a0, a0, 257
3963 ; RV64IZBS-NEXT: slli a0, a0, 16
3964 ; RV64IZBS-NEXT: addi a0, a0, 257
3965 ; RV64IZBS-NEXT: slli a0, a0, 15
3966 ; RV64IZBS-NEXT: addi a0, a0, 128
3967 ; RV64IZBS-NEXT: ret
3969 ; RV64IXTHEADBB-LABEL: imm64_same_lo_hi_negative:
3970 ; RV64IXTHEADBB: # %bb.0:
3971 ; RV64IXTHEADBB-NEXT: lui a0, 983297
3972 ; RV64IXTHEADBB-NEXT: slli a0, a0, 4
3973 ; RV64IXTHEADBB-NEXT: addi a0, a0, 257
3974 ; RV64IXTHEADBB-NEXT: slli a0, a0, 16
3975 ; RV64IXTHEADBB-NEXT: addi a0, a0, 257
3976 ; RV64IXTHEADBB-NEXT: slli a0, a0, 15
3977 ; RV64IXTHEADBB-NEXT: addi a0, a0, 128
3978 ; RV64IXTHEADBB-NEXT: ret
3980 ; RV32-REMAT-LABEL: imm64_same_lo_hi_negative:
3981 ; RV32-REMAT: # %bb.0:
3982 ; RV32-REMAT-NEXT: lui a0, 526344
3983 ; RV32-REMAT-NEXT: addi a0, a0, 128
3984 ; RV32-REMAT-NEXT: mv a1, a0
3985 ; RV32-REMAT-NEXT: ret
3987 ; RV64-REMAT-LABEL: imm64_same_lo_hi_negative:
3988 ; RV64-REMAT: # %bb.0:
3989 ; RV64-REMAT-NEXT: lui a0, 983297
3990 ; RV64-REMAT-NEXT: slli a0, a0, 4
3991 ; RV64-REMAT-NEXT: addi a0, a0, 257
3992 ; RV64-REMAT-NEXT: slli a0, a0, 16
3993 ; RV64-REMAT-NEXT: addi a0, a0, 257
3994 ; RV64-REMAT-NEXT: slli a0, a0, 15
3995 ; RV64-REMAT-NEXT: addi a0, a0, 128
3996 ; RV64-REMAT-NEXT: ret
3997 ret i64 9259542123273814144 ; 0x8080808080808080