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 define void @imm_store_i16_neg1(ptr %p) nounwind {
1562 ; RV32I-LABEL: imm_store_i16_neg1:
1564 ; RV32I-NEXT: li a1, -1
1565 ; RV32I-NEXT: sh a1, 0(a0)
1568 ; RV64I-LABEL: imm_store_i16_neg1:
1570 ; RV64I-NEXT: li a1, -1
1571 ; RV64I-NEXT: sh a1, 0(a0)
1574 ; RV64IZBA-LABEL: imm_store_i16_neg1:
1575 ; RV64IZBA: # %bb.0:
1576 ; RV64IZBA-NEXT: li a1, -1
1577 ; RV64IZBA-NEXT: sh a1, 0(a0)
1578 ; RV64IZBA-NEXT: ret
1580 ; RV64IZBB-LABEL: imm_store_i16_neg1:
1581 ; RV64IZBB: # %bb.0:
1582 ; RV64IZBB-NEXT: li a1, -1
1583 ; RV64IZBB-NEXT: sh a1, 0(a0)
1584 ; RV64IZBB-NEXT: ret
1586 ; RV64IZBS-LABEL: imm_store_i16_neg1:
1587 ; RV64IZBS: # %bb.0:
1588 ; RV64IZBS-NEXT: li a1, -1
1589 ; RV64IZBS-NEXT: sh a1, 0(a0)
1590 ; RV64IZBS-NEXT: ret
1592 ; RV64IXTHEADBB-LABEL: imm_store_i16_neg1:
1593 ; RV64IXTHEADBB: # %bb.0:
1594 ; RV64IXTHEADBB-NEXT: li a1, -1
1595 ; RV64IXTHEADBB-NEXT: sh a1, 0(a0)
1596 ; RV64IXTHEADBB-NEXT: ret
1598 ; RV32-REMAT-LABEL: imm_store_i16_neg1:
1599 ; RV32-REMAT: # %bb.0:
1600 ; RV32-REMAT-NEXT: li a1, -1
1601 ; RV32-REMAT-NEXT: sh a1, 0(a0)
1602 ; RV32-REMAT-NEXT: ret
1604 ; RV64-REMAT-LABEL: imm_store_i16_neg1:
1605 ; RV64-REMAT: # %bb.0:
1606 ; RV64-REMAT-NEXT: li a1, -1
1607 ; RV64-REMAT-NEXT: sh a1, 0(a0)
1608 ; RV64-REMAT-NEXT: ret
1609 store i16 -1, ptr %p
1613 define void @imm_store_i32_neg1(ptr %p) nounwind {
1614 ; RV32I-LABEL: imm_store_i32_neg1:
1616 ; RV32I-NEXT: li a1, -1
1617 ; RV32I-NEXT: sw a1, 0(a0)
1620 ; RV64I-LABEL: imm_store_i32_neg1:
1622 ; RV64I-NEXT: li a1, -1
1623 ; RV64I-NEXT: sw a1, 0(a0)
1626 ; RV64IZBA-LABEL: imm_store_i32_neg1:
1627 ; RV64IZBA: # %bb.0:
1628 ; RV64IZBA-NEXT: li a1, -1
1629 ; RV64IZBA-NEXT: sw a1, 0(a0)
1630 ; RV64IZBA-NEXT: ret
1632 ; RV64IZBB-LABEL: imm_store_i32_neg1:
1633 ; RV64IZBB: # %bb.0:
1634 ; RV64IZBB-NEXT: li a1, -1
1635 ; RV64IZBB-NEXT: sw a1, 0(a0)
1636 ; RV64IZBB-NEXT: ret
1638 ; RV64IZBS-LABEL: imm_store_i32_neg1:
1639 ; RV64IZBS: # %bb.0:
1640 ; RV64IZBS-NEXT: li a1, -1
1641 ; RV64IZBS-NEXT: sw a1, 0(a0)
1642 ; RV64IZBS-NEXT: ret
1644 ; RV64IXTHEADBB-LABEL: imm_store_i32_neg1:
1645 ; RV64IXTHEADBB: # %bb.0:
1646 ; RV64IXTHEADBB-NEXT: li a1, -1
1647 ; RV64IXTHEADBB-NEXT: sw a1, 0(a0)
1648 ; RV64IXTHEADBB-NEXT: ret
1650 ; RV32-REMAT-LABEL: imm_store_i32_neg1:
1651 ; RV32-REMAT: # %bb.0:
1652 ; RV32-REMAT-NEXT: li a1, -1
1653 ; RV32-REMAT-NEXT: sw a1, 0(a0)
1654 ; RV32-REMAT-NEXT: ret
1656 ; RV64-REMAT-LABEL: imm_store_i32_neg1:
1657 ; RV64-REMAT: # %bb.0:
1658 ; RV64-REMAT-NEXT: li a1, -1
1659 ; RV64-REMAT-NEXT: sw a1, 0(a0)
1660 ; RV64-REMAT-NEXT: ret
1661 store i32 -1, ptr %p
1665 define i64 @imm_5372288229() {
1666 ; RV32I-LABEL: imm_5372288229:
1668 ; RV32I-NEXT: lui a0, 263018
1669 ; RV32I-NEXT: addi a0, a0, -795
1670 ; RV32I-NEXT: li a1, 1
1673 ; RV64I-LABEL: imm_5372288229:
1675 ; RV64I-NEXT: lui a0, 160
1676 ; RV64I-NEXT: addiw a0, a0, 437
1677 ; RV64I-NEXT: slli a0, a0, 13
1678 ; RV64I-NEXT: addi a0, a0, -795
1681 ; RV64IZBA-LABEL: imm_5372288229:
1682 ; RV64IZBA: # %bb.0:
1683 ; RV64IZBA-NEXT: lui a0, 655797
1684 ; RV64IZBA-NEXT: slli.uw a0, a0, 1
1685 ; RV64IZBA-NEXT: addi a0, a0, -795
1686 ; RV64IZBA-NEXT: ret
1688 ; RV64IZBB-LABEL: imm_5372288229:
1689 ; RV64IZBB: # %bb.0:
1690 ; RV64IZBB-NEXT: lui a0, 160
1691 ; RV64IZBB-NEXT: addiw a0, a0, 437
1692 ; RV64IZBB-NEXT: slli a0, a0, 13
1693 ; RV64IZBB-NEXT: addi a0, a0, -795
1694 ; RV64IZBB-NEXT: ret
1696 ; RV64IZBS-LABEL: imm_5372288229:
1697 ; RV64IZBS: # %bb.0:
1698 ; RV64IZBS-NEXT: lui a0, 263018
1699 ; RV64IZBS-NEXT: addiw a0, a0, -795
1700 ; RV64IZBS-NEXT: bseti a0, a0, 32
1701 ; RV64IZBS-NEXT: ret
1703 ; RV64IXTHEADBB-LABEL: imm_5372288229:
1704 ; RV64IXTHEADBB: # %bb.0:
1705 ; RV64IXTHEADBB-NEXT: lui a0, 160
1706 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 437
1707 ; RV64IXTHEADBB-NEXT: slli a0, a0, 13
1708 ; RV64IXTHEADBB-NEXT: addi a0, a0, -795
1709 ; RV64IXTHEADBB-NEXT: ret
1711 ; RV32-REMAT-LABEL: imm_5372288229:
1712 ; RV32-REMAT: # %bb.0:
1713 ; RV32-REMAT-NEXT: lui a0, 263018
1714 ; RV32-REMAT-NEXT: addi a0, a0, -795
1715 ; RV32-REMAT-NEXT: li a1, 1
1716 ; RV32-REMAT-NEXT: ret
1718 ; RV64-REMAT-LABEL: imm_5372288229:
1719 ; RV64-REMAT: # %bb.0:
1720 ; RV64-REMAT-NEXT: lui a0, 160
1721 ; RV64-REMAT-NEXT: addiw a0, a0, 437
1722 ; RV64-REMAT-NEXT: slli a0, a0, 13
1723 ; RV64-REMAT-NEXT: addi a0, a0, -795
1724 ; RV64-REMAT-NEXT: ret
1728 define i64 @imm_neg_5372288229() {
1729 ; RV32I-LABEL: imm_neg_5372288229:
1731 ; RV32I-NEXT: lui a0, 785558
1732 ; RV32I-NEXT: addi a0, a0, 795
1733 ; RV32I-NEXT: li a1, -2
1736 ; RV64I-LABEL: imm_neg_5372288229:
1738 ; RV64I-NEXT: lui a0, 1048416
1739 ; RV64I-NEXT: addiw a0, a0, -437
1740 ; RV64I-NEXT: slli a0, a0, 13
1741 ; RV64I-NEXT: addi a0, a0, 795
1744 ; RV64IZBA-LABEL: imm_neg_5372288229:
1745 ; RV64IZBA: # %bb.0:
1746 ; RV64IZBA-NEXT: lui a0, 611378
1747 ; RV64IZBA-NEXT: addiw a0, a0, 265
1748 ; RV64IZBA-NEXT: sh1add a0, a0, a0
1749 ; RV64IZBA-NEXT: ret
1751 ; RV64IZBB-LABEL: imm_neg_5372288229:
1752 ; RV64IZBB: # %bb.0:
1753 ; RV64IZBB-NEXT: lui a0, 1048416
1754 ; RV64IZBB-NEXT: addiw a0, a0, -437
1755 ; RV64IZBB-NEXT: slli a0, a0, 13
1756 ; RV64IZBB-NEXT: addi a0, a0, 795
1757 ; RV64IZBB-NEXT: ret
1759 ; RV64IZBS-LABEL: imm_neg_5372288229:
1760 ; RV64IZBS: # %bb.0:
1761 ; RV64IZBS-NEXT: lui a0, 785558
1762 ; RV64IZBS-NEXT: addiw a0, a0, 795
1763 ; RV64IZBS-NEXT: bclri a0, a0, 32
1764 ; RV64IZBS-NEXT: ret
1766 ; RV64IXTHEADBB-LABEL: imm_neg_5372288229:
1767 ; RV64IXTHEADBB: # %bb.0:
1768 ; RV64IXTHEADBB-NEXT: lui a0, 1048416
1769 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -437
1770 ; RV64IXTHEADBB-NEXT: slli a0, a0, 13
1771 ; RV64IXTHEADBB-NEXT: addi a0, a0, 795
1772 ; RV64IXTHEADBB-NEXT: ret
1774 ; RV32-REMAT-LABEL: imm_neg_5372288229:
1775 ; RV32-REMAT: # %bb.0:
1776 ; RV32-REMAT-NEXT: lui a0, 785558
1777 ; RV32-REMAT-NEXT: addi a0, a0, 795
1778 ; RV32-REMAT-NEXT: li a1, -2
1779 ; RV32-REMAT-NEXT: ret
1781 ; RV64-REMAT-LABEL: imm_neg_5372288229:
1782 ; RV64-REMAT: # %bb.0:
1783 ; RV64-REMAT-NEXT: lui a0, 1048416
1784 ; RV64-REMAT-NEXT: addiw a0, a0, -437
1785 ; RV64-REMAT-NEXT: slli a0, a0, 13
1786 ; RV64-REMAT-NEXT: addi a0, a0, 795
1787 ; RV64-REMAT-NEXT: ret
1791 define i64 @imm_8953813715() {
1792 ; RV32I-LABEL: imm_8953813715:
1794 ; RV32I-NEXT: lui a0, 88838
1795 ; RV32I-NEXT: addi a0, a0, -1325
1796 ; RV32I-NEXT: li a1, 2
1799 ; RV64I-LABEL: imm_8953813715:
1801 ; RV64I-NEXT: lui a0, 267
1802 ; RV64I-NEXT: addiw a0, a0, -637
1803 ; RV64I-NEXT: slli a0, a0, 13
1804 ; RV64I-NEXT: addi a0, a0, -1325
1807 ; RV64IZBA-LABEL: imm_8953813715:
1808 ; RV64IZBA: # %bb.0:
1809 ; RV64IZBA-NEXT: lui a0, 437198
1810 ; RV64IZBA-NEXT: addiw a0, a0, -265
1811 ; RV64IZBA-NEXT: sh2add a0, a0, a0
1812 ; RV64IZBA-NEXT: ret
1814 ; RV64IZBB-LABEL: imm_8953813715:
1815 ; RV64IZBB: # %bb.0:
1816 ; RV64IZBB-NEXT: lui a0, 267
1817 ; RV64IZBB-NEXT: addiw a0, a0, -637
1818 ; RV64IZBB-NEXT: slli a0, a0, 13
1819 ; RV64IZBB-NEXT: addi a0, a0, -1325
1820 ; RV64IZBB-NEXT: ret
1822 ; RV64IZBS-LABEL: imm_8953813715:
1823 ; RV64IZBS: # %bb.0:
1824 ; RV64IZBS-NEXT: lui a0, 88838
1825 ; RV64IZBS-NEXT: addiw a0, a0, -1325
1826 ; RV64IZBS-NEXT: bseti a0, a0, 33
1827 ; RV64IZBS-NEXT: ret
1829 ; RV64IXTHEADBB-LABEL: imm_8953813715:
1830 ; RV64IXTHEADBB: # %bb.0:
1831 ; RV64IXTHEADBB-NEXT: lui a0, 267
1832 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -637
1833 ; RV64IXTHEADBB-NEXT: slli a0, a0, 13
1834 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1325
1835 ; RV64IXTHEADBB-NEXT: ret
1837 ; RV32-REMAT-LABEL: imm_8953813715:
1838 ; RV32-REMAT: # %bb.0:
1839 ; RV32-REMAT-NEXT: lui a0, 88838
1840 ; RV32-REMAT-NEXT: addi a0, a0, -1325
1841 ; RV32-REMAT-NEXT: li a1, 2
1842 ; RV32-REMAT-NEXT: ret
1844 ; RV64-REMAT-LABEL: imm_8953813715:
1845 ; RV64-REMAT: # %bb.0:
1846 ; RV64-REMAT-NEXT: lui a0, 267
1847 ; RV64-REMAT-NEXT: addiw a0, a0, -637
1848 ; RV64-REMAT-NEXT: slli a0, a0, 13
1849 ; RV64-REMAT-NEXT: addi a0, a0, -1325
1850 ; RV64-REMAT-NEXT: ret
1854 define i64 @imm_neg_8953813715() {
1855 ; RV32I-LABEL: imm_neg_8953813715:
1857 ; RV32I-NEXT: lui a0, 959738
1858 ; RV32I-NEXT: addi a0, a0, 1325
1859 ; RV32I-NEXT: li a1, -3
1862 ; RV64I-LABEL: imm_neg_8953813715:
1864 ; RV64I-NEXT: lui a0, 1048309
1865 ; RV64I-NEXT: addiw a0, a0, 637
1866 ; RV64I-NEXT: slli a0, a0, 13
1867 ; RV64I-NEXT: addi a0, a0, 1325
1870 ; RV64IZBA-LABEL: imm_neg_8953813715:
1871 ; RV64IZBA: # %bb.0:
1872 ; RV64IZBA-NEXT: lui a0, 611378
1873 ; RV64IZBA-NEXT: addiw a0, a0, 265
1874 ; RV64IZBA-NEXT: sh2add a0, a0, a0
1875 ; RV64IZBA-NEXT: ret
1877 ; RV64IZBB-LABEL: imm_neg_8953813715:
1878 ; RV64IZBB: # %bb.0:
1879 ; RV64IZBB-NEXT: lui a0, 1048309
1880 ; RV64IZBB-NEXT: addiw a0, a0, 637
1881 ; RV64IZBB-NEXT: slli a0, a0, 13
1882 ; RV64IZBB-NEXT: addi a0, a0, 1325
1883 ; RV64IZBB-NEXT: ret
1885 ; RV64IZBS-LABEL: imm_neg_8953813715:
1886 ; RV64IZBS: # %bb.0:
1887 ; RV64IZBS-NEXT: lui a0, 959738
1888 ; RV64IZBS-NEXT: addiw a0, a0, 1325
1889 ; RV64IZBS-NEXT: bclri a0, a0, 33
1890 ; RV64IZBS-NEXT: ret
1892 ; RV64IXTHEADBB-LABEL: imm_neg_8953813715:
1893 ; RV64IXTHEADBB: # %bb.0:
1894 ; RV64IXTHEADBB-NEXT: lui a0, 1048309
1895 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 637
1896 ; RV64IXTHEADBB-NEXT: slli a0, a0, 13
1897 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1325
1898 ; RV64IXTHEADBB-NEXT: ret
1900 ; RV32-REMAT-LABEL: imm_neg_8953813715:
1901 ; RV32-REMAT: # %bb.0:
1902 ; RV32-REMAT-NEXT: lui a0, 959738
1903 ; RV32-REMAT-NEXT: addi a0, a0, 1325
1904 ; RV32-REMAT-NEXT: li a1, -3
1905 ; RV32-REMAT-NEXT: ret
1907 ; RV64-REMAT-LABEL: imm_neg_8953813715:
1908 ; RV64-REMAT: # %bb.0:
1909 ; RV64-REMAT-NEXT: lui a0, 1048309
1910 ; RV64-REMAT-NEXT: addiw a0, a0, 637
1911 ; RV64-REMAT-NEXT: slli a0, a0, 13
1912 ; RV64-REMAT-NEXT: addi a0, a0, 1325
1913 ; RV64-REMAT-NEXT: ret
1917 define i64 @imm_16116864687() {
1918 ; RV32I-LABEL: imm_16116864687:
1920 ; RV32I-NEXT: lui a0, 789053
1921 ; RV32I-NEXT: addi a0, a0, 1711
1922 ; RV32I-NEXT: li a1, 3
1925 ; RV64I-LABEL: imm_16116864687:
1927 ; RV64I-NEXT: lui a0, 961
1928 ; RV64I-NEXT: addiw a0, a0, -1475
1929 ; RV64I-NEXT: slli a0, a0, 12
1930 ; RV64I-NEXT: addi a0, a0, 1711
1933 ; RV64IZBA-LABEL: imm_16116864687:
1934 ; RV64IZBA: # %bb.0:
1935 ; RV64IZBA-NEXT: lui a0, 437198
1936 ; RV64IZBA-NEXT: addiw a0, a0, -265
1937 ; RV64IZBA-NEXT: sh3add a0, a0, a0
1938 ; RV64IZBA-NEXT: ret
1940 ; RV64IZBB-LABEL: imm_16116864687:
1941 ; RV64IZBB: # %bb.0:
1942 ; RV64IZBB-NEXT: lui a0, 961
1943 ; RV64IZBB-NEXT: addiw a0, a0, -1475
1944 ; RV64IZBB-NEXT: slli a0, a0, 12
1945 ; RV64IZBB-NEXT: addi a0, a0, 1711
1946 ; RV64IZBB-NEXT: ret
1948 ; RV64IZBS-LABEL: imm_16116864687:
1949 ; RV64IZBS: # %bb.0:
1950 ; RV64IZBS-NEXT: lui a0, 961
1951 ; RV64IZBS-NEXT: addiw a0, a0, -1475
1952 ; RV64IZBS-NEXT: slli a0, a0, 12
1953 ; RV64IZBS-NEXT: addi a0, a0, 1711
1954 ; RV64IZBS-NEXT: ret
1956 ; RV64IXTHEADBB-LABEL: imm_16116864687:
1957 ; RV64IXTHEADBB: # %bb.0:
1958 ; RV64IXTHEADBB-NEXT: lui a0, 961
1959 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1475
1960 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
1961 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1711
1962 ; RV64IXTHEADBB-NEXT: ret
1964 ; RV32-REMAT-LABEL: imm_16116864687:
1965 ; RV32-REMAT: # %bb.0:
1966 ; RV32-REMAT-NEXT: lui a0, 789053
1967 ; RV32-REMAT-NEXT: addi a0, a0, 1711
1968 ; RV32-REMAT-NEXT: li a1, 3
1969 ; RV32-REMAT-NEXT: ret
1971 ; RV64-REMAT-LABEL: imm_16116864687:
1972 ; RV64-REMAT: # %bb.0:
1973 ; RV64-REMAT-NEXT: lui a0, 961
1974 ; RV64-REMAT-NEXT: addiw a0, a0, -1475
1975 ; RV64-REMAT-NEXT: slli a0, a0, 12
1976 ; RV64-REMAT-NEXT: addi a0, a0, 1711
1977 ; RV64-REMAT-NEXT: ret
1981 define i64 @imm_neg_16116864687() {
1982 ; RV32I-LABEL: imm_neg_16116864687:
1984 ; RV32I-NEXT: lui a0, 259523
1985 ; RV32I-NEXT: addi a0, a0, -1711
1986 ; RV32I-NEXT: li a1, -4
1989 ; RV64I-LABEL: imm_neg_16116864687:
1991 ; RV64I-NEXT: lui a0, 1047615
1992 ; RV64I-NEXT: addiw a0, a0, 1475
1993 ; RV64I-NEXT: slli a0, a0, 12
1994 ; RV64I-NEXT: addi a0, a0, -1711
1997 ; RV64IZBA-LABEL: imm_neg_16116864687:
1998 ; RV64IZBA: # %bb.0:
1999 ; RV64IZBA-NEXT: lui a0, 611378
2000 ; RV64IZBA-NEXT: addiw a0, a0, 265
2001 ; RV64IZBA-NEXT: sh3add a0, a0, a0
2002 ; RV64IZBA-NEXT: ret
2004 ; RV64IZBB-LABEL: imm_neg_16116864687:
2005 ; RV64IZBB: # %bb.0:
2006 ; RV64IZBB-NEXT: lui a0, 1047615
2007 ; RV64IZBB-NEXT: addiw a0, a0, 1475
2008 ; RV64IZBB-NEXT: slli a0, a0, 12
2009 ; RV64IZBB-NEXT: addi a0, a0, -1711
2010 ; RV64IZBB-NEXT: ret
2012 ; RV64IZBS-LABEL: imm_neg_16116864687:
2013 ; RV64IZBS: # %bb.0:
2014 ; RV64IZBS-NEXT: lui a0, 1047615
2015 ; RV64IZBS-NEXT: addiw a0, a0, 1475
2016 ; RV64IZBS-NEXT: slli a0, a0, 12
2017 ; RV64IZBS-NEXT: addi a0, a0, -1711
2018 ; RV64IZBS-NEXT: ret
2020 ; RV64IXTHEADBB-LABEL: imm_neg_16116864687:
2021 ; RV64IXTHEADBB: # %bb.0:
2022 ; RV64IXTHEADBB-NEXT: lui a0, 1047615
2023 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 1475
2024 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
2025 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1711
2026 ; RV64IXTHEADBB-NEXT: ret
2028 ; RV32-REMAT-LABEL: imm_neg_16116864687:
2029 ; RV32-REMAT: # %bb.0:
2030 ; RV32-REMAT-NEXT: lui a0, 259523
2031 ; RV32-REMAT-NEXT: addi a0, a0, -1711
2032 ; RV32-REMAT-NEXT: li a1, -4
2033 ; RV32-REMAT-NEXT: ret
2035 ; RV64-REMAT-LABEL: imm_neg_16116864687:
2036 ; RV64-REMAT: # %bb.0:
2037 ; RV64-REMAT-NEXT: lui a0, 1047615
2038 ; RV64-REMAT-NEXT: addiw a0, a0, 1475
2039 ; RV64-REMAT-NEXT: slli a0, a0, 12
2040 ; RV64-REMAT-NEXT: addi a0, a0, -1711
2041 ; RV64-REMAT-NEXT: ret
2042 ret i64 -16116864687
2045 define i64 @imm_2344336315() {
2046 ; RV32I-LABEL: imm_2344336315:
2048 ; RV32I-NEXT: lui a0, 572348
2049 ; RV32I-NEXT: addi a0, a0, -1093
2050 ; RV32I-NEXT: li a1, 0
2053 ; RV64I-LABEL: imm_2344336315:
2055 ; RV64I-NEXT: lui a0, 143087
2056 ; RV64I-NEXT: slli a0, a0, 2
2057 ; RV64I-NEXT: addi a0, a0, -1093
2060 ; RV64IZBA-LABEL: imm_2344336315:
2061 ; RV64IZBA: # %bb.0:
2062 ; RV64IZBA-NEXT: lui a0, 143087
2063 ; RV64IZBA-NEXT: slli a0, a0, 2
2064 ; RV64IZBA-NEXT: addi a0, a0, -1093
2065 ; RV64IZBA-NEXT: ret
2067 ; RV64IZBB-LABEL: imm_2344336315:
2068 ; RV64IZBB: # %bb.0:
2069 ; RV64IZBB-NEXT: lui a0, 143087
2070 ; RV64IZBB-NEXT: slli a0, a0, 2
2071 ; RV64IZBB-NEXT: addi a0, a0, -1093
2072 ; RV64IZBB-NEXT: ret
2074 ; RV64IZBS-LABEL: imm_2344336315:
2075 ; RV64IZBS: # %bb.0:
2076 ; RV64IZBS-NEXT: lui a0, 143087
2077 ; RV64IZBS-NEXT: slli a0, a0, 2
2078 ; RV64IZBS-NEXT: addi a0, a0, -1093
2079 ; RV64IZBS-NEXT: ret
2081 ; RV64IXTHEADBB-LABEL: imm_2344336315:
2082 ; RV64IXTHEADBB: # %bb.0:
2083 ; RV64IXTHEADBB-NEXT: lui a0, 143087
2084 ; RV64IXTHEADBB-NEXT: slli a0, a0, 2
2085 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
2086 ; RV64IXTHEADBB-NEXT: ret
2088 ; RV32-REMAT-LABEL: imm_2344336315:
2089 ; RV32-REMAT: # %bb.0:
2090 ; RV32-REMAT-NEXT: lui a0, 572348
2091 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2092 ; RV32-REMAT-NEXT: li a1, 0
2093 ; RV32-REMAT-NEXT: ret
2095 ; RV64-REMAT-LABEL: imm_2344336315:
2096 ; RV64-REMAT: # %bb.0:
2097 ; RV64-REMAT-NEXT: lui a0, 143087
2098 ; RV64-REMAT-NEXT: slli a0, a0, 2
2099 ; RV64-REMAT-NEXT: addi a0, a0, -1093
2100 ; RV64-REMAT-NEXT: ret
2101 ret i64 2344336315 ; 0x8bbbbbbb
2104 define i64 @imm_70370820078523() {
2105 ; RV32I-LABEL: imm_70370820078523:
2107 ; RV32I-NEXT: lui a0, 506812
2108 ; RV32I-NEXT: addi a0, a0, -1093
2109 ; RV32I-NEXT: lui a1, 4
2112 ; RV64-NOPOOL-LABEL: imm_70370820078523:
2113 ; RV64-NOPOOL: # %bb.0:
2114 ; RV64-NOPOOL-NEXT: lui a0, 256
2115 ; RV64-NOPOOL-NEXT: addiw a0, a0, 31
2116 ; RV64-NOPOOL-NEXT: slli a0, a0, 12
2117 ; RV64-NOPOOL-NEXT: addi a0, a0, -273
2118 ; RV64-NOPOOL-NEXT: slli a0, a0, 14
2119 ; RV64-NOPOOL-NEXT: addi a0, a0, -1093
2120 ; RV64-NOPOOL-NEXT: ret
2122 ; RV64I-POOL-LABEL: imm_70370820078523:
2123 ; RV64I-POOL: # %bb.0:
2124 ; RV64I-POOL-NEXT: lui a0, %hi(.LCPI37_0)
2125 ; RV64I-POOL-NEXT: ld a0, %lo(.LCPI37_0)(a0)
2126 ; RV64I-POOL-NEXT: ret
2128 ; RV64IZBA-LABEL: imm_70370820078523:
2129 ; RV64IZBA: # %bb.0:
2130 ; RV64IZBA-NEXT: lui a0, 256
2131 ; RV64IZBA-NEXT: addiw a0, a0, 31
2132 ; RV64IZBA-NEXT: slli a0, a0, 12
2133 ; RV64IZBA-NEXT: addi a0, a0, -273
2134 ; RV64IZBA-NEXT: slli a0, a0, 14
2135 ; RV64IZBA-NEXT: addi a0, a0, -1093
2136 ; RV64IZBA-NEXT: ret
2138 ; RV64IZBB-LABEL: imm_70370820078523:
2139 ; RV64IZBB: # %bb.0:
2140 ; RV64IZBB-NEXT: lui a0, 256
2141 ; RV64IZBB-NEXT: addiw a0, a0, 31
2142 ; RV64IZBB-NEXT: slli a0, a0, 12
2143 ; RV64IZBB-NEXT: addi a0, a0, -273
2144 ; RV64IZBB-NEXT: slli a0, a0, 14
2145 ; RV64IZBB-NEXT: addi a0, a0, -1093
2146 ; RV64IZBB-NEXT: ret
2148 ; RV64IZBS-LABEL: imm_70370820078523:
2149 ; RV64IZBS: # %bb.0:
2150 ; RV64IZBS-NEXT: lui a0, 506812
2151 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2152 ; RV64IZBS-NEXT: bseti a0, a0, 46
2153 ; RV64IZBS-NEXT: ret
2155 ; RV64IXTHEADBB-LABEL: imm_70370820078523:
2156 ; RV64IXTHEADBB: # %bb.0:
2157 ; RV64IXTHEADBB-NEXT: lui a0, 256
2158 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 31
2159 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
2160 ; RV64IXTHEADBB-NEXT: addi a0, a0, -273
2161 ; RV64IXTHEADBB-NEXT: slli a0, a0, 14
2162 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
2163 ; RV64IXTHEADBB-NEXT: ret
2165 ; RV32-REMAT-LABEL: imm_70370820078523:
2166 ; RV32-REMAT: # %bb.0:
2167 ; RV32-REMAT-NEXT: lui a0, 506812
2168 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2169 ; RV32-REMAT-NEXT: lui a1, 4
2170 ; RV32-REMAT-NEXT: ret
2172 ; RV64-REMAT-LABEL: imm_70370820078523:
2173 ; RV64-REMAT: # %bb.0:
2174 ; RV64-REMAT-NEXT: lui a0, 256
2175 ; RV64-REMAT-NEXT: addiw a0, a0, 31
2176 ; RV64-REMAT-NEXT: slli a0, a0, 12
2177 ; RV64-REMAT-NEXT: addi a0, a0, -273
2178 ; RV64-REMAT-NEXT: slli a0, a0, 14
2179 ; RV64-REMAT-NEXT: addi a0, a0, -1093
2180 ; RV64-REMAT-NEXT: ret
2181 ret i64 70370820078523 ; 0x40007bbbbbbb
2184 define i64 @imm_neg_9223372034778874949() {
2185 ; RV32I-LABEL: imm_neg_9223372034778874949:
2187 ; RV32I-NEXT: lui a0, 506812
2188 ; RV32I-NEXT: addi a0, a0, -1093
2189 ; RV32I-NEXT: lui a1, 524288
2192 ; RV64I-LABEL: imm_neg_9223372034778874949:
2194 ; RV64I-NEXT: lui a0, 506812
2195 ; RV64I-NEXT: addiw a0, a0, -1093
2196 ; RV64I-NEXT: slli a1, a0, 63
2197 ; RV64I-NEXT: add a0, a0, a1
2200 ; RV64IZBA-LABEL: imm_neg_9223372034778874949:
2201 ; RV64IZBA: # %bb.0:
2202 ; RV64IZBA-NEXT: lui a0, 506812
2203 ; RV64IZBA-NEXT: addiw a0, a0, -1093
2204 ; RV64IZBA-NEXT: slli a1, a0, 63
2205 ; RV64IZBA-NEXT: add a0, a0, a1
2206 ; RV64IZBA-NEXT: ret
2208 ; RV64IZBB-LABEL: imm_neg_9223372034778874949:
2209 ; RV64IZBB: # %bb.0:
2210 ; RV64IZBB-NEXT: lui a0, 506812
2211 ; RV64IZBB-NEXT: addiw a0, a0, -1093
2212 ; RV64IZBB-NEXT: slli a1, a0, 63
2213 ; RV64IZBB-NEXT: add a0, a0, a1
2214 ; RV64IZBB-NEXT: ret
2216 ; RV64IZBS-LABEL: imm_neg_9223372034778874949:
2217 ; RV64IZBS: # %bb.0:
2218 ; RV64IZBS-NEXT: lui a0, 506812
2219 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2220 ; RV64IZBS-NEXT: bseti a0, a0, 63
2221 ; RV64IZBS-NEXT: ret
2223 ; RV64IXTHEADBB-LABEL: imm_neg_9223372034778874949:
2224 ; RV64IXTHEADBB: # %bb.0:
2225 ; RV64IXTHEADBB-NEXT: lui a0, 506812
2226 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1093
2227 ; RV64IXTHEADBB-NEXT: slli a1, a0, 63
2228 ; RV64IXTHEADBB-NEXT: add a0, a0, a1
2229 ; RV64IXTHEADBB-NEXT: ret
2231 ; RV32-REMAT-LABEL: imm_neg_9223372034778874949:
2232 ; RV32-REMAT: # %bb.0:
2233 ; RV32-REMAT-NEXT: lui a0, 506812
2234 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2235 ; RV32-REMAT-NEXT: lui a1, 524288
2236 ; RV32-REMAT-NEXT: ret
2238 ; RV64-REMAT-LABEL: imm_neg_9223372034778874949:
2239 ; RV64-REMAT: # %bb.0:
2240 ; RV64-REMAT-NEXT: lui a0, 506812
2241 ; RV64-REMAT-NEXT: addiw a0, a0, -1093
2242 ; RV64-REMAT-NEXT: slli a1, a0, 63
2243 ; RV64-REMAT-NEXT: add a0, a0, a1
2244 ; RV64-REMAT-NEXT: ret
2245 ret i64 -9223372034778874949 ; 0x800000007bbbbbbb
2248 define i64 @imm_neg_9223301666034697285() {
2249 ; RV32I-LABEL: imm_neg_9223301666034697285:
2251 ; RV32I-NEXT: lui a0, 506812
2252 ; RV32I-NEXT: addi a0, a0, -1093
2253 ; RV32I-NEXT: lui a1, 524292
2256 ; RV64-NOPOOL-LABEL: imm_neg_9223301666034697285:
2257 ; RV64-NOPOOL: # %bb.0:
2258 ; RV64-NOPOOL-NEXT: lui a0, 917505
2259 ; RV64-NOPOOL-NEXT: slli a0, a0, 8
2260 ; RV64-NOPOOL-NEXT: addi a0, a0, 31
2261 ; RV64-NOPOOL-NEXT: slli a0, a0, 12
2262 ; RV64-NOPOOL-NEXT: addi a0, a0, -273
2263 ; RV64-NOPOOL-NEXT: slli a0, a0, 14
2264 ; RV64-NOPOOL-NEXT: addi a0, a0, -1093
2265 ; RV64-NOPOOL-NEXT: ret
2267 ; RV64I-POOL-LABEL: imm_neg_9223301666034697285:
2268 ; RV64I-POOL: # %bb.0:
2269 ; RV64I-POOL-NEXT: lui a0, %hi(.LCPI39_0)
2270 ; RV64I-POOL-NEXT: ld a0, %lo(.LCPI39_0)(a0)
2271 ; RV64I-POOL-NEXT: ret
2273 ; RV64IZBA-LABEL: imm_neg_9223301666034697285:
2274 ; RV64IZBA: # %bb.0:
2275 ; RV64IZBA-NEXT: lui a0, 917505
2276 ; RV64IZBA-NEXT: slli a0, a0, 8
2277 ; RV64IZBA-NEXT: addi a0, a0, 31
2278 ; RV64IZBA-NEXT: slli a0, a0, 12
2279 ; RV64IZBA-NEXT: addi a0, a0, -273
2280 ; RV64IZBA-NEXT: slli a0, a0, 14
2281 ; RV64IZBA-NEXT: addi a0, a0, -1093
2282 ; RV64IZBA-NEXT: ret
2284 ; RV64IZBB-LABEL: imm_neg_9223301666034697285:
2285 ; RV64IZBB: # %bb.0:
2286 ; RV64IZBB-NEXT: lui a0, 917505
2287 ; RV64IZBB-NEXT: slli a0, a0, 8
2288 ; RV64IZBB-NEXT: addi a0, a0, 31
2289 ; RV64IZBB-NEXT: slli a0, a0, 12
2290 ; RV64IZBB-NEXT: addi a0, a0, -273
2291 ; RV64IZBB-NEXT: slli a0, a0, 14
2292 ; RV64IZBB-NEXT: addi a0, a0, -1093
2293 ; RV64IZBB-NEXT: ret
2295 ; RV64IZBS-LABEL: imm_neg_9223301666034697285:
2296 ; RV64IZBS: # %bb.0:
2297 ; RV64IZBS-NEXT: lui a0, 506812
2298 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2299 ; RV64IZBS-NEXT: bseti a0, a0, 46
2300 ; RV64IZBS-NEXT: bseti a0, a0, 63
2301 ; RV64IZBS-NEXT: ret
2303 ; RV64IXTHEADBB-LABEL: imm_neg_9223301666034697285:
2304 ; RV64IXTHEADBB: # %bb.0:
2305 ; RV64IXTHEADBB-NEXT: lui a0, 917505
2306 ; RV64IXTHEADBB-NEXT: slli a0, a0, 8
2307 ; RV64IXTHEADBB-NEXT: addi a0, a0, 31
2308 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
2309 ; RV64IXTHEADBB-NEXT: addi a0, a0, -273
2310 ; RV64IXTHEADBB-NEXT: slli a0, a0, 14
2311 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
2312 ; RV64IXTHEADBB-NEXT: ret
2314 ; RV32-REMAT-LABEL: imm_neg_9223301666034697285:
2315 ; RV32-REMAT: # %bb.0:
2316 ; RV32-REMAT-NEXT: lui a0, 506812
2317 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2318 ; RV32-REMAT-NEXT: lui a1, 524292
2319 ; RV32-REMAT-NEXT: ret
2321 ; RV64-REMAT-LABEL: imm_neg_9223301666034697285:
2322 ; RV64-REMAT: # %bb.0:
2323 ; RV64-REMAT-NEXT: lui a0, 917505
2324 ; RV64-REMAT-NEXT: slli a0, a0, 8
2325 ; RV64-REMAT-NEXT: addi a0, a0, 31
2326 ; RV64-REMAT-NEXT: slli a0, a0, 12
2327 ; RV64-REMAT-NEXT: addi a0, a0, -273
2328 ; RV64-REMAT-NEXT: slli a0, a0, 14
2329 ; RV64-REMAT-NEXT: addi a0, a0, -1093
2330 ; RV64-REMAT-NEXT: ret
2331 ret i64 -9223301666034697285 ; 0x800040007bbbbbbb
2334 define i64 @imm_neg_2219066437() {
2335 ; RV32I-LABEL: imm_neg_2219066437:
2337 ; RV32I-NEXT: lui a0, 506812
2338 ; RV32I-NEXT: addi a0, a0, -1093
2339 ; RV32I-NEXT: li a1, -1
2342 ; RV64I-LABEL: imm_neg_2219066437:
2344 ; RV64I-NEXT: lui a0, 913135
2345 ; RV64I-NEXT: slli a0, a0, 2
2346 ; RV64I-NEXT: addi a0, a0, -1093
2349 ; RV64IZBA-LABEL: imm_neg_2219066437:
2350 ; RV64IZBA: # %bb.0:
2351 ; RV64IZBA-NEXT: lui a0, 913135
2352 ; RV64IZBA-NEXT: slli a0, a0, 2
2353 ; RV64IZBA-NEXT: addi a0, a0, -1093
2354 ; RV64IZBA-NEXT: ret
2356 ; RV64IZBB-LABEL: imm_neg_2219066437:
2357 ; RV64IZBB: # %bb.0:
2358 ; RV64IZBB-NEXT: lui a0, 913135
2359 ; RV64IZBB-NEXT: slli a0, a0, 2
2360 ; RV64IZBB-NEXT: addi a0, a0, -1093
2361 ; RV64IZBB-NEXT: ret
2363 ; RV64IZBS-LABEL: imm_neg_2219066437:
2364 ; RV64IZBS: # %bb.0:
2365 ; RV64IZBS-NEXT: lui a0, 913135
2366 ; RV64IZBS-NEXT: slli a0, a0, 2
2367 ; RV64IZBS-NEXT: addi a0, a0, -1093
2368 ; RV64IZBS-NEXT: ret
2370 ; RV64IXTHEADBB-LABEL: imm_neg_2219066437:
2371 ; RV64IXTHEADBB: # %bb.0:
2372 ; RV64IXTHEADBB-NEXT: lui a0, 913135
2373 ; RV64IXTHEADBB-NEXT: slli a0, a0, 2
2374 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
2375 ; RV64IXTHEADBB-NEXT: ret
2377 ; RV32-REMAT-LABEL: imm_neg_2219066437:
2378 ; RV32-REMAT: # %bb.0:
2379 ; RV32-REMAT-NEXT: lui a0, 506812
2380 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2381 ; RV32-REMAT-NEXT: li a1, -1
2382 ; RV32-REMAT-NEXT: ret
2384 ; RV64-REMAT-LABEL: imm_neg_2219066437:
2385 ; RV64-REMAT: # %bb.0:
2386 ; RV64-REMAT-NEXT: lui a0, 913135
2387 ; RV64-REMAT-NEXT: slli a0, a0, 2
2388 ; RV64-REMAT-NEXT: addi a0, a0, -1093
2389 ; RV64-REMAT-NEXT: ret
2390 ret i64 -2219066437 ; 0xffffffff7bbbbbbb
2393 define i64 @imm_neg_8798043653189() {
2394 ; RV32I-LABEL: imm_neg_8798043653189:
2396 ; RV32I-NEXT: lui a0, 572348
2397 ; RV32I-NEXT: addi a0, a0, -1093
2398 ; RV32I-NEXT: lui a1, 1048575
2399 ; RV32I-NEXT: addi a1, a1, 2047
2402 ; RV64I-LABEL: imm_neg_8798043653189:
2404 ; RV64I-NEXT: lui a0, 917475
2405 ; RV64I-NEXT: addiw a0, a0, -273
2406 ; RV64I-NEXT: slli a0, a0, 14
2407 ; RV64I-NEXT: addi a0, a0, -1093
2410 ; RV64IZBA-LABEL: imm_neg_8798043653189:
2411 ; RV64IZBA: # %bb.0:
2412 ; RV64IZBA-NEXT: lui a0, 917475
2413 ; RV64IZBA-NEXT: addiw a0, a0, -273
2414 ; RV64IZBA-NEXT: slli a0, a0, 14
2415 ; RV64IZBA-NEXT: addi a0, a0, -1093
2416 ; RV64IZBA-NEXT: ret
2418 ; RV64IZBB-LABEL: imm_neg_8798043653189:
2419 ; RV64IZBB: # %bb.0:
2420 ; RV64IZBB-NEXT: lui a0, 917475
2421 ; RV64IZBB-NEXT: addiw a0, a0, -273
2422 ; RV64IZBB-NEXT: slli a0, a0, 14
2423 ; RV64IZBB-NEXT: addi a0, a0, -1093
2424 ; RV64IZBB-NEXT: ret
2426 ; RV64IZBS-LABEL: imm_neg_8798043653189:
2427 ; RV64IZBS: # %bb.0:
2428 ; RV64IZBS-NEXT: lui a0, 572348
2429 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2430 ; RV64IZBS-NEXT: bclri a0, a0, 43
2431 ; RV64IZBS-NEXT: ret
2433 ; RV64IXTHEADBB-LABEL: imm_neg_8798043653189:
2434 ; RV64IXTHEADBB: # %bb.0:
2435 ; RV64IXTHEADBB-NEXT: lui a0, 917475
2436 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -273
2437 ; RV64IXTHEADBB-NEXT: slli a0, a0, 14
2438 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
2439 ; RV64IXTHEADBB-NEXT: ret
2441 ; RV32-REMAT-LABEL: imm_neg_8798043653189:
2442 ; RV32-REMAT: # %bb.0:
2443 ; RV32-REMAT-NEXT: lui a0, 572348
2444 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2445 ; RV32-REMAT-NEXT: lui a1, 1048575
2446 ; RV32-REMAT-NEXT: addi a1, a1, 2047
2447 ; RV32-REMAT-NEXT: ret
2449 ; RV64-REMAT-LABEL: imm_neg_8798043653189:
2450 ; RV64-REMAT: # %bb.0:
2451 ; RV64-REMAT-NEXT: lui a0, 917475
2452 ; RV64-REMAT-NEXT: addiw a0, a0, -273
2453 ; RV64-REMAT-NEXT: slli a0, a0, 14
2454 ; RV64-REMAT-NEXT: addi a0, a0, -1093
2455 ; RV64-REMAT-NEXT: ret
2456 ret i64 -8798043653189 ; 0xfffff7ff8bbbbbbb
2459 define i64 @imm_9223372034904144827() {
2460 ; RV32I-LABEL: imm_9223372034904144827:
2462 ; RV32I-NEXT: lui a0, 572348
2463 ; RV32I-NEXT: addi a0, a0, -1093
2464 ; RV32I-NEXT: lui a1, 524288
2465 ; RV32I-NEXT: addi a1, a1, -1
2468 ; RV64I-LABEL: imm_9223372034904144827:
2470 ; RV64I-NEXT: lui a0, 572348
2471 ; RV64I-NEXT: addiw a0, a0, -1093
2472 ; RV64I-NEXT: slli a1, a0, 63
2473 ; RV64I-NEXT: add a0, a0, a1
2476 ; RV64IZBA-LABEL: imm_9223372034904144827:
2477 ; RV64IZBA: # %bb.0:
2478 ; RV64IZBA-NEXT: lui a0, 572348
2479 ; RV64IZBA-NEXT: addiw a0, a0, -1093
2480 ; RV64IZBA-NEXT: slli a1, a0, 63
2481 ; RV64IZBA-NEXT: add a0, a0, a1
2482 ; RV64IZBA-NEXT: ret
2484 ; RV64IZBB-LABEL: imm_9223372034904144827:
2485 ; RV64IZBB: # %bb.0:
2486 ; RV64IZBB-NEXT: lui a0, 572348
2487 ; RV64IZBB-NEXT: addiw a0, a0, -1093
2488 ; RV64IZBB-NEXT: slli a1, a0, 63
2489 ; RV64IZBB-NEXT: add a0, a0, a1
2490 ; RV64IZBB-NEXT: ret
2492 ; RV64IZBS-LABEL: imm_9223372034904144827:
2493 ; RV64IZBS: # %bb.0:
2494 ; RV64IZBS-NEXT: lui a0, 572348
2495 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2496 ; RV64IZBS-NEXT: bclri a0, a0, 63
2497 ; RV64IZBS-NEXT: ret
2499 ; RV64IXTHEADBB-LABEL: imm_9223372034904144827:
2500 ; RV64IXTHEADBB: # %bb.0:
2501 ; RV64IXTHEADBB-NEXT: lui a0, 572348
2502 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1093
2503 ; RV64IXTHEADBB-NEXT: slli a1, a0, 63
2504 ; RV64IXTHEADBB-NEXT: add a0, a0, a1
2505 ; RV64IXTHEADBB-NEXT: ret
2507 ; RV32-REMAT-LABEL: imm_9223372034904144827:
2508 ; RV32-REMAT: # %bb.0:
2509 ; RV32-REMAT-NEXT: lui a0, 572348
2510 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2511 ; RV32-REMAT-NEXT: lui a1, 524288
2512 ; RV32-REMAT-NEXT: addi a1, a1, -1
2513 ; RV32-REMAT-NEXT: ret
2515 ; RV64-REMAT-LABEL: imm_9223372034904144827:
2516 ; RV64-REMAT: # %bb.0:
2517 ; RV64-REMAT-NEXT: lui a0, 572348
2518 ; RV64-REMAT-NEXT: addiw a0, a0, -1093
2519 ; RV64-REMAT-NEXT: slli a1, a0, 63
2520 ; RV64-REMAT-NEXT: add a0, a0, a1
2521 ; RV64-REMAT-NEXT: ret
2522 ret i64 9223372034904144827 ; 0x7fffffff8bbbbbbb
2525 define i64 @imm_neg_9223354442718100411() {
2526 ; RV32I-LABEL: imm_neg_9223354442718100411:
2528 ; RV32I-NEXT: lui a0, 572348
2529 ; RV32I-NEXT: addi a0, a0, -1093
2530 ; RV32I-NEXT: lui a1, 524287
2531 ; RV32I-NEXT: addi a1, a1, -1
2534 ; RV64-NOPOOL-LABEL: imm_neg_9223354442718100411:
2535 ; RV64-NOPOOL: # %bb.0:
2536 ; RV64-NOPOOL-NEXT: lui a0, 524287
2537 ; RV64-NOPOOL-NEXT: slli a0, a0, 6
2538 ; RV64-NOPOOL-NEXT: addi a0, a0, -29
2539 ; RV64-NOPOOL-NEXT: slli a0, a0, 12
2540 ; RV64-NOPOOL-NEXT: addi a0, a0, -273
2541 ; RV64-NOPOOL-NEXT: slli a0, a0, 14
2542 ; RV64-NOPOOL-NEXT: addi a0, a0, -1093
2543 ; RV64-NOPOOL-NEXT: ret
2545 ; RV64I-POOL-LABEL: imm_neg_9223354442718100411:
2546 ; RV64I-POOL: # %bb.0:
2547 ; RV64I-POOL-NEXT: lui a0, %hi(.LCPI43_0)
2548 ; RV64I-POOL-NEXT: ld a0, %lo(.LCPI43_0)(a0)
2549 ; RV64I-POOL-NEXT: ret
2551 ; RV64IZBA-LABEL: imm_neg_9223354442718100411:
2552 ; RV64IZBA: # %bb.0:
2553 ; RV64IZBA-NEXT: lui a0, 524287
2554 ; RV64IZBA-NEXT: slli a0, a0, 6
2555 ; RV64IZBA-NEXT: addi a0, a0, -29
2556 ; RV64IZBA-NEXT: slli a0, a0, 12
2557 ; RV64IZBA-NEXT: addi a0, a0, -273
2558 ; RV64IZBA-NEXT: slli a0, a0, 14
2559 ; RV64IZBA-NEXT: addi a0, a0, -1093
2560 ; RV64IZBA-NEXT: ret
2562 ; RV64IZBB-LABEL: imm_neg_9223354442718100411:
2563 ; RV64IZBB: # %bb.0:
2564 ; RV64IZBB-NEXT: lui a0, 524287
2565 ; RV64IZBB-NEXT: slli a0, a0, 6
2566 ; RV64IZBB-NEXT: addi a0, a0, -29
2567 ; RV64IZBB-NEXT: slli a0, a0, 12
2568 ; RV64IZBB-NEXT: addi a0, a0, -273
2569 ; RV64IZBB-NEXT: slli a0, a0, 14
2570 ; RV64IZBB-NEXT: addi a0, a0, -1093
2571 ; RV64IZBB-NEXT: ret
2573 ; RV64IZBS-LABEL: imm_neg_9223354442718100411:
2574 ; RV64IZBS: # %bb.0:
2575 ; RV64IZBS-NEXT: lui a0, 572348
2576 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2577 ; RV64IZBS-NEXT: bclri a0, a0, 44
2578 ; RV64IZBS-NEXT: bclri a0, a0, 63
2579 ; RV64IZBS-NEXT: ret
2581 ; RV64IXTHEADBB-LABEL: imm_neg_9223354442718100411:
2582 ; RV64IXTHEADBB: # %bb.0:
2583 ; RV64IXTHEADBB-NEXT: lui a0, 524287
2584 ; RV64IXTHEADBB-NEXT: slli a0, a0, 6
2585 ; RV64IXTHEADBB-NEXT: addi a0, a0, -29
2586 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
2587 ; RV64IXTHEADBB-NEXT: addi a0, a0, -273
2588 ; RV64IXTHEADBB-NEXT: slli a0, a0, 14
2589 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
2590 ; RV64IXTHEADBB-NEXT: ret
2592 ; RV32-REMAT-LABEL: imm_neg_9223354442718100411:
2593 ; RV32-REMAT: # %bb.0:
2594 ; RV32-REMAT-NEXT: lui a0, 572348
2595 ; RV32-REMAT-NEXT: addi a0, a0, -1093
2596 ; RV32-REMAT-NEXT: lui a1, 524287
2597 ; RV32-REMAT-NEXT: addi a1, a1, -1
2598 ; RV32-REMAT-NEXT: ret
2600 ; RV64-REMAT-LABEL: imm_neg_9223354442718100411:
2601 ; RV64-REMAT: # %bb.0:
2602 ; RV64-REMAT-NEXT: lui a0, 524287
2603 ; RV64-REMAT-NEXT: slli a0, a0, 6
2604 ; RV64-REMAT-NEXT: addi a0, a0, -29
2605 ; RV64-REMAT-NEXT: slli a0, a0, 12
2606 ; RV64-REMAT-NEXT: addi a0, a0, -273
2607 ; RV64-REMAT-NEXT: slli a0, a0, 14
2608 ; RV64-REMAT-NEXT: addi a0, a0, -1093
2609 ; RV64-REMAT-NEXT: ret
2610 ret i64 9223354442718100411 ; 0x7fffefff8bbbbbbb
2613 define i64 @imm_2863311530() {
2614 ; RV32I-LABEL: imm_2863311530:
2616 ; RV32I-NEXT: lui a0, 699051
2617 ; RV32I-NEXT: addi a0, a0, -1366
2618 ; RV32I-NEXT: li a1, 0
2621 ; RV64I-LABEL: imm_2863311530:
2623 ; RV64I-NEXT: lui a0, 349525
2624 ; RV64I-NEXT: addiw a0, a0, 1365
2625 ; RV64I-NEXT: slli a0, a0, 1
2628 ; RV64IZBA-LABEL: imm_2863311530:
2629 ; RV64IZBA: # %bb.0:
2630 ; RV64IZBA-NEXT: lui a0, 349525
2631 ; RV64IZBA-NEXT: addiw a0, a0, 1365
2632 ; RV64IZBA-NEXT: slli a0, a0, 1
2633 ; RV64IZBA-NEXT: ret
2635 ; RV64IZBB-LABEL: imm_2863311530:
2636 ; RV64IZBB: # %bb.0:
2637 ; RV64IZBB-NEXT: lui a0, 349525
2638 ; RV64IZBB-NEXT: addiw a0, a0, 1365
2639 ; RV64IZBB-NEXT: slli a0, a0, 1
2640 ; RV64IZBB-NEXT: ret
2642 ; RV64IZBS-LABEL: imm_2863311530:
2643 ; RV64IZBS: # %bb.0:
2644 ; RV64IZBS-NEXT: lui a0, 349525
2645 ; RV64IZBS-NEXT: addiw a0, a0, 1365
2646 ; RV64IZBS-NEXT: slli a0, a0, 1
2647 ; RV64IZBS-NEXT: ret
2649 ; RV64IXTHEADBB-LABEL: imm_2863311530:
2650 ; RV64IXTHEADBB: # %bb.0:
2651 ; RV64IXTHEADBB-NEXT: lui a0, 349525
2652 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 1365
2653 ; RV64IXTHEADBB-NEXT: slli a0, a0, 1
2654 ; RV64IXTHEADBB-NEXT: ret
2656 ; RV32-REMAT-LABEL: imm_2863311530:
2657 ; RV32-REMAT: # %bb.0:
2658 ; RV32-REMAT-NEXT: lui a0, 699051
2659 ; RV32-REMAT-NEXT: addi a0, a0, -1366
2660 ; RV32-REMAT-NEXT: li a1, 0
2661 ; RV32-REMAT-NEXT: ret
2663 ; RV64-REMAT-LABEL: imm_2863311530:
2664 ; RV64-REMAT: # %bb.0:
2665 ; RV64-REMAT-NEXT: lui a0, 349525
2666 ; RV64-REMAT-NEXT: addiw a0, a0, 1365
2667 ; RV64-REMAT-NEXT: slli a0, a0, 1
2668 ; RV64-REMAT-NEXT: ret
2669 ret i64 2863311530 ; #0xaaaaaaaa
2672 define i64 @imm_neg_2863311530() {
2673 ; RV32I-LABEL: imm_neg_2863311530:
2675 ; RV32I-NEXT: lui a0, 349525
2676 ; RV32I-NEXT: addi a0, a0, 1366
2677 ; RV32I-NEXT: li a1, -1
2680 ; RV64I-LABEL: imm_neg_2863311530:
2682 ; RV64I-NEXT: lui a0, 699051
2683 ; RV64I-NEXT: addiw a0, a0, -1365
2684 ; RV64I-NEXT: slli a0, a0, 1
2687 ; RV64IZBA-LABEL: imm_neg_2863311530:
2688 ; RV64IZBA: # %bb.0:
2689 ; RV64IZBA-NEXT: lui a0, 699051
2690 ; RV64IZBA-NEXT: addiw a0, a0, -1365
2691 ; RV64IZBA-NEXT: slli a0, a0, 1
2692 ; RV64IZBA-NEXT: ret
2694 ; RV64IZBB-LABEL: imm_neg_2863311530:
2695 ; RV64IZBB: # %bb.0:
2696 ; RV64IZBB-NEXT: lui a0, 699051
2697 ; RV64IZBB-NEXT: addiw a0, a0, -1365
2698 ; RV64IZBB-NEXT: slli a0, a0, 1
2699 ; RV64IZBB-NEXT: ret
2701 ; RV64IZBS-LABEL: imm_neg_2863311530:
2702 ; RV64IZBS: # %bb.0:
2703 ; RV64IZBS-NEXT: lui a0, 699051
2704 ; RV64IZBS-NEXT: addiw a0, a0, -1365
2705 ; RV64IZBS-NEXT: slli a0, a0, 1
2706 ; RV64IZBS-NEXT: ret
2708 ; RV64IXTHEADBB-LABEL: imm_neg_2863311530:
2709 ; RV64IXTHEADBB: # %bb.0:
2710 ; RV64IXTHEADBB-NEXT: lui a0, 699051
2711 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1365
2712 ; RV64IXTHEADBB-NEXT: slli a0, a0, 1
2713 ; RV64IXTHEADBB-NEXT: ret
2715 ; RV32-REMAT-LABEL: imm_neg_2863311530:
2716 ; RV32-REMAT: # %bb.0:
2717 ; RV32-REMAT-NEXT: lui a0, 349525
2718 ; RV32-REMAT-NEXT: addi a0, a0, 1366
2719 ; RV32-REMAT-NEXT: li a1, -1
2720 ; RV32-REMAT-NEXT: ret
2722 ; RV64-REMAT-LABEL: imm_neg_2863311530:
2723 ; RV64-REMAT: # %bb.0:
2724 ; RV64-REMAT-NEXT: lui a0, 699051
2725 ; RV64-REMAT-NEXT: addiw a0, a0, -1365
2726 ; RV64-REMAT-NEXT: slli a0, a0, 1
2727 ; RV64-REMAT-NEXT: ret
2728 ret i64 -2863311530 ; #0xffffffff55555556
2731 define i64 @imm_2147486378() {
2732 ; RV32I-LABEL: imm_2147486378:
2734 ; RV32I-NEXT: lui a0, 524288
2735 ; RV32I-NEXT: addi a0, a0, 1365
2736 ; RV32I-NEXT: li a1, 0
2739 ; RV64I-LABEL: imm_2147486378:
2741 ; RV64I-NEXT: li a0, 1
2742 ; RV64I-NEXT: slli a0, a0, 31
2743 ; RV64I-NEXT: addi a0, a0, 1365
2746 ; RV64IZBA-LABEL: imm_2147486378:
2747 ; RV64IZBA: # %bb.0:
2748 ; RV64IZBA-NEXT: li a0, 1
2749 ; RV64IZBA-NEXT: slli a0, a0, 31
2750 ; RV64IZBA-NEXT: addi a0, a0, 1365
2751 ; RV64IZBA-NEXT: ret
2753 ; RV64IZBB-LABEL: imm_2147486378:
2754 ; RV64IZBB: # %bb.0:
2755 ; RV64IZBB-NEXT: li a0, 1
2756 ; RV64IZBB-NEXT: slli a0, a0, 31
2757 ; RV64IZBB-NEXT: addi a0, a0, 1365
2758 ; RV64IZBB-NEXT: ret
2760 ; RV64IZBS-LABEL: imm_2147486378:
2761 ; RV64IZBS: # %bb.0:
2762 ; RV64IZBS-NEXT: li a0, 1365
2763 ; RV64IZBS-NEXT: bseti a0, a0, 31
2764 ; RV64IZBS-NEXT: ret
2766 ; RV64IXTHEADBB-LABEL: imm_2147486378:
2767 ; RV64IXTHEADBB: # %bb.0:
2768 ; RV64IXTHEADBB-NEXT: li a0, 1
2769 ; RV64IXTHEADBB-NEXT: slli a0, a0, 31
2770 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1365
2771 ; RV64IXTHEADBB-NEXT: ret
2773 ; RV32-REMAT-LABEL: imm_2147486378:
2774 ; RV32-REMAT: # %bb.0:
2775 ; RV32-REMAT-NEXT: lui a0, 524288
2776 ; RV32-REMAT-NEXT: addi a0, a0, 1365
2777 ; RV32-REMAT-NEXT: li a1, 0
2778 ; RV32-REMAT-NEXT: ret
2780 ; RV64-REMAT-LABEL: imm_2147486378:
2781 ; RV64-REMAT: # %bb.0:
2782 ; RV64-REMAT-NEXT: li a0, 1
2783 ; RV64-REMAT-NEXT: slli a0, a0, 31
2784 ; RV64-REMAT-NEXT: addi a0, a0, 1365
2785 ; RV64-REMAT-NEXT: ret
2789 define i64 @imm_neg_2147485013() {
2790 ; RV32I-LABEL: imm_neg_2147485013:
2792 ; RV32I-NEXT: lui a0, 524288
2793 ; RV32I-NEXT: addi a0, a0, -1365
2794 ; RV32I-NEXT: li a1, -1
2797 ; RV64I-LABEL: imm_neg_2147485013:
2799 ; RV64I-NEXT: lui a0, 524288
2800 ; RV64I-NEXT: addi a0, a0, -1365
2803 ; RV64IZBA-LABEL: imm_neg_2147485013:
2804 ; RV64IZBA: # %bb.0:
2805 ; RV64IZBA-NEXT: lui a0, 524288
2806 ; RV64IZBA-NEXT: addi a0, a0, -1365
2807 ; RV64IZBA-NEXT: ret
2809 ; RV64IZBB-LABEL: imm_neg_2147485013:
2810 ; RV64IZBB: # %bb.0:
2811 ; RV64IZBB-NEXT: lui a0, 524288
2812 ; RV64IZBB-NEXT: addi a0, a0, -1365
2813 ; RV64IZBB-NEXT: ret
2815 ; RV64IZBS-LABEL: imm_neg_2147485013:
2816 ; RV64IZBS: # %bb.0:
2817 ; RV64IZBS-NEXT: lui a0, 524288
2818 ; RV64IZBS-NEXT: addi a0, a0, -1365
2819 ; RV64IZBS-NEXT: ret
2821 ; RV64IXTHEADBB-LABEL: imm_neg_2147485013:
2822 ; RV64IXTHEADBB: # %bb.0:
2823 ; RV64IXTHEADBB-NEXT: lui a0, 524288
2824 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1365
2825 ; RV64IXTHEADBB-NEXT: ret
2827 ; RV32-REMAT-LABEL: imm_neg_2147485013:
2828 ; RV32-REMAT: # %bb.0:
2829 ; RV32-REMAT-NEXT: lui a0, 524288
2830 ; RV32-REMAT-NEXT: addi a0, a0, -1365
2831 ; RV32-REMAT-NEXT: li a1, -1
2832 ; RV32-REMAT-NEXT: ret
2834 ; RV64-REMAT-LABEL: imm_neg_2147485013:
2835 ; RV64-REMAT: # %bb.0:
2836 ; RV64-REMAT-NEXT: lui a0, 524288
2837 ; RV64-REMAT-NEXT: addi a0, a0, -1365
2838 ; RV64-REMAT-NEXT: ret
2842 define i64 @imm_12900924131259() {
2843 ; RV32I-LABEL: imm_12900924131259:
2845 ; RV32I-NEXT: lui a0, 765952
2846 ; RV32I-NEXT: addi a0, a0, 1979
2847 ; RV32I-NEXT: lui a1, 1
2848 ; RV32I-NEXT: addi a1, a1, -1093
2851 ; RV64I-LABEL: imm_12900924131259:
2853 ; RV64I-NEXT: lui a0, 188
2854 ; RV64I-NEXT: addiw a0, a0, -1093
2855 ; RV64I-NEXT: slli a0, a0, 24
2856 ; RV64I-NEXT: addi a0, a0, 1979
2859 ; RV64IZBA-LABEL: imm_12900924131259:
2860 ; RV64IZBA: # %bb.0:
2861 ; RV64IZBA-NEXT: lui a0, 768955
2862 ; RV64IZBA-NEXT: slli.uw a0, a0, 12
2863 ; RV64IZBA-NEXT: addi a0, a0, 1979
2864 ; RV64IZBA-NEXT: ret
2866 ; RV64IZBB-LABEL: imm_12900924131259:
2867 ; RV64IZBB: # %bb.0:
2868 ; RV64IZBB-NEXT: lui a0, 188
2869 ; RV64IZBB-NEXT: addiw a0, a0, -1093
2870 ; RV64IZBB-NEXT: slli a0, a0, 24
2871 ; RV64IZBB-NEXT: addi a0, a0, 1979
2872 ; RV64IZBB-NEXT: ret
2874 ; RV64IZBS-LABEL: imm_12900924131259:
2875 ; RV64IZBS: # %bb.0:
2876 ; RV64IZBS-NEXT: lui a0, 188
2877 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2878 ; RV64IZBS-NEXT: slli a0, a0, 24
2879 ; RV64IZBS-NEXT: addi a0, a0, 1979
2880 ; RV64IZBS-NEXT: ret
2882 ; RV64IXTHEADBB-LABEL: imm_12900924131259:
2883 ; RV64IXTHEADBB: # %bb.0:
2884 ; RV64IXTHEADBB-NEXT: lui a0, 188
2885 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1093
2886 ; RV64IXTHEADBB-NEXT: slli a0, a0, 24
2887 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1979
2888 ; RV64IXTHEADBB-NEXT: ret
2890 ; RV32-REMAT-LABEL: imm_12900924131259:
2891 ; RV32-REMAT: # %bb.0:
2892 ; RV32-REMAT-NEXT: lui a0, 765952
2893 ; RV32-REMAT-NEXT: addi a0, a0, 1979
2894 ; RV32-REMAT-NEXT: lui a1, 1
2895 ; RV32-REMAT-NEXT: addi a1, a1, -1093
2896 ; RV32-REMAT-NEXT: ret
2898 ; RV64-REMAT-LABEL: imm_12900924131259:
2899 ; RV64-REMAT: # %bb.0:
2900 ; RV64-REMAT-NEXT: lui a0, 188
2901 ; RV64-REMAT-NEXT: addiw a0, a0, -1093
2902 ; RV64-REMAT-NEXT: slli a0, a0, 24
2903 ; RV64-REMAT-NEXT: addi a0, a0, 1979
2904 ; RV64-REMAT-NEXT: ret
2905 ret i64 12900924131259
2908 define i64 @imm_50394234880() {
2909 ; RV32I-LABEL: imm_50394234880:
2911 ; RV32I-NEXT: lui a0, 768944
2912 ; RV32I-NEXT: li a1, 11
2915 ; RV64I-LABEL: imm_50394234880:
2917 ; RV64I-NEXT: lui a0, 188
2918 ; RV64I-NEXT: addiw a0, a0, -1093
2919 ; RV64I-NEXT: slli a0, a0, 16
2922 ; RV64IZBA-LABEL: imm_50394234880:
2923 ; RV64IZBA: # %bb.0:
2924 ; RV64IZBA-NEXT: lui a0, 768955
2925 ; RV64IZBA-NEXT: slli.uw a0, a0, 4
2926 ; RV64IZBA-NEXT: ret
2928 ; RV64IZBB-LABEL: imm_50394234880:
2929 ; RV64IZBB: # %bb.0:
2930 ; RV64IZBB-NEXT: lui a0, 188
2931 ; RV64IZBB-NEXT: addiw a0, a0, -1093
2932 ; RV64IZBB-NEXT: slli a0, a0, 16
2933 ; RV64IZBB-NEXT: ret
2935 ; RV64IZBS-LABEL: imm_50394234880:
2936 ; RV64IZBS: # %bb.0:
2937 ; RV64IZBS-NEXT: lui a0, 188
2938 ; RV64IZBS-NEXT: addiw a0, a0, -1093
2939 ; RV64IZBS-NEXT: slli a0, a0, 16
2940 ; RV64IZBS-NEXT: ret
2942 ; RV64IXTHEADBB-LABEL: imm_50394234880:
2943 ; RV64IXTHEADBB: # %bb.0:
2944 ; RV64IXTHEADBB-NEXT: lui a0, 188
2945 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1093
2946 ; RV64IXTHEADBB-NEXT: slli a0, a0, 16
2947 ; RV64IXTHEADBB-NEXT: ret
2949 ; RV32-REMAT-LABEL: imm_50394234880:
2950 ; RV32-REMAT: # %bb.0:
2951 ; RV32-REMAT-NEXT: lui a0, 768944
2952 ; RV32-REMAT-NEXT: li a1, 11
2953 ; RV32-REMAT-NEXT: ret
2955 ; RV64-REMAT-LABEL: imm_50394234880:
2956 ; RV64-REMAT: # %bb.0:
2957 ; RV64-REMAT-NEXT: lui a0, 188
2958 ; RV64-REMAT-NEXT: addiw a0, a0, -1093
2959 ; RV64-REMAT-NEXT: slli a0, a0, 16
2960 ; RV64-REMAT-NEXT: ret
2964 define i64 @imm_12900936431479() {
2965 ; RV32I-LABEL: imm_12900936431479:
2967 ; RV32I-NEXT: lui a0, 768955
2968 ; RV32I-NEXT: addi a0, a0, 1911
2969 ; RV32I-NEXT: lui a1, 1
2970 ; RV32I-NEXT: addi a1, a1, -1093
2973 ; RV64I-LABEL: imm_12900936431479:
2975 ; RV64I-NEXT: lui a0, 192239
2976 ; RV64I-NEXT: slli a0, a0, 2
2977 ; RV64I-NEXT: addi a0, a0, -1093
2978 ; RV64I-NEXT: slli a0, a0, 12
2979 ; RV64I-NEXT: addi a0, a0, 1911
2982 ; RV64IZBA-LABEL: imm_12900936431479:
2983 ; RV64IZBA: # %bb.0:
2984 ; RV64IZBA-NEXT: lui a0, 768956
2985 ; RV64IZBA-NEXT: addi a0, a0, -1093
2986 ; RV64IZBA-NEXT: slli.uw a0, a0, 12
2987 ; RV64IZBA-NEXT: addi a0, a0, 1911
2988 ; RV64IZBA-NEXT: ret
2990 ; RV64IZBB-LABEL: imm_12900936431479:
2991 ; RV64IZBB: # %bb.0:
2992 ; RV64IZBB-NEXT: lui a0, 192239
2993 ; RV64IZBB-NEXT: slli a0, a0, 2
2994 ; RV64IZBB-NEXT: addi a0, a0, -1093
2995 ; RV64IZBB-NEXT: slli a0, a0, 12
2996 ; RV64IZBB-NEXT: addi a0, a0, 1911
2997 ; RV64IZBB-NEXT: ret
2999 ; RV64IZBS-LABEL: imm_12900936431479:
3000 ; RV64IZBS: # %bb.0:
3001 ; RV64IZBS-NEXT: lui a0, 192239
3002 ; RV64IZBS-NEXT: slli a0, a0, 2
3003 ; RV64IZBS-NEXT: addi a0, a0, -1093
3004 ; RV64IZBS-NEXT: slli a0, a0, 12
3005 ; RV64IZBS-NEXT: addi a0, a0, 1911
3006 ; RV64IZBS-NEXT: ret
3008 ; RV64IXTHEADBB-LABEL: imm_12900936431479:
3009 ; RV64IXTHEADBB: # %bb.0:
3010 ; RV64IXTHEADBB-NEXT: lui a0, 192239
3011 ; RV64IXTHEADBB-NEXT: slli a0, a0, 2
3012 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1093
3013 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3014 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1911
3015 ; RV64IXTHEADBB-NEXT: ret
3017 ; RV32-REMAT-LABEL: imm_12900936431479:
3018 ; RV32-REMAT: # %bb.0:
3019 ; RV32-REMAT-NEXT: lui a0, 768955
3020 ; RV32-REMAT-NEXT: addi a0, a0, 1911
3021 ; RV32-REMAT-NEXT: lui a1, 1
3022 ; RV32-REMAT-NEXT: addi a1, a1, -1093
3023 ; RV32-REMAT-NEXT: ret
3025 ; RV64-REMAT-LABEL: imm_12900936431479:
3026 ; RV64-REMAT: # %bb.0:
3027 ; RV64-REMAT-NEXT: lui a0, 192239
3028 ; RV64-REMAT-NEXT: slli a0, a0, 2
3029 ; RV64-REMAT-NEXT: addi a0, a0, -1093
3030 ; RV64-REMAT-NEXT: slli a0, a0, 12
3031 ; RV64-REMAT-NEXT: addi a0, a0, 1911
3032 ; RV64-REMAT-NEXT: ret
3033 ret i64 12900936431479
3036 define i64 @imm_12900918536874() {
3037 ; RV32I-LABEL: imm_12900918536874:
3039 ; RV32I-NEXT: lui a0, 764587
3040 ; RV32I-NEXT: addi a0, a0, -1366
3041 ; RV32I-NEXT: lui a1, 1
3042 ; RV32I-NEXT: addi a1, a1, -1093
3045 ; RV64I-LABEL: imm_12900918536874:
3047 ; RV64I-NEXT: lui a0, 384477
3048 ; RV64I-NEXT: addiw a0, a0, 1365
3049 ; RV64I-NEXT: slli a0, a0, 12
3050 ; RV64I-NEXT: addi a0, a0, 1365
3051 ; RV64I-NEXT: slli a0, a0, 1
3054 ; RV64IZBA-LABEL: imm_12900918536874:
3055 ; RV64IZBA: # %bb.0:
3056 ; RV64IZBA-NEXT: lui a0, 768955
3057 ; RV64IZBA-NEXT: addi a0, a0, -1365
3058 ; RV64IZBA-NEXT: slli.uw a0, a0, 12
3059 ; RV64IZBA-NEXT: addi a0, a0, -1366
3060 ; RV64IZBA-NEXT: ret
3062 ; RV64IZBB-LABEL: imm_12900918536874:
3063 ; RV64IZBB: # %bb.0:
3064 ; RV64IZBB-NEXT: lui a0, 384477
3065 ; RV64IZBB-NEXT: addiw a0, a0, 1365
3066 ; RV64IZBB-NEXT: slli a0, a0, 12
3067 ; RV64IZBB-NEXT: addi a0, a0, 1365
3068 ; RV64IZBB-NEXT: slli a0, a0, 1
3069 ; RV64IZBB-NEXT: ret
3071 ; RV64IZBS-LABEL: imm_12900918536874:
3072 ; RV64IZBS: # %bb.0:
3073 ; RV64IZBS-NEXT: lui a0, 384477
3074 ; RV64IZBS-NEXT: addiw a0, a0, 1365
3075 ; RV64IZBS-NEXT: slli a0, a0, 12
3076 ; RV64IZBS-NEXT: addi a0, a0, 1365
3077 ; RV64IZBS-NEXT: slli a0, a0, 1
3078 ; RV64IZBS-NEXT: ret
3080 ; RV64IXTHEADBB-LABEL: imm_12900918536874:
3081 ; RV64IXTHEADBB: # %bb.0:
3082 ; RV64IXTHEADBB-NEXT: lui a0, 384477
3083 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 1365
3084 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3085 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1365
3086 ; RV64IXTHEADBB-NEXT: slli a0, a0, 1
3087 ; RV64IXTHEADBB-NEXT: ret
3089 ; RV32-REMAT-LABEL: imm_12900918536874:
3090 ; RV32-REMAT: # %bb.0:
3091 ; RV32-REMAT-NEXT: lui a0, 764587
3092 ; RV32-REMAT-NEXT: addi a0, a0, -1366
3093 ; RV32-REMAT-NEXT: lui a1, 1
3094 ; RV32-REMAT-NEXT: addi a1, a1, -1093
3095 ; RV32-REMAT-NEXT: ret
3097 ; RV64-REMAT-LABEL: imm_12900918536874:
3098 ; RV64-REMAT: # %bb.0:
3099 ; RV64-REMAT-NEXT: lui a0, 384477
3100 ; RV64-REMAT-NEXT: addiw a0, a0, 1365
3101 ; RV64-REMAT-NEXT: slli a0, a0, 12
3102 ; RV64-REMAT-NEXT: addi a0, a0, 1365
3103 ; RV64-REMAT-NEXT: slli a0, a0, 1
3104 ; RV64-REMAT-NEXT: ret
3105 ret i64 12900918536874
3108 define i64 @imm_12900925247761() {
3109 ; RV32I-LABEL: imm_12900925247761:
3111 ; RV32I-NEXT: lui a0, 766225
3112 ; RV32I-NEXT: addi a0, a0, 273
3113 ; RV32I-NEXT: lui a1, 1
3114 ; RV32I-NEXT: addi a1, a1, -1093
3117 ; RV64I-LABEL: imm_12900925247761:
3119 ; RV64I-NEXT: lui a0, 384478
3120 ; RV64I-NEXT: addiw a0, a0, -1911
3121 ; RV64I-NEXT: slli a0, a0, 13
3122 ; RV64I-NEXT: addi a0, a0, -2048
3123 ; RV64I-NEXT: addi a0, a0, -1775
3126 ; RV64IZBA-LABEL: imm_12900925247761:
3127 ; RV64IZBA: # %bb.0:
3128 ; RV64IZBA-NEXT: lui a0, 768955
3129 ; RV64IZBA-NEXT: addi a0, a0, 273
3130 ; RV64IZBA-NEXT: slli.uw a0, a0, 12
3131 ; RV64IZBA-NEXT: addi a0, a0, 273
3132 ; RV64IZBA-NEXT: ret
3134 ; RV64IZBB-LABEL: imm_12900925247761:
3135 ; RV64IZBB: # %bb.0:
3136 ; RV64IZBB-NEXT: lui a0, 384478
3137 ; RV64IZBB-NEXT: addiw a0, a0, -1911
3138 ; RV64IZBB-NEXT: slli a0, a0, 13
3139 ; RV64IZBB-NEXT: addi a0, a0, -2048
3140 ; RV64IZBB-NEXT: addi a0, a0, -1775
3141 ; RV64IZBB-NEXT: ret
3143 ; RV64IZBS-LABEL: imm_12900925247761:
3144 ; RV64IZBS: # %bb.0:
3145 ; RV64IZBS-NEXT: lui a0, 384478
3146 ; RV64IZBS-NEXT: addiw a0, a0, -1911
3147 ; RV64IZBS-NEXT: slli a0, a0, 13
3148 ; RV64IZBS-NEXT: addi a0, a0, -2048
3149 ; RV64IZBS-NEXT: addi a0, a0, -1775
3150 ; RV64IZBS-NEXT: ret
3152 ; RV64IXTHEADBB-LABEL: imm_12900925247761:
3153 ; RV64IXTHEADBB: # %bb.0:
3154 ; RV64IXTHEADBB-NEXT: lui a0, 384478
3155 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1911
3156 ; RV64IXTHEADBB-NEXT: slli a0, a0, 13
3157 ; RV64IXTHEADBB-NEXT: addi a0, a0, -2048
3158 ; RV64IXTHEADBB-NEXT: addi a0, a0, -1775
3159 ; RV64IXTHEADBB-NEXT: ret
3161 ; RV32-REMAT-LABEL: imm_12900925247761:
3162 ; RV32-REMAT: # %bb.0:
3163 ; RV32-REMAT-NEXT: lui a0, 766225
3164 ; RV32-REMAT-NEXT: addi a0, a0, 273
3165 ; RV32-REMAT-NEXT: lui a1, 1
3166 ; RV32-REMAT-NEXT: addi a1, a1, -1093
3167 ; RV32-REMAT-NEXT: ret
3169 ; RV64-REMAT-LABEL: imm_12900925247761:
3170 ; RV64-REMAT: # %bb.0:
3171 ; RV64-REMAT-NEXT: lui a0, 384478
3172 ; RV64-REMAT-NEXT: addiw a0, a0, -1911
3173 ; RV64-REMAT-NEXT: slli a0, a0, 13
3174 ; RV64-REMAT-NEXT: addi a0, a0, -2048
3175 ; RV64-REMAT-NEXT: addi a0, a0, -1775
3176 ; RV64-REMAT-NEXT: ret
3177 ret i64 12900925247761
3180 define i64 @imm_7158272001() {
3181 ; RV32I-LABEL: imm_7158272001:
3183 ; RV32I-NEXT: lui a0, 699049
3184 ; RV32I-NEXT: addi a0, a0, 1
3185 ; RV32I-NEXT: li a1, 1
3188 ; RV64I-LABEL: imm_7158272001:
3190 ; RV64I-NEXT: lui a0, 427
3191 ; RV64I-NEXT: addiw a0, a0, -1367
3192 ; RV64I-NEXT: slli a0, a0, 12
3193 ; RV64I-NEXT: addi a0, a0, 1
3196 ; RV64IZBA-LABEL: imm_7158272001:
3197 ; RV64IZBA: # %bb.0:
3198 ; RV64IZBA-NEXT: lui a0, 349525
3199 ; RV64IZBA-NEXT: sh2add a0, a0, a0
3200 ; RV64IZBA-NEXT: addi a0, a0, 1
3201 ; RV64IZBA-NEXT: ret
3203 ; RV64IZBB-LABEL: imm_7158272001:
3204 ; RV64IZBB: # %bb.0:
3205 ; RV64IZBB-NEXT: lui a0, 427
3206 ; RV64IZBB-NEXT: addiw a0, a0, -1367
3207 ; RV64IZBB-NEXT: slli a0, a0, 12
3208 ; RV64IZBB-NEXT: addi a0, a0, 1
3209 ; RV64IZBB-NEXT: ret
3211 ; RV64IZBS-LABEL: imm_7158272001:
3212 ; RV64IZBS: # %bb.0:
3213 ; RV64IZBS-NEXT: lui a0, 427
3214 ; RV64IZBS-NEXT: addiw a0, a0, -1367
3215 ; RV64IZBS-NEXT: slli a0, a0, 12
3216 ; RV64IZBS-NEXT: addi a0, a0, 1
3217 ; RV64IZBS-NEXT: ret
3219 ; RV64IXTHEADBB-LABEL: imm_7158272001:
3220 ; RV64IXTHEADBB: # %bb.0:
3221 ; RV64IXTHEADBB-NEXT: lui a0, 427
3222 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1367
3223 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3224 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1
3225 ; RV64IXTHEADBB-NEXT: ret
3227 ; RV32-REMAT-LABEL: imm_7158272001:
3228 ; RV32-REMAT: # %bb.0:
3229 ; RV32-REMAT-NEXT: lui a0, 699049
3230 ; RV32-REMAT-NEXT: addi a0, a0, 1
3231 ; RV32-REMAT-NEXT: li a1, 1
3232 ; RV32-REMAT-NEXT: ret
3234 ; RV64-REMAT-LABEL: imm_7158272001:
3235 ; RV64-REMAT: # %bb.0:
3236 ; RV64-REMAT-NEXT: lui a0, 427
3237 ; RV64-REMAT-NEXT: addiw a0, a0, -1367
3238 ; RV64-REMAT-NEXT: slli a0, a0, 12
3239 ; RV64-REMAT-NEXT: addi a0, a0, 1
3240 ; RV64-REMAT-NEXT: ret
3241 ret i64 7158272001 ; 0x0000_0001_aaaa_9001
3244 define i64 @imm_12884889601() {
3245 ; RV32I-LABEL: imm_12884889601:
3247 ; RV32I-NEXT: lui a0, 1048573
3248 ; RV32I-NEXT: addi a0, a0, 1
3249 ; RV32I-NEXT: li a1, 2
3252 ; RV64I-LABEL: imm_12884889601:
3254 ; RV64I-NEXT: lui a0, 768
3255 ; RV64I-NEXT: addiw a0, a0, -3
3256 ; RV64I-NEXT: slli a0, a0, 12
3257 ; RV64I-NEXT: addi a0, a0, 1
3260 ; RV64IZBA-LABEL: imm_12884889601:
3261 ; RV64IZBA: # %bb.0:
3262 ; RV64IZBA-NEXT: lui a0, 349525
3263 ; RV64IZBA-NEXT: sh3add a0, a0, a0
3264 ; RV64IZBA-NEXT: addi a0, a0, 1
3265 ; RV64IZBA-NEXT: ret
3267 ; RV64IZBB-LABEL: imm_12884889601:
3268 ; RV64IZBB: # %bb.0:
3269 ; RV64IZBB-NEXT: lui a0, 768
3270 ; RV64IZBB-NEXT: addiw a0, a0, -3
3271 ; RV64IZBB-NEXT: slli a0, a0, 12
3272 ; RV64IZBB-NEXT: addi a0, a0, 1
3273 ; RV64IZBB-NEXT: ret
3275 ; RV64IZBS-LABEL: imm_12884889601:
3276 ; RV64IZBS: # %bb.0:
3277 ; RV64IZBS-NEXT: lui a0, 768
3278 ; RV64IZBS-NEXT: addiw a0, a0, -3
3279 ; RV64IZBS-NEXT: slli a0, a0, 12
3280 ; RV64IZBS-NEXT: addi a0, a0, 1
3281 ; RV64IZBS-NEXT: ret
3283 ; RV64IXTHEADBB-LABEL: imm_12884889601:
3284 ; RV64IXTHEADBB: # %bb.0:
3285 ; RV64IXTHEADBB-NEXT: lui a0, 768
3286 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -3
3287 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3288 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1
3289 ; RV64IXTHEADBB-NEXT: ret
3291 ; RV32-REMAT-LABEL: imm_12884889601:
3292 ; RV32-REMAT: # %bb.0:
3293 ; RV32-REMAT-NEXT: lui a0, 1048573
3294 ; RV32-REMAT-NEXT: addi a0, a0, 1
3295 ; RV32-REMAT-NEXT: li a1, 2
3296 ; RV32-REMAT-NEXT: ret
3298 ; RV64-REMAT-LABEL: imm_12884889601:
3299 ; RV64-REMAT: # %bb.0:
3300 ; RV64-REMAT-NEXT: lui a0, 768
3301 ; RV64-REMAT-NEXT: addiw a0, a0, -3
3302 ; RV64-REMAT-NEXT: slli a0, a0, 12
3303 ; RV64-REMAT-NEXT: addi a0, a0, 1
3304 ; RV64-REMAT-NEXT: ret
3305 ret i64 12884889601 ; 0x0000_0002_ffff_d001
3308 define i64 @imm_neg_3435982847() {
3309 ; RV32I-LABEL: imm_neg_3435982847:
3311 ; RV32I-NEXT: lui a0, 209713
3312 ; RV32I-NEXT: addi a0, a0, 1
3313 ; RV32I-NEXT: li a1, -1
3316 ; RV64I-LABEL: imm_neg_3435982847:
3318 ; RV64I-NEXT: lui a0, 1048371
3319 ; RV64I-NEXT: addiw a0, a0, 817
3320 ; RV64I-NEXT: slli a0, a0, 12
3321 ; RV64I-NEXT: addi a0, a0, 1
3324 ; RV64IZBA-LABEL: imm_neg_3435982847:
3325 ; RV64IZBA: # %bb.0:
3326 ; RV64IZBA-NEXT: lui a0, 768955
3327 ; RV64IZBA-NEXT: sh1add a0, a0, a0
3328 ; RV64IZBA-NEXT: addi a0, a0, 1
3329 ; RV64IZBA-NEXT: ret
3331 ; RV64IZBB-LABEL: imm_neg_3435982847:
3332 ; RV64IZBB: # %bb.0:
3333 ; RV64IZBB-NEXT: lui a0, 1048371
3334 ; RV64IZBB-NEXT: addiw a0, a0, 817
3335 ; RV64IZBB-NEXT: slli a0, a0, 12
3336 ; RV64IZBB-NEXT: addi a0, a0, 1
3337 ; RV64IZBB-NEXT: ret
3339 ; RV64IZBS-LABEL: imm_neg_3435982847:
3340 ; RV64IZBS: # %bb.0:
3341 ; RV64IZBS-NEXT: lui a0, 734001
3342 ; RV64IZBS-NEXT: addiw a0, a0, 1
3343 ; RV64IZBS-NEXT: bclri a0, a0, 31
3344 ; RV64IZBS-NEXT: ret
3346 ; RV64IXTHEADBB-LABEL: imm_neg_3435982847:
3347 ; RV64IXTHEADBB: # %bb.0:
3348 ; RV64IXTHEADBB-NEXT: lui a0, 1048371
3349 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 817
3350 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3351 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1
3352 ; RV64IXTHEADBB-NEXT: ret
3354 ; RV32-REMAT-LABEL: imm_neg_3435982847:
3355 ; RV32-REMAT: # %bb.0:
3356 ; RV32-REMAT-NEXT: lui a0, 209713
3357 ; RV32-REMAT-NEXT: addi a0, a0, 1
3358 ; RV32-REMAT-NEXT: li a1, -1
3359 ; RV32-REMAT-NEXT: ret
3361 ; RV64-REMAT-LABEL: imm_neg_3435982847:
3362 ; RV64-REMAT: # %bb.0:
3363 ; RV64-REMAT-NEXT: lui a0, 1048371
3364 ; RV64-REMAT-NEXT: addiw a0, a0, 817
3365 ; RV64-REMAT-NEXT: slli a0, a0, 12
3366 ; RV64-REMAT-NEXT: addi a0, a0, 1
3367 ; RV64-REMAT-NEXT: ret
3368 ret i64 -3435982847 ; 0xffff_ffff_3333_1001
3371 define i64 @imm_neg_5726842879() {
3372 ; RV32I-LABEL: imm_neg_5726842879:
3374 ; RV32I-NEXT: lui a0, 698997
3375 ; RV32I-NEXT: addi a0, a0, 1
3376 ; RV32I-NEXT: li a1, -2
3379 ; RV64I-LABEL: imm_neg_5726842879:
3381 ; RV64I-NEXT: lui a0, 1048235
3382 ; RV64I-NEXT: addiw a0, a0, -1419
3383 ; RV64I-NEXT: slli a0, a0, 12
3384 ; RV64I-NEXT: addi a0, a0, 1
3387 ; RV64IZBA-LABEL: imm_neg_5726842879:
3388 ; RV64IZBA: # %bb.0:
3389 ; RV64IZBA-NEXT: lui a0, 768945
3390 ; RV64IZBA-NEXT: sh2add a0, a0, a0
3391 ; RV64IZBA-NEXT: addi a0, a0, 1
3392 ; RV64IZBA-NEXT: ret
3394 ; RV64IZBB-LABEL: imm_neg_5726842879:
3395 ; RV64IZBB: # %bb.0:
3396 ; RV64IZBB-NEXT: lui a0, 1048235
3397 ; RV64IZBB-NEXT: addiw a0, a0, -1419
3398 ; RV64IZBB-NEXT: slli a0, a0, 12
3399 ; RV64IZBB-NEXT: addi a0, a0, 1
3400 ; RV64IZBB-NEXT: ret
3402 ; RV64IZBS-LABEL: imm_neg_5726842879:
3403 ; RV64IZBS: # %bb.0:
3404 ; RV64IZBS-NEXT: lui a0, 698997
3405 ; RV64IZBS-NEXT: addiw a0, a0, 1
3406 ; RV64IZBS-NEXT: bclri a0, a0, 32
3407 ; RV64IZBS-NEXT: ret
3409 ; RV64IXTHEADBB-LABEL: imm_neg_5726842879:
3410 ; RV64IXTHEADBB: # %bb.0:
3411 ; RV64IXTHEADBB-NEXT: lui a0, 1048235
3412 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1419
3413 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3414 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1
3415 ; RV64IXTHEADBB-NEXT: ret
3417 ; RV32-REMAT-LABEL: imm_neg_5726842879:
3418 ; RV32-REMAT: # %bb.0:
3419 ; RV32-REMAT-NEXT: lui a0, 698997
3420 ; RV32-REMAT-NEXT: addi a0, a0, 1
3421 ; RV32-REMAT-NEXT: li a1, -2
3422 ; RV32-REMAT-NEXT: ret
3424 ; RV64-REMAT-LABEL: imm_neg_5726842879:
3425 ; RV64-REMAT: # %bb.0:
3426 ; RV64-REMAT-NEXT: lui a0, 1048235
3427 ; RV64-REMAT-NEXT: addiw a0, a0, -1419
3428 ; RV64-REMAT-NEXT: slli a0, a0, 12
3429 ; RV64-REMAT-NEXT: addi a0, a0, 1
3430 ; RV64-REMAT-NEXT: ret
3431 ret i64 -5726842879 ; 0xffff_fffe_aaa7_5001
3434 define i64 @imm_neg_10307948543() {
3435 ; RV32I-LABEL: imm_neg_10307948543:
3437 ; RV32I-NEXT: lui a0, 629139
3438 ; RV32I-NEXT: addi a0, a0, 1
3439 ; RV32I-NEXT: li a1, -3
3442 ; RV64I-LABEL: imm_neg_10307948543:
3444 ; RV64I-NEXT: lui a0, 1047962
3445 ; RV64I-NEXT: addiw a0, a0, -1645
3446 ; RV64I-NEXT: slli a0, a0, 12
3447 ; RV64I-NEXT: addi a0, a0, 1
3450 ; RV64IZBA-LABEL: imm_neg_10307948543:
3451 ; RV64IZBA: # %bb.0:
3452 ; RV64IZBA-NEXT: lui a0, 768955
3453 ; RV64IZBA-NEXT: sh3add a0, a0, a0
3454 ; RV64IZBA-NEXT: addi a0, a0, 1
3455 ; RV64IZBA-NEXT: ret
3457 ; RV64IZBB-LABEL: imm_neg_10307948543:
3458 ; RV64IZBB: # %bb.0:
3459 ; RV64IZBB-NEXT: lui a0, 1047962
3460 ; RV64IZBB-NEXT: addiw a0, a0, -1645
3461 ; RV64IZBB-NEXT: slli a0, a0, 12
3462 ; RV64IZBB-NEXT: addi a0, a0, 1
3463 ; RV64IZBB-NEXT: ret
3465 ; RV64IZBS-LABEL: imm_neg_10307948543:
3466 ; RV64IZBS: # %bb.0:
3467 ; RV64IZBS-NEXT: lui a0, 629139
3468 ; RV64IZBS-NEXT: addiw a0, a0, 1
3469 ; RV64IZBS-NEXT: bclri a0, a0, 33
3470 ; RV64IZBS-NEXT: ret
3472 ; RV64IXTHEADBB-LABEL: imm_neg_10307948543:
3473 ; RV64IXTHEADBB: # %bb.0:
3474 ; RV64IXTHEADBB-NEXT: lui a0, 1047962
3475 ; RV64IXTHEADBB-NEXT: addiw a0, a0, -1645
3476 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3477 ; RV64IXTHEADBB-NEXT: addi a0, a0, 1
3478 ; RV64IXTHEADBB-NEXT: ret
3480 ; RV32-REMAT-LABEL: imm_neg_10307948543:
3481 ; RV32-REMAT: # %bb.0:
3482 ; RV32-REMAT-NEXT: lui a0, 629139
3483 ; RV32-REMAT-NEXT: addi a0, a0, 1
3484 ; RV32-REMAT-NEXT: li a1, -3
3485 ; RV32-REMAT-NEXT: ret
3487 ; RV64-REMAT-LABEL: imm_neg_10307948543:
3488 ; RV64-REMAT: # %bb.0:
3489 ; RV64-REMAT-NEXT: lui a0, 1047962
3490 ; RV64-REMAT-NEXT: addiw a0, a0, -1645
3491 ; RV64-REMAT-NEXT: slli a0, a0, 12
3492 ; RV64-REMAT-NEXT: addi a0, a0, 1
3493 ; RV64-REMAT-NEXT: ret
3494 ret i64 -10307948543 ; 0xffff_fffd_9999_3001
3497 define i64 @li_rori_1() {
3498 ; RV32I-LABEL: li_rori_1:
3500 ; RV32I-NEXT: lui a0, 1048567
3501 ; RV32I-NEXT: addi a1, a0, 2047
3502 ; RV32I-NEXT: li a0, -1
3505 ; RV64I-LABEL: li_rori_1:
3507 ; RV64I-NEXT: li a0, -17
3508 ; RV64I-NEXT: slli a0, a0, 43
3509 ; RV64I-NEXT: addi a0, a0, -1
3512 ; RV64IZBA-LABEL: li_rori_1:
3513 ; RV64IZBA: # %bb.0:
3514 ; RV64IZBA-NEXT: li a0, -17
3515 ; RV64IZBA-NEXT: slli a0, a0, 43
3516 ; RV64IZBA-NEXT: addi a0, a0, -1
3517 ; RV64IZBA-NEXT: ret
3519 ; RV64IZBB-LABEL: li_rori_1:
3520 ; RV64IZBB: # %bb.0:
3521 ; RV64IZBB-NEXT: li a0, -18
3522 ; RV64IZBB-NEXT: rori a0, a0, 21
3523 ; RV64IZBB-NEXT: ret
3525 ; RV64IZBS-LABEL: li_rori_1:
3526 ; RV64IZBS: # %bb.0:
3527 ; RV64IZBS-NEXT: li a0, -17
3528 ; RV64IZBS-NEXT: slli a0, a0, 43
3529 ; RV64IZBS-NEXT: addi a0, a0, -1
3530 ; RV64IZBS-NEXT: ret
3532 ; RV64IXTHEADBB-LABEL: li_rori_1:
3533 ; RV64IXTHEADBB: # %bb.0:
3534 ; RV64IXTHEADBB-NEXT: li a0, -18
3535 ; RV64IXTHEADBB-NEXT: th.srri a0, a0, 21
3536 ; RV64IXTHEADBB-NEXT: ret
3538 ; RV32-REMAT-LABEL: li_rori_1:
3539 ; RV32-REMAT: # %bb.0:
3540 ; RV32-REMAT-NEXT: lui a1, 1048567
3541 ; RV32-REMAT-NEXT: addi a1, a1, 2047
3542 ; RV32-REMAT-NEXT: li a0, -1
3543 ; RV32-REMAT-NEXT: ret
3545 ; RV64-REMAT-LABEL: li_rori_1:
3546 ; RV64-REMAT: # %bb.0:
3547 ; RV64-REMAT-NEXT: li a0, -17
3548 ; RV64-REMAT-NEXT: slli a0, a0, 43
3549 ; RV64-REMAT-NEXT: addi a0, a0, -1
3550 ; RV64-REMAT-NEXT: ret
3551 ret i64 -149533581377537
3554 define i64 @li_rori_2() {
3555 ; RV32I-LABEL: li_rori_2:
3557 ; RV32I-NEXT: lui a1, 720896
3558 ; RV32I-NEXT: addi a1, a1, -1
3559 ; RV32I-NEXT: li a0, -6
3562 ; RV64I-LABEL: li_rori_2:
3564 ; RV64I-NEXT: li a0, -5
3565 ; RV64I-NEXT: slli a0, a0, 60
3566 ; RV64I-NEXT: addi a0, a0, -6
3569 ; RV64IZBA-LABEL: li_rori_2:
3570 ; RV64IZBA: # %bb.0:
3571 ; RV64IZBA-NEXT: li a0, -5
3572 ; RV64IZBA-NEXT: slli a0, a0, 60
3573 ; RV64IZBA-NEXT: addi a0, a0, -6
3574 ; RV64IZBA-NEXT: ret
3576 ; RV64IZBB-LABEL: li_rori_2:
3577 ; RV64IZBB: # %bb.0:
3578 ; RV64IZBB-NEXT: li a0, -86
3579 ; RV64IZBB-NEXT: rori a0, a0, 4
3580 ; RV64IZBB-NEXT: ret
3582 ; RV64IZBS-LABEL: li_rori_2:
3583 ; RV64IZBS: # %bb.0:
3584 ; RV64IZBS-NEXT: li a0, -5
3585 ; RV64IZBS-NEXT: slli a0, a0, 60
3586 ; RV64IZBS-NEXT: addi a0, a0, -6
3587 ; RV64IZBS-NEXT: ret
3589 ; RV64IXTHEADBB-LABEL: li_rori_2:
3590 ; RV64IXTHEADBB: # %bb.0:
3591 ; RV64IXTHEADBB-NEXT: li a0, -86
3592 ; RV64IXTHEADBB-NEXT: th.srri a0, a0, 4
3593 ; RV64IXTHEADBB-NEXT: ret
3595 ; RV32-REMAT-LABEL: li_rori_2:
3596 ; RV32-REMAT: # %bb.0:
3597 ; RV32-REMAT-NEXT: lui a1, 720896
3598 ; RV32-REMAT-NEXT: addi a1, a1, -1
3599 ; RV32-REMAT-NEXT: li a0, -6
3600 ; RV32-REMAT-NEXT: ret
3602 ; RV64-REMAT-LABEL: li_rori_2:
3603 ; RV64-REMAT: # %bb.0:
3604 ; RV64-REMAT-NEXT: li a0, -5
3605 ; RV64-REMAT-NEXT: slli a0, a0, 60
3606 ; RV64-REMAT-NEXT: addi a0, a0, -6
3607 ; RV64-REMAT-NEXT: ret
3608 ret i64 -5764607523034234886
3611 define i64 @li_rori_3() {
3612 ; RV32I-LABEL: li_rori_3:
3614 ; RV32I-NEXT: lui a0, 491520
3615 ; RV32I-NEXT: addi a0, a0, -1
3616 ; RV32I-NEXT: li a1, -1
3619 ; RV64I-LABEL: li_rori_3:
3621 ; RV64I-NEXT: li a0, -17
3622 ; RV64I-NEXT: slli a0, a0, 27
3623 ; RV64I-NEXT: addi a0, a0, -1
3626 ; RV64IZBA-LABEL: li_rori_3:
3627 ; RV64IZBA: # %bb.0:
3628 ; RV64IZBA-NEXT: li a0, -17
3629 ; RV64IZBA-NEXT: slli a0, a0, 27
3630 ; RV64IZBA-NEXT: addi a0, a0, -1
3631 ; RV64IZBA-NEXT: ret
3633 ; RV64IZBB-LABEL: li_rori_3:
3634 ; RV64IZBB: # %bb.0:
3635 ; RV64IZBB-NEXT: li a0, -18
3636 ; RV64IZBB-NEXT: rori a0, a0, 37
3637 ; RV64IZBB-NEXT: ret
3639 ; RV64IZBS-LABEL: li_rori_3:
3640 ; RV64IZBS: # %bb.0:
3641 ; RV64IZBS-NEXT: li a0, -17
3642 ; RV64IZBS-NEXT: slli a0, a0, 27
3643 ; RV64IZBS-NEXT: addi a0, a0, -1
3644 ; RV64IZBS-NEXT: ret
3646 ; RV64IXTHEADBB-LABEL: li_rori_3:
3647 ; RV64IXTHEADBB: # %bb.0:
3648 ; RV64IXTHEADBB-NEXT: li a0, -18
3649 ; RV64IXTHEADBB-NEXT: th.srri a0, a0, 37
3650 ; RV64IXTHEADBB-NEXT: ret
3652 ; RV32-REMAT-LABEL: li_rori_3:
3653 ; RV32-REMAT: # %bb.0:
3654 ; RV32-REMAT-NEXT: lui a0, 491520
3655 ; RV32-REMAT-NEXT: addi a0, a0, -1
3656 ; RV32-REMAT-NEXT: li a1, -1
3657 ; RV32-REMAT-NEXT: ret
3659 ; RV64-REMAT-LABEL: li_rori_3:
3660 ; RV64-REMAT: # %bb.0:
3661 ; RV64-REMAT-NEXT: li a0, -17
3662 ; RV64-REMAT-NEXT: slli a0, a0, 27
3663 ; RV64-REMAT-NEXT: addi a0, a0, -1
3664 ; RV64-REMAT-NEXT: ret
3668 ; This used to assert when compiled with Zba.
3669 define i64 @PR54812() {
3670 ; RV32I-LABEL: PR54812:
3672 ; RV32I-NEXT: lui a0, 521599
3673 ; RV32I-NEXT: li a1, -1
3676 ; RV64I-LABEL: PR54812:
3678 ; RV64I-NEXT: lui a0, 1048447
3679 ; RV64I-NEXT: addiw a0, a0, 1407
3680 ; RV64I-NEXT: slli a0, a0, 12
3683 ; RV64IZBA-LABEL: PR54812:
3684 ; RV64IZBA: # %bb.0:
3685 ; RV64IZBA-NEXT: lui a0, 872917
3686 ; RV64IZBA-NEXT: sh1add a0, a0, a0
3687 ; RV64IZBA-NEXT: ret
3689 ; RV64IZBB-LABEL: PR54812:
3690 ; RV64IZBB: # %bb.0:
3691 ; RV64IZBB-NEXT: lui a0, 1048447
3692 ; RV64IZBB-NEXT: addiw a0, a0, 1407
3693 ; RV64IZBB-NEXT: slli a0, a0, 12
3694 ; RV64IZBB-NEXT: ret
3696 ; RV64IZBS-LABEL: PR54812:
3697 ; RV64IZBS: # %bb.0:
3698 ; RV64IZBS-NEXT: lui a0, 1045887
3699 ; RV64IZBS-NEXT: bclri a0, a0, 31
3700 ; RV64IZBS-NEXT: ret
3702 ; RV64IXTHEADBB-LABEL: PR54812:
3703 ; RV64IXTHEADBB: # %bb.0:
3704 ; RV64IXTHEADBB-NEXT: lui a0, 1048447
3705 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 1407
3706 ; RV64IXTHEADBB-NEXT: slli a0, a0, 12
3707 ; RV64IXTHEADBB-NEXT: ret
3709 ; RV32-REMAT-LABEL: PR54812:
3710 ; RV32-REMAT: # %bb.0:
3711 ; RV32-REMAT-NEXT: lui a0, 521599
3712 ; RV32-REMAT-NEXT: li a1, -1
3713 ; RV32-REMAT-NEXT: ret
3715 ; RV64-REMAT-LABEL: PR54812:
3716 ; RV64-REMAT: # %bb.0:
3717 ; RV64-REMAT-NEXT: lui a0, 1048447
3718 ; RV64-REMAT-NEXT: addiw a0, a0, 1407
3719 ; RV64-REMAT-NEXT: slli a0, a0, 12
3720 ; RV64-REMAT-NEXT: ret
3721 ret i64 -2158497792;
3724 define signext i32 @pos_2048() nounwind {
3725 ; RV32I-LABEL: pos_2048:
3727 ; RV32I-NEXT: li a0, 1
3728 ; RV32I-NEXT: slli a0, a0, 11
3731 ; RV64I-LABEL: pos_2048:
3733 ; RV64I-NEXT: li a0, 1
3734 ; RV64I-NEXT: slli a0, a0, 11
3737 ; RV64IZBA-LABEL: pos_2048:
3738 ; RV64IZBA: # %bb.0:
3739 ; RV64IZBA-NEXT: li a0, 1
3740 ; RV64IZBA-NEXT: slli a0, a0, 11
3741 ; RV64IZBA-NEXT: ret
3743 ; RV64IZBB-LABEL: pos_2048:
3744 ; RV64IZBB: # %bb.0:
3745 ; RV64IZBB-NEXT: li a0, 1
3746 ; RV64IZBB-NEXT: slli a0, a0, 11
3747 ; RV64IZBB-NEXT: ret
3749 ; RV64IZBS-LABEL: pos_2048:
3750 ; RV64IZBS: # %bb.0:
3751 ; RV64IZBS-NEXT: bseti a0, zero, 11
3752 ; RV64IZBS-NEXT: ret
3754 ; RV64IXTHEADBB-LABEL: pos_2048:
3755 ; RV64IXTHEADBB: # %bb.0:
3756 ; RV64IXTHEADBB-NEXT: li a0, 1
3757 ; RV64IXTHEADBB-NEXT: slli a0, a0, 11
3758 ; RV64IXTHEADBB-NEXT: ret
3760 ; RV32-REMAT-LABEL: pos_2048:
3761 ; RV32-REMAT: # %bb.0:
3762 ; RV32-REMAT-NEXT: li a0, 1
3763 ; RV32-REMAT-NEXT: slli a0, a0, 11
3764 ; RV32-REMAT-NEXT: ret
3766 ; RV64-REMAT-LABEL: pos_2048:
3767 ; RV64-REMAT: # %bb.0:
3768 ; RV64-REMAT-NEXT: li a0, 1
3769 ; RV64-REMAT-NEXT: slli a0, a0, 11
3770 ; RV64-REMAT-NEXT: ret
3774 define i64 @imm64_same_lo_hi() nounwind {
3775 ; RV32I-LABEL: imm64_same_lo_hi:
3777 ; RV32I-NEXT: lui a0, 65793
3778 ; RV32I-NEXT: addi a0, a0, 16
3779 ; RV32I-NEXT: mv a1, a0
3782 ; RV64I-LABEL: imm64_same_lo_hi:
3784 ; RV64I-NEXT: lui a0, 65793
3785 ; RV64I-NEXT: addiw a0, a0, 16
3786 ; RV64I-NEXT: slli a1, a0, 32
3787 ; RV64I-NEXT: add a0, a0, a1
3790 ; RV64IZBA-LABEL: imm64_same_lo_hi:
3791 ; RV64IZBA: # %bb.0:
3792 ; RV64IZBA-NEXT: lui a0, 65793
3793 ; RV64IZBA-NEXT: addiw a0, a0, 16
3794 ; RV64IZBA-NEXT: slli a1, a0, 32
3795 ; RV64IZBA-NEXT: add a0, a0, a1
3796 ; RV64IZBA-NEXT: ret
3798 ; RV64IZBB-LABEL: imm64_same_lo_hi:
3799 ; RV64IZBB: # %bb.0:
3800 ; RV64IZBB-NEXT: lui a0, 65793
3801 ; RV64IZBB-NEXT: addiw a0, a0, 16
3802 ; RV64IZBB-NEXT: slli a1, a0, 32
3803 ; RV64IZBB-NEXT: add a0, a0, a1
3804 ; RV64IZBB-NEXT: ret
3806 ; RV64IZBS-LABEL: imm64_same_lo_hi:
3807 ; RV64IZBS: # %bb.0:
3808 ; RV64IZBS-NEXT: lui a0, 65793
3809 ; RV64IZBS-NEXT: addiw a0, a0, 16
3810 ; RV64IZBS-NEXT: slli a1, a0, 32
3811 ; RV64IZBS-NEXT: add a0, a0, a1
3812 ; RV64IZBS-NEXT: ret
3814 ; RV64IXTHEADBB-LABEL: imm64_same_lo_hi:
3815 ; RV64IXTHEADBB: # %bb.0:
3816 ; RV64IXTHEADBB-NEXT: lui a0, 65793
3817 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 16
3818 ; RV64IXTHEADBB-NEXT: slli a1, a0, 32
3819 ; RV64IXTHEADBB-NEXT: add a0, a0, a1
3820 ; RV64IXTHEADBB-NEXT: ret
3822 ; RV32-REMAT-LABEL: imm64_same_lo_hi:
3823 ; RV32-REMAT: # %bb.0:
3824 ; RV32-REMAT-NEXT: lui a0, 65793
3825 ; RV32-REMAT-NEXT: addi a0, a0, 16
3826 ; RV32-REMAT-NEXT: mv a1, a0
3827 ; RV32-REMAT-NEXT: ret
3829 ; RV64-REMAT-LABEL: imm64_same_lo_hi:
3830 ; RV64-REMAT: # %bb.0:
3831 ; RV64-REMAT-NEXT: lui a0, 65793
3832 ; RV64-REMAT-NEXT: addiw a0, a0, 16
3833 ; RV64-REMAT-NEXT: slli a1, a0, 32
3834 ; RV64-REMAT-NEXT: add a0, a0, a1
3835 ; RV64-REMAT-NEXT: ret
3836 ret i64 1157442765409226768 ; 0x0101010101010101
3839 ; Same as above with optsize. Make sure we use constant pool on RV64
3840 define i64 @imm64_same_lo_hi_optsize() nounwind optsize {
3841 ; RV32I-LABEL: imm64_same_lo_hi_optsize:
3843 ; RV32I-NEXT: lui a0, 65793
3844 ; RV32I-NEXT: addi a0, a0, 16
3845 ; RV32I-NEXT: mv a1, a0
3848 ; RV64-NOPOOL-LABEL: imm64_same_lo_hi_optsize:
3849 ; RV64-NOPOOL: # %bb.0:
3850 ; RV64-NOPOOL-NEXT: lui a0, 65793
3851 ; RV64-NOPOOL-NEXT: addiw a0, a0, 16
3852 ; RV64-NOPOOL-NEXT: slli a1, a0, 32
3853 ; RV64-NOPOOL-NEXT: add a0, a0, a1
3854 ; RV64-NOPOOL-NEXT: ret
3856 ; RV64I-POOL-LABEL: imm64_same_lo_hi_optsize:
3857 ; RV64I-POOL: # %bb.0:
3858 ; RV64I-POOL-NEXT: lui a0, %hi(.LCPI64_0)
3859 ; RV64I-POOL-NEXT: ld a0, %lo(.LCPI64_0)(a0)
3860 ; RV64I-POOL-NEXT: ret
3862 ; RV64IZBA-LABEL: imm64_same_lo_hi_optsize:
3863 ; RV64IZBA: # %bb.0:
3864 ; RV64IZBA-NEXT: lui a0, 65793
3865 ; RV64IZBA-NEXT: addiw a0, a0, 16
3866 ; RV64IZBA-NEXT: slli a1, a0, 32
3867 ; RV64IZBA-NEXT: add a0, a0, a1
3868 ; RV64IZBA-NEXT: ret
3870 ; RV64IZBB-LABEL: imm64_same_lo_hi_optsize:
3871 ; RV64IZBB: # %bb.0:
3872 ; RV64IZBB-NEXT: lui a0, 65793
3873 ; RV64IZBB-NEXT: addiw a0, a0, 16
3874 ; RV64IZBB-NEXT: slli a1, a0, 32
3875 ; RV64IZBB-NEXT: add a0, a0, a1
3876 ; RV64IZBB-NEXT: ret
3878 ; RV64IZBS-LABEL: imm64_same_lo_hi_optsize:
3879 ; RV64IZBS: # %bb.0:
3880 ; RV64IZBS-NEXT: lui a0, 65793
3881 ; RV64IZBS-NEXT: addiw a0, a0, 16
3882 ; RV64IZBS-NEXT: slli a1, a0, 32
3883 ; RV64IZBS-NEXT: add a0, a0, a1
3884 ; RV64IZBS-NEXT: ret
3886 ; RV64IXTHEADBB-LABEL: imm64_same_lo_hi_optsize:
3887 ; RV64IXTHEADBB: # %bb.0:
3888 ; RV64IXTHEADBB-NEXT: lui a0, 65793
3889 ; RV64IXTHEADBB-NEXT: addiw a0, a0, 16
3890 ; RV64IXTHEADBB-NEXT: slli a1, a0, 32
3891 ; RV64IXTHEADBB-NEXT: add a0, a0, a1
3892 ; RV64IXTHEADBB-NEXT: ret
3894 ; RV32-REMAT-LABEL: imm64_same_lo_hi_optsize:
3895 ; RV32-REMAT: # %bb.0:
3896 ; RV32-REMAT-NEXT: lui a0, 65793
3897 ; RV32-REMAT-NEXT: addi a0, a0, 16
3898 ; RV32-REMAT-NEXT: mv a1, a0
3899 ; RV32-REMAT-NEXT: ret
3901 ; RV64-REMAT-LABEL: imm64_same_lo_hi_optsize:
3902 ; RV64-REMAT: # %bb.0:
3903 ; RV64-REMAT-NEXT: lui a0, 65793
3904 ; RV64-REMAT-NEXT: addiw a0, a0, 16
3905 ; RV64-REMAT-NEXT: slli a1, a0, 32
3906 ; RV64-REMAT-NEXT: add a0, a0, a1
3907 ; RV64-REMAT-NEXT: ret
3908 ret i64 1157442765409226768 ; 0x0101010101010101
3911 ; Hi and lo are the same and also negative.
3912 define i64 @imm64_same_lo_hi_negative() nounwind {
3913 ; RV32I-LABEL: imm64_same_lo_hi_negative:
3915 ; RV32I-NEXT: lui a0, 526344
3916 ; RV32I-NEXT: addi a0, a0, 128
3917 ; RV32I-NEXT: mv a1, a0
3920 ; RV64-NOPOOL-LABEL: imm64_same_lo_hi_negative:
3921 ; RV64-NOPOOL: # %bb.0:
3922 ; RV64-NOPOOL-NEXT: lui a0, 983297
3923 ; RV64-NOPOOL-NEXT: slli a0, a0, 4
3924 ; RV64-NOPOOL-NEXT: addi a0, a0, 257
3925 ; RV64-NOPOOL-NEXT: slli a0, a0, 16
3926 ; RV64-NOPOOL-NEXT: addi a0, a0, 257
3927 ; RV64-NOPOOL-NEXT: slli a0, a0, 15
3928 ; RV64-NOPOOL-NEXT: addi a0, a0, 128
3929 ; RV64-NOPOOL-NEXT: ret
3931 ; RV64I-POOL-LABEL: imm64_same_lo_hi_negative:
3932 ; RV64I-POOL: # %bb.0:
3933 ; RV64I-POOL-NEXT: lui a0, %hi(.LCPI65_0)
3934 ; RV64I-POOL-NEXT: ld a0, %lo(.LCPI65_0)(a0)
3935 ; RV64I-POOL-NEXT: ret
3937 ; RV64IZBA-LABEL: imm64_same_lo_hi_negative:
3938 ; RV64IZBA: # %bb.0:
3939 ; RV64IZBA-NEXT: lui a0, 526344
3940 ; RV64IZBA-NEXT: addi a0, a0, 128
3941 ; RV64IZBA-NEXT: slli a1, a0, 32
3942 ; RV64IZBA-NEXT: add.uw a0, a0, a1
3943 ; RV64IZBA-NEXT: ret
3945 ; RV64IZBB-LABEL: imm64_same_lo_hi_negative:
3946 ; RV64IZBB: # %bb.0:
3947 ; RV64IZBB-NEXT: lui a0, 983297
3948 ; RV64IZBB-NEXT: slli a0, a0, 4
3949 ; RV64IZBB-NEXT: addi a0, a0, 257
3950 ; RV64IZBB-NEXT: slli a0, a0, 16
3951 ; RV64IZBB-NEXT: addi a0, a0, 257
3952 ; RV64IZBB-NEXT: slli a0, a0, 15
3953 ; RV64IZBB-NEXT: addi a0, a0, 128
3954 ; RV64IZBB-NEXT: ret
3956 ; RV64IZBS-LABEL: imm64_same_lo_hi_negative:
3957 ; RV64IZBS: # %bb.0:
3958 ; RV64IZBS-NEXT: lui a0, 983297
3959 ; RV64IZBS-NEXT: slli a0, a0, 4
3960 ; RV64IZBS-NEXT: addi a0, a0, 257
3961 ; RV64IZBS-NEXT: slli a0, a0, 16
3962 ; RV64IZBS-NEXT: addi a0, a0, 257
3963 ; RV64IZBS-NEXT: slli a0, a0, 15
3964 ; RV64IZBS-NEXT: addi a0, a0, 128
3965 ; RV64IZBS-NEXT: ret
3967 ; RV64IXTHEADBB-LABEL: imm64_same_lo_hi_negative:
3968 ; RV64IXTHEADBB: # %bb.0:
3969 ; RV64IXTHEADBB-NEXT: lui a0, 983297
3970 ; RV64IXTHEADBB-NEXT: slli a0, a0, 4
3971 ; RV64IXTHEADBB-NEXT: addi a0, a0, 257
3972 ; RV64IXTHEADBB-NEXT: slli a0, a0, 16
3973 ; RV64IXTHEADBB-NEXT: addi a0, a0, 257
3974 ; RV64IXTHEADBB-NEXT: slli a0, a0, 15
3975 ; RV64IXTHEADBB-NEXT: addi a0, a0, 128
3976 ; RV64IXTHEADBB-NEXT: ret
3978 ; RV32-REMAT-LABEL: imm64_same_lo_hi_negative:
3979 ; RV32-REMAT: # %bb.0:
3980 ; RV32-REMAT-NEXT: lui a0, 526344
3981 ; RV32-REMAT-NEXT: addi a0, a0, 128
3982 ; RV32-REMAT-NEXT: mv a1, a0
3983 ; RV32-REMAT-NEXT: ret
3985 ; RV64-REMAT-LABEL: imm64_same_lo_hi_negative:
3986 ; RV64-REMAT: # %bb.0:
3987 ; RV64-REMAT-NEXT: lui a0, 983297
3988 ; RV64-REMAT-NEXT: slli a0, a0, 4
3989 ; RV64-REMAT-NEXT: addi a0, a0, 257
3990 ; RV64-REMAT-NEXT: slli a0, a0, 16
3991 ; RV64-REMAT-NEXT: addi a0, a0, 257
3992 ; RV64-REMAT-NEXT: slli a0, a0, 15
3993 ; RV64-REMAT-NEXT: addi a0, a0, 128
3994 ; RV64-REMAT-NEXT: ret
3995 ret i64 9259542123273814144 ; 0x8080808080808080