1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=riscv32 | FileCheck %s --check-prefixes=RV32
3 ; RUN: llc < %s -mtriple=riscv64 | FileCheck %s --check-prefixes=RV64
5 define signext i32 @test1(i32 signext %x) {
8 ; RV32-NEXT: slli a0, a0, 1
9 ; RV32-NEXT: addi a0, a0, 1
14 ; RV64-NEXT: slliw a0, a0, 1
15 ; RV64-NEXT: addi a0, a0, 1
22 define i64 @test2(i64 %x) {
25 ; RV32-NEXT: andi a0, a0, -4
26 ; RV32-NEXT: addi a0, a0, 2
31 ; RV64-NEXT: andi a0, a0, -4
32 ; RV64-NEXT: addi a0, a0, 2
39 define signext i32 @test3(i32 signext %x) {
42 ; RV32-NEXT: slli a0, a0, 3
43 ; RV32-NEXT: addi a0, a0, 6
48 ; RV64-NEXT: slliw a0, a0, 3
49 ; RV64-NEXT: addi a0, a0, 6
56 define i64 @test4(i64 %x) {
59 ; RV32-NEXT: srli a2, a0, 28
60 ; RV32-NEXT: slli a1, a1, 4
61 ; RV32-NEXT: or a1, a1, a2
62 ; RV32-NEXT: slli a0, a0, 4
63 ; RV32-NEXT: addi a0, a0, 13
68 ; RV64-NEXT: slli a0, a0, 4
69 ; RV64-NEXT: addi a0, a0, 13
76 define signext i32 @test5(i32 signext %x) {
79 ; RV32-NEXT: srli a0, a0, 24
80 ; RV32-NEXT: addi a0, a0, 256
85 ; RV64-NEXT: srliw a0, a0, 24
86 ; RV64-NEXT: addi a0, a0, 256
93 define i64 @test6(i64 %x) {
96 ; RV32-NEXT: srli a1, a1, 22
97 ; RV32-NEXT: addi a0, a1, 1024
103 ; RV64-NEXT: srli a0, a0, 54
104 ; RV64-NEXT: addi a0, a0, 1024
107 %b = xor i64 %a, 1024
111 define signext i32 @test7(i32 signext %x) {
114 ; RV32-NEXT: addi a0, a0, 1
119 ; RV64-NEXT: ori a0, a0, 1
121 %a = or disjoint i32 %x, 1