Alex Bradbury | 0f0e1b5 | 2017-11-08 12:02:22 +0000 | [diff] [blame] | 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 | |
| 7 | define i32 @zero() nounwind { |
| 8 | ; RV32I-LABEL: zero: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 9 | ; RV32I: # %bb.0: |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 10 | ; RV32I-NEXT: mv a0, zero |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 11 | ; RV32I-NEXT: ret |
Alex Bradbury | 0f0e1b5 | 2017-11-08 12:02:22 +0000 | [diff] [blame] | 12 | ret i32 0 |
| 13 | } |
| 14 | |
| 15 | define i32 @pos_small() nounwind { |
| 16 | ; RV32I-LABEL: pos_small: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 17 | ; RV32I: # %bb.0: |
Alex Bradbury | 0f0e1b5 | 2017-11-08 12:02:22 +0000 | [diff] [blame] | 18 | ; RV32I-NEXT: addi a0, zero, 2047 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 19 | ; RV32I-NEXT: ret |
Alex Bradbury | 0f0e1b5 | 2017-11-08 12:02:22 +0000 | [diff] [blame] | 20 | ret i32 2047 |
| 21 | } |
| 22 | |
| 23 | define i32 @neg_small() nounwind { |
| 24 | ; RV32I-LABEL: neg_small: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 25 | ; RV32I: # %bb.0: |
Alex Bradbury | 0f0e1b5 | 2017-11-08 12:02:22 +0000 | [diff] [blame] | 26 | ; RV32I-NEXT: addi a0, zero, -2048 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 27 | ; RV32I-NEXT: ret |
Alex Bradbury | 0f0e1b5 | 2017-11-08 12:02:22 +0000 | [diff] [blame] | 28 | ret i32 -2048 |
| 29 | } |
| 30 | |
| 31 | define i32 @pos_i32() nounwind { |
| 32 | ; RV32I-LABEL: pos_i32: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 33 | ; RV32I: # %bb.0: |
Alex Bradbury | 0f0e1b5 | 2017-11-08 12:02:22 +0000 | [diff] [blame] | 34 | ; RV32I-NEXT: lui a0, 423811 |
| 35 | ; RV32I-NEXT: addi a0, a0, -1297 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 36 | ; RV32I-NEXT: ret |
Alex Bradbury | 0f0e1b5 | 2017-11-08 12:02:22 +0000 | [diff] [blame] | 37 | ret i32 1735928559 |
| 38 | } |
| 39 | |
| 40 | define i32 @neg_i32() nounwind { |
| 41 | ; RV32I-LABEL: neg_i32: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 42 | ; RV32I: # %bb.0: |
Alex Bradbury | 0f0e1b5 | 2017-11-08 12:02:22 +0000 | [diff] [blame] | 43 | ; RV32I-NEXT: lui a0, 912092 |
| 44 | ; RV32I-NEXT: addi a0, a0, -273 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 45 | ; RV32I-NEXT: ret |
Alex Bradbury | 0f0e1b5 | 2017-11-08 12:02:22 +0000 | [diff] [blame] | 46 | ret i32 -559038737 |
| 47 | } |