blob: dca1c5e1e1eadba89e80591f4aeb33480bb7efc3 [file] [log] [blame]
Alex Bradbury0f0e1b52017-11-08 12:02:22 +00001; 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:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +00009; RV32I: # %bb.0:
Alex Bradbury59136ff2017-12-15 09:47:01 +000010; RV32I-NEXT: mv a0, zero
Alex Bradbury59136ff2017-12-15 09:47:01 +000011; RV32I-NEXT: ret
Alex Bradbury0f0e1b52017-11-08 12:02:22 +000012 ret i32 0
13}
14
15define i32 @pos_small() nounwind {
16; RV32I-LABEL: pos_small:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000017; RV32I: # %bb.0:
Alex Bradbury0f0e1b52017-11-08 12:02:22 +000018; RV32I-NEXT: addi a0, zero, 2047
Alex Bradbury59136ff2017-12-15 09:47:01 +000019; RV32I-NEXT: ret
Alex Bradbury0f0e1b52017-11-08 12:02:22 +000020 ret i32 2047
21}
22
23define i32 @neg_small() nounwind {
24; RV32I-LABEL: neg_small:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000025; RV32I: # %bb.0:
Alex Bradbury0f0e1b52017-11-08 12:02:22 +000026; RV32I-NEXT: addi a0, zero, -2048
Alex Bradbury59136ff2017-12-15 09:47:01 +000027; RV32I-NEXT: ret
Alex Bradbury0f0e1b52017-11-08 12:02:22 +000028 ret i32 -2048
29}
30
31define i32 @pos_i32() nounwind {
32; RV32I-LABEL: pos_i32:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000033; RV32I: # %bb.0:
Alex Bradbury0f0e1b52017-11-08 12:02:22 +000034; RV32I-NEXT: lui a0, 423811
35; RV32I-NEXT: addi a0, a0, -1297
Alex Bradbury59136ff2017-12-15 09:47:01 +000036; RV32I-NEXT: ret
Alex Bradbury0f0e1b52017-11-08 12:02:22 +000037 ret i32 1735928559
38}
39
40define i32 @neg_i32() nounwind {
41; RV32I-LABEL: neg_i32:
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000042; RV32I: # %bb.0:
Alex Bradbury0f0e1b52017-11-08 12:02:22 +000043; RV32I-NEXT: lui a0, 912092
44; RV32I-NEXT: addi a0, a0, -273
Alex Bradbury59136ff2017-12-15 09:47:01 +000045; RV32I-NEXT: ret
Alex Bradbury0f0e1b52017-11-08 12:02:22 +000046 ret i32 -559038737
47}