• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3; RUN:   | FileCheck %s -check-prefix=RV32I
4
5; Materializing constants
6
7define i32 @zero() nounwind {
8; RV32I-LABEL: zero:
9; RV32I:       # %bb.0:
10; RV32I-NEXT:    mv a0, zero
11; RV32I-NEXT:    ret
12  ret i32 0
13}
14
15define i32 @pos_small() nounwind {
16; RV32I-LABEL: pos_small:
17; RV32I:       # %bb.0:
18; RV32I-NEXT:    addi a0, zero, 2047
19; RV32I-NEXT:    ret
20  ret i32 2047
21}
22
23define i32 @neg_small() nounwind {
24; RV32I-LABEL: neg_small:
25; RV32I:       # %bb.0:
26; RV32I-NEXT:    addi a0, zero, -2048
27; RV32I-NEXT:    ret
28  ret i32 -2048
29}
30
31define i32 @pos_i32() nounwind {
32; RV32I-LABEL: pos_i32:
33; RV32I:       # %bb.0:
34; RV32I-NEXT:    lui a0, 423811
35; RV32I-NEXT:    addi a0, a0, -1297
36; RV32I-NEXT:    ret
37  ret i32 1735928559
38}
39
40define i32 @neg_i32() nounwind {
41; RV32I-LABEL: neg_i32:
42; RV32I:       # %bb.0:
43; RV32I-NEXT:    lui a0, 912092
44; RV32I-NEXT:    addi a0, a0, -273
45; RV32I-NEXT:    ret
46  ret i32 -559038737
47}
48
49define i32 @pos_i32_hi20_only() nounwind {
50; RV32I-LABEL: pos_i32_hi20_only:
51; RV32I:       # %bb.0:
52; RV32I-NEXT:    lui a0, 16
53; RV32I-NEXT:    ret
54  ret i32 65536
55}
56
57define i32 @neg_i32_hi20_only() nounwind {
58; RV32I-LABEL: neg_i32_hi20_only:
59; RV32I:       # %bb.0:
60; RV32I-NEXT:    lui a0, 1048560
61; RV32I-NEXT:    ret
62  ret i32 -65536
63}
64