Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +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 |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 4 | ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ |
| 5 | ; RUN: | FileCheck %s -check-prefix=RV64I |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 6 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 7 | define i8 @sext_i1_to_i8(i1 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 8 | ; RV32I-LABEL: sext_i1_to_i8: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 9 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 10 | ; RV32I-NEXT: andi a0, a0, 1 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 11 | ; RV32I-NEXT: neg a0, a0 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 12 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 13 | ; |
| 14 | ; RV64I-LABEL: sext_i1_to_i8: |
| 15 | ; RV64I: # %bb.0: |
| 16 | ; RV64I-NEXT: andi a0, a0, 1 |
| 17 | ; RV64I-NEXT: neg a0, a0 |
| 18 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 19 | %1 = sext i1 %a to i8 |
| 20 | ret i8 %1 |
| 21 | } |
| 22 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 23 | define i16 @sext_i1_to_i16(i1 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 24 | ; RV32I-LABEL: sext_i1_to_i16: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 25 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 26 | ; RV32I-NEXT: andi a0, a0, 1 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 27 | ; RV32I-NEXT: neg a0, a0 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 28 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 29 | ; |
| 30 | ; RV64I-LABEL: sext_i1_to_i16: |
| 31 | ; RV64I: # %bb.0: |
| 32 | ; RV64I-NEXT: andi a0, a0, 1 |
| 33 | ; RV64I-NEXT: neg a0, a0 |
| 34 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 35 | %1 = sext i1 %a to i16 |
| 36 | ret i16 %1 |
| 37 | } |
| 38 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 39 | define i32 @sext_i1_to_i32(i1 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 40 | ; RV32I-LABEL: sext_i1_to_i32: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 41 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 42 | ; RV32I-NEXT: andi a0, a0, 1 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 43 | ; RV32I-NEXT: neg a0, a0 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 44 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 45 | ; |
| 46 | ; RV64I-LABEL: sext_i1_to_i32: |
| 47 | ; RV64I: # %bb.0: |
| 48 | ; RV64I-NEXT: andi a0, a0, 1 |
| 49 | ; RV64I-NEXT: neg a0, a0 |
| 50 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 51 | %1 = sext i1 %a to i32 |
| 52 | ret i32 %1 |
| 53 | } |
| 54 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 55 | define i64 @sext_i1_to_i64(i1 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 56 | ; RV32I-LABEL: sext_i1_to_i64: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 57 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 58 | ; RV32I-NEXT: andi a0, a0, 1 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 59 | ; RV32I-NEXT: neg a0, a0 |
| 60 | ; RV32I-NEXT: mv a1, a0 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 61 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 62 | ; |
| 63 | ; RV64I-LABEL: sext_i1_to_i64: |
| 64 | ; RV64I: # %bb.0: |
| 65 | ; RV64I-NEXT: andi a0, a0, 1 |
| 66 | ; RV64I-NEXT: neg a0, a0 |
| 67 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 68 | %1 = sext i1 %a to i64 |
| 69 | ret i64 %1 |
| 70 | } |
| 71 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 72 | define i16 @sext_i8_to_i16(i8 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 73 | ; RV32I-LABEL: sext_i8_to_i16: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 74 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 75 | ; RV32I-NEXT: slli a0, a0, 24 |
| 76 | ; RV32I-NEXT: srai a0, a0, 24 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 77 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 78 | ; |
| 79 | ; RV64I-LABEL: sext_i8_to_i16: |
| 80 | ; RV64I: # %bb.0: |
| 81 | ; RV64I-NEXT: slli a0, a0, 56 |
| 82 | ; RV64I-NEXT: srai a0, a0, 56 |
| 83 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 84 | %1 = sext i8 %a to i16 |
| 85 | ret i16 %1 |
| 86 | } |
| 87 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 88 | define i32 @sext_i8_to_i32(i8 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 89 | ; RV32I-LABEL: sext_i8_to_i32: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 90 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 91 | ; RV32I-NEXT: slli a0, a0, 24 |
| 92 | ; RV32I-NEXT: srai a0, a0, 24 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 93 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 94 | ; |
| 95 | ; RV64I-LABEL: sext_i8_to_i32: |
| 96 | ; RV64I: # %bb.0: |
| 97 | ; RV64I-NEXT: slli a0, a0, 56 |
| 98 | ; RV64I-NEXT: srai a0, a0, 56 |
| 99 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 100 | %1 = sext i8 %a to i32 |
| 101 | ret i32 %1 |
| 102 | } |
| 103 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 104 | define i64 @sext_i8_to_i64(i8 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 105 | ; RV32I-LABEL: sext_i8_to_i64: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 106 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 107 | ; RV32I-NEXT: slli a1, a0, 24 |
| 108 | ; RV32I-NEXT: srai a0, a1, 24 |
| 109 | ; RV32I-NEXT: srai a1, a1, 31 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 110 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 111 | ; |
| 112 | ; RV64I-LABEL: sext_i8_to_i64: |
| 113 | ; RV64I: # %bb.0: |
| 114 | ; RV64I-NEXT: slli a0, a0, 56 |
| 115 | ; RV64I-NEXT: srai a0, a0, 56 |
| 116 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 117 | %1 = sext i8 %a to i64 |
| 118 | ret i64 %1 |
| 119 | } |
| 120 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 121 | define i32 @sext_i16_to_i32(i16 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 122 | ; RV32I-LABEL: sext_i16_to_i32: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 123 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 124 | ; RV32I-NEXT: slli a0, a0, 16 |
| 125 | ; RV32I-NEXT: srai a0, a0, 16 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 126 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 127 | ; |
| 128 | ; RV64I-LABEL: sext_i16_to_i32: |
| 129 | ; RV64I: # %bb.0: |
| 130 | ; RV64I-NEXT: slli a0, a0, 48 |
| 131 | ; RV64I-NEXT: srai a0, a0, 48 |
| 132 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 133 | %1 = sext i16 %a to i32 |
| 134 | ret i32 %1 |
| 135 | } |
| 136 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 137 | define i64 @sext_i16_to_i64(i16 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 138 | ; RV32I-LABEL: sext_i16_to_i64: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 139 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 140 | ; RV32I-NEXT: slli a1, a0, 16 |
| 141 | ; RV32I-NEXT: srai a0, a1, 16 |
| 142 | ; RV32I-NEXT: srai a1, a1, 31 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 143 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 144 | ; |
| 145 | ; RV64I-LABEL: sext_i16_to_i64: |
| 146 | ; RV64I: # %bb.0: |
| 147 | ; RV64I-NEXT: slli a0, a0, 48 |
| 148 | ; RV64I-NEXT: srai a0, a0, 48 |
| 149 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 150 | %1 = sext i16 %a to i64 |
| 151 | ret i64 %1 |
| 152 | } |
| 153 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 154 | define i64 @sext_i32_to_i64(i32 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 155 | ; RV32I-LABEL: sext_i32_to_i64: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 156 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 157 | ; RV32I-NEXT: srai a1, a0, 31 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 158 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 159 | ; |
| 160 | ; RV64I-LABEL: sext_i32_to_i64: |
| 161 | ; RV64I: # %bb.0: |
| 162 | ; RV64I-NEXT: sext.w a0, a0 |
| 163 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 164 | %1 = sext i32 %a to i64 |
| 165 | ret i64 %1 |
| 166 | } |
| 167 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 168 | define i8 @zext_i1_to_i8(i1 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 169 | ; RV32I-LABEL: zext_i1_to_i8: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 170 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 171 | ; RV32I-NEXT: andi a0, a0, 1 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 172 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 173 | ; |
| 174 | ; RV64I-LABEL: zext_i1_to_i8: |
| 175 | ; RV64I: # %bb.0: |
| 176 | ; RV64I-NEXT: andi a0, a0, 1 |
| 177 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 178 | %1 = zext i1 %a to i8 |
| 179 | ret i8 %1 |
| 180 | } |
| 181 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 182 | define i16 @zext_i1_to_i16(i1 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 183 | ; RV32I-LABEL: zext_i1_to_i16: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 184 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 185 | ; RV32I-NEXT: andi a0, a0, 1 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 186 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 187 | ; |
| 188 | ; RV64I-LABEL: zext_i1_to_i16: |
| 189 | ; RV64I: # %bb.0: |
| 190 | ; RV64I-NEXT: andi a0, a0, 1 |
| 191 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 192 | %1 = zext i1 %a to i16 |
| 193 | ret i16 %1 |
| 194 | } |
| 195 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 196 | define i32 @zext_i1_to_i32(i1 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 197 | ; RV32I-LABEL: zext_i1_to_i32: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 198 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 199 | ; RV32I-NEXT: andi a0, a0, 1 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 200 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 201 | ; |
| 202 | ; RV64I-LABEL: zext_i1_to_i32: |
| 203 | ; RV64I: # %bb.0: |
| 204 | ; RV64I-NEXT: andi a0, a0, 1 |
| 205 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 206 | %1 = zext i1 %a to i32 |
| 207 | ret i32 %1 |
| 208 | } |
| 209 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 210 | define i64 @zext_i1_to_i64(i1 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 211 | ; RV32I-LABEL: zext_i1_to_i64: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 212 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 213 | ; RV32I-NEXT: andi a0, a0, 1 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 214 | ; RV32I-NEXT: mv a1, zero |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 215 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 216 | ; |
| 217 | ; RV64I-LABEL: zext_i1_to_i64: |
| 218 | ; RV64I: # %bb.0: |
| 219 | ; RV64I-NEXT: andi a0, a0, 1 |
| 220 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 221 | %1 = zext i1 %a to i64 |
| 222 | ret i64 %1 |
| 223 | } |
| 224 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 225 | define i16 @zext_i8_to_i16(i8 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 226 | ; RV32I-LABEL: zext_i8_to_i16: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 227 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 228 | ; RV32I-NEXT: andi a0, a0, 255 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 229 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 230 | ; |
| 231 | ; RV64I-LABEL: zext_i8_to_i16: |
| 232 | ; RV64I: # %bb.0: |
| 233 | ; RV64I-NEXT: andi a0, a0, 255 |
| 234 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 235 | %1 = zext i8 %a to i16 |
| 236 | ret i16 %1 |
| 237 | } |
| 238 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 239 | define i32 @zext_i8_to_i32(i8 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 240 | ; RV32I-LABEL: zext_i8_to_i32: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 241 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 242 | ; RV32I-NEXT: andi a0, a0, 255 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 243 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 244 | ; |
| 245 | ; RV64I-LABEL: zext_i8_to_i32: |
| 246 | ; RV64I: # %bb.0: |
| 247 | ; RV64I-NEXT: andi a0, a0, 255 |
| 248 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 249 | %1 = zext i8 %a to i32 |
| 250 | ret i32 %1 |
| 251 | } |
| 252 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 253 | define i64 @zext_i8_to_i64(i8 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 254 | ; RV32I-LABEL: zext_i8_to_i64: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 255 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 256 | ; RV32I-NEXT: andi a0, a0, 255 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 257 | ; RV32I-NEXT: mv a1, zero |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 258 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 259 | ; |
| 260 | ; RV64I-LABEL: zext_i8_to_i64: |
| 261 | ; RV64I: # %bb.0: |
| 262 | ; RV64I-NEXT: andi a0, a0, 255 |
| 263 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 264 | %1 = zext i8 %a to i64 |
| 265 | ret i64 %1 |
| 266 | } |
| 267 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 268 | define i32 @zext_i16_to_i32(i16 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 269 | ; RV32I-LABEL: zext_i16_to_i32: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 270 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 271 | ; RV32I-NEXT: lui a1, 16 |
| 272 | ; RV32I-NEXT: addi a1, a1, -1 |
| 273 | ; RV32I-NEXT: and a0, a0, a1 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 274 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 275 | ; |
| 276 | ; RV64I-LABEL: zext_i16_to_i32: |
| 277 | ; RV64I: # %bb.0: |
| 278 | ; RV64I-NEXT: lui a1, 16 |
| 279 | ; RV64I-NEXT: addiw a1, a1, -1 |
| 280 | ; RV64I-NEXT: and a0, a0, a1 |
| 281 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 282 | %1 = zext i16 %a to i32 |
| 283 | ret i32 %1 |
| 284 | } |
| 285 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 286 | define i64 @zext_i16_to_i64(i16 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 287 | ; RV32I-LABEL: zext_i16_to_i64: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 288 | ; RV32I: # %bb.0: |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 289 | ; RV32I-NEXT: lui a1, 16 |
| 290 | ; RV32I-NEXT: addi a1, a1, -1 |
| 291 | ; RV32I-NEXT: and a0, a0, a1 |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 292 | ; RV32I-NEXT: mv a1, zero |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 293 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 294 | ; |
| 295 | ; RV64I-LABEL: zext_i16_to_i64: |
| 296 | ; RV64I: # %bb.0: |
| 297 | ; RV64I-NEXT: lui a1, 16 |
| 298 | ; RV64I-NEXT: addiw a1, a1, -1 |
| 299 | ; RV64I-NEXT: and a0, a0, a1 |
| 300 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 301 | %1 = zext i16 %a to i64 |
| 302 | ret i64 %1 |
| 303 | } |
| 304 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 305 | define i64 @zext_i32_to_i64(i32 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 306 | ; RV32I-LABEL: zext_i32_to_i64: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 307 | ; RV32I: # %bb.0: |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 308 | ; RV32I-NEXT: mv a1, zero |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 309 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 310 | ; |
| 311 | ; RV64I-LABEL: zext_i32_to_i64: |
| 312 | ; RV64I: # %bb.0: |
| 313 | ; RV64I-NEXT: slli a0, a0, 32 |
| 314 | ; RV64I-NEXT: srli a0, a0, 32 |
| 315 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 316 | %1 = zext i32 %a to i64 |
| 317 | ret i64 %1 |
| 318 | } |
| 319 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 320 | define i1 @trunc_i8_to_i1(i8 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 321 | ; RV32I-LABEL: trunc_i8_to_i1: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 322 | ; RV32I: # %bb.0: |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 323 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 324 | ; |
| 325 | ; RV64I-LABEL: trunc_i8_to_i1: |
| 326 | ; RV64I: # %bb.0: |
| 327 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 328 | %1 = trunc i8 %a to i1 |
| 329 | ret i1 %1 |
| 330 | } |
| 331 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 332 | define i1 @trunc_i16_to_i1(i16 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 333 | ; RV32I-LABEL: trunc_i16_to_i1: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 334 | ; RV32I: # %bb.0: |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 335 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 336 | ; |
| 337 | ; RV64I-LABEL: trunc_i16_to_i1: |
| 338 | ; RV64I: # %bb.0: |
| 339 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 340 | %1 = trunc i16 %a to i1 |
| 341 | ret i1 %1 |
| 342 | } |
| 343 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 344 | define i1 @trunc_i32_to_i1(i32 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 345 | ; RV32I-LABEL: trunc_i32_to_i1: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 346 | ; RV32I: # %bb.0: |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 347 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 348 | ; |
| 349 | ; RV64I-LABEL: trunc_i32_to_i1: |
| 350 | ; RV64I: # %bb.0: |
| 351 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 352 | %1 = trunc i32 %a to i1 |
| 353 | ret i1 %1 |
| 354 | } |
| 355 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 356 | define i1 @trunc_i64_to_i1(i64 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 357 | ; RV32I-LABEL: trunc_i64_to_i1: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 358 | ; RV32I: # %bb.0: |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 359 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 360 | ; |
| 361 | ; RV64I-LABEL: trunc_i64_to_i1: |
| 362 | ; RV64I: # %bb.0: |
| 363 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 364 | %1 = trunc i64 %a to i1 |
| 365 | ret i1 %1 |
| 366 | } |
| 367 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 368 | define i8 @trunc_i16_to_i8(i16 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 369 | ; RV32I-LABEL: trunc_i16_to_i8: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 370 | ; RV32I: # %bb.0: |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 371 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 372 | ; |
| 373 | ; RV64I-LABEL: trunc_i16_to_i8: |
| 374 | ; RV64I: # %bb.0: |
| 375 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 376 | %1 = trunc i16 %a to i8 |
| 377 | ret i8 %1 |
| 378 | } |
| 379 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 380 | define i8 @trunc_i32_to_i8(i32 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 381 | ; RV32I-LABEL: trunc_i32_to_i8: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 382 | ; RV32I: # %bb.0: |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 383 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 384 | ; |
| 385 | ; RV64I-LABEL: trunc_i32_to_i8: |
| 386 | ; RV64I: # %bb.0: |
| 387 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 388 | %1 = trunc i32 %a to i8 |
| 389 | ret i8 %1 |
| 390 | } |
| 391 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 392 | define i8 @trunc_i64_to_i8(i64 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 393 | ; RV32I-LABEL: trunc_i64_to_i8: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 394 | ; RV32I: # %bb.0: |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 395 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 396 | ; |
| 397 | ; RV64I-LABEL: trunc_i64_to_i8: |
| 398 | ; RV64I: # %bb.0: |
| 399 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 400 | %1 = trunc i64 %a to i8 |
| 401 | ret i8 %1 |
| 402 | } |
| 403 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 404 | define i16 @trunc_i32_to_i16(i32 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 405 | ; RV32I-LABEL: trunc_i32_to_i16: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 406 | ; RV32I: # %bb.0: |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 407 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 408 | ; |
| 409 | ; RV64I-LABEL: trunc_i32_to_i16: |
| 410 | ; RV64I: # %bb.0: |
| 411 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 412 | %1 = trunc i32 %a to i16 |
| 413 | ret i16 %1 |
| 414 | } |
| 415 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 416 | define i16 @trunc_i64_to_i16(i64 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 417 | ; RV32I-LABEL: trunc_i64_to_i16: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 418 | ; RV32I: # %bb.0: |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 419 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 420 | ; |
| 421 | ; RV64I-LABEL: trunc_i64_to_i16: |
| 422 | ; RV64I: # %bb.0: |
| 423 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 424 | %1 = trunc i64 %a to i16 |
| 425 | ret i16 %1 |
| 426 | } |
| 427 | |
Alex Bradbury | 5dabe03 | 2019-05-23 12:43:13 +0000 | [diff] [blame] | 428 | define i32 @trunc_i64_to_i32(i64 %a) nounwind { |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 429 | ; RV32I-LABEL: trunc_i64_to_i32: |
Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 430 | ; RV32I: # %bb.0: |
Alex Bradbury | 59136ff | 2017-12-15 09:47:01 +0000 | [diff] [blame] | 431 | ; RV32I-NEXT: ret |
Alex Bradbury | bc96a98 | 2018-11-30 09:38:44 +0000 | [diff] [blame] | 432 | ; |
| 433 | ; RV64I-LABEL: trunc_i64_to_i32: |
| 434 | ; RV64I: # %bb.0: |
| 435 | ; RV64I-NEXT: ret |
Alex Bradbury | ffc435e | 2017-11-21 08:11:03 +0000 | [diff] [blame] | 436 | %1 = trunc i64 %a to i32 |
| 437 | ret i32 %1 |
| 438 | } |