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 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
5 ; RUN: | FileCheck %s -check-prefix=RV64I
7 ; These tests are identical to those in alu32.ll but operate on i8. They check
8 ; that legalisation of these non-native types doesn't introduce unnecessary
11 define i8 @addi(i8 %a) nounwind {
14 ; RV32I-NEXT: addi a0, a0, 1
19 ; RV64I-NEXT: addi a0, a0, 1
25 define i8 @slti(i8 %a) nounwind {
28 ; RV32I-NEXT: slli a0, a0, 24
29 ; RV32I-NEXT: srai a0, a0, 24
30 ; RV32I-NEXT: slti a0, a0, 2
35 ; RV64I-NEXT: slli a0, a0, 56
36 ; RV64I-NEXT: srai a0, a0, 56
37 ; RV64I-NEXT: slti a0, a0, 2
39 %1 = icmp slt i8 %a, 2
44 define i8 @sltiu(i8 %a) nounwind {
47 ; RV32I-NEXT: andi a0, a0, 255
48 ; RV32I-NEXT: sltiu a0, a0, 3
53 ; RV64I-NEXT: andi a0, a0, 255
54 ; RV64I-NEXT: sltiu a0, a0, 3
56 %1 = icmp ult i8 %a, 3
61 define i8 @xori(i8 %a) nounwind {
64 ; RV32I-NEXT: xori a0, a0, 4
69 ; RV64I-NEXT: xori a0, a0, 4
75 define i8 @ori(i8 %a) nounwind {
78 ; RV32I-NEXT: ori a0, a0, 5
83 ; RV64I-NEXT: ori a0, a0, 5
89 define i8 @andi(i8 %a) nounwind {
92 ; RV32I-NEXT: andi a0, a0, 6
97 ; RV64I-NEXT: andi a0, a0, 6
103 define i8 @slli(i8 %a) nounwind {
106 ; RV32I-NEXT: slli a0, a0, 7
111 ; RV64I-NEXT: slli a0, a0, 7
117 define i8 @srli(i8 %a) nounwind {
120 ; RV32I-NEXT: andi a0, a0, 192
121 ; RV32I-NEXT: srli a0, a0, 6
126 ; RV64I-NEXT: andi a0, a0, 192
127 ; RV64I-NEXT: srli a0, a0, 6
133 define i8 @srai(i8 %a) nounwind {
136 ; RV32I-NEXT: slli a0, a0, 24
137 ; RV32I-NEXT: srai a0, a0, 29
142 ; RV64I-NEXT: slli a0, a0, 56
143 ; RV64I-NEXT: srai a0, a0, 61
150 define i8 @add(i8 %a, i8 %b) nounwind {
153 ; RV32I-NEXT: add a0, a0, a1
158 ; RV64I-NEXT: add a0, a0, a1
164 define i8 @sub(i8 %a, i8 %b) nounwind {
167 ; RV32I-NEXT: sub a0, a0, a1
172 ; RV64I-NEXT: sub a0, a0, a1
178 define i8 @sll(i8 %a, i8 %b) nounwind {
181 ; RV32I-NEXT: sll a0, a0, a1
186 ; RV64I-NEXT: sll a0, a0, a1
192 define i8 @slt(i8 %a, i8 %b) nounwind {
195 ; RV32I-NEXT: slli a1, a1, 24
196 ; RV32I-NEXT: srai a1, a1, 24
197 ; RV32I-NEXT: slli a0, a0, 24
198 ; RV32I-NEXT: srai a0, a0, 24
199 ; RV32I-NEXT: slt a0, a0, a1
204 ; RV64I-NEXT: slli a1, a1, 56
205 ; RV64I-NEXT: srai a1, a1, 56
206 ; RV64I-NEXT: slli a0, a0, 56
207 ; RV64I-NEXT: srai a0, a0, 56
208 ; RV64I-NEXT: slt a0, a0, a1
210 %1 = icmp slt i8 %a, %b
211 %2 = zext i1 %1 to i8
215 define i8 @sltu(i8 %a, i8 %b) nounwind {
218 ; RV32I-NEXT: andi a1, a1, 255
219 ; RV32I-NEXT: andi a0, a0, 255
220 ; RV32I-NEXT: sltu a0, a0, a1
225 ; RV64I-NEXT: andi a1, a1, 255
226 ; RV64I-NEXT: andi a0, a0, 255
227 ; RV64I-NEXT: sltu a0, a0, a1
229 %1 = icmp ult i8 %a, %b
230 %2 = zext i1 %1 to i8
234 define i8 @xor(i8 %a, i8 %b) nounwind {
237 ; RV32I-NEXT: xor a0, a0, a1
242 ; RV64I-NEXT: xor a0, a0, a1
248 define i8 @srl(i8 %a, i8 %b) nounwind {
251 ; RV32I-NEXT: andi a0, a0, 255
252 ; RV32I-NEXT: srl a0, a0, a1
257 ; RV64I-NEXT: andi a0, a0, 255
258 ; RV64I-NEXT: srl a0, a0, a1
264 define i8 @sra(i8 %a, i8 %b) nounwind {
267 ; RV32I-NEXT: slli a0, a0, 24
268 ; RV32I-NEXT: srai a0, a0, 24
269 ; RV32I-NEXT: sra a0, a0, a1
274 ; RV64I-NEXT: slli a0, a0, 56
275 ; RV64I-NEXT: srai a0, a0, 56
276 ; RV64I-NEXT: sra a0, a0, a1
282 define i8 @or(i8 %a, i8 %b) nounwind {
285 ; RV32I-NEXT: or a0, a0, a1
290 ; RV64I-NEXT: or a0, a0, a1
296 define i8 @and(i8 %a, i8 %b) nounwind {
299 ; RV32I-NEXT: and a0, a0, a1
304 ; RV64I-NEXT: and a0, a0, a1