1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -global-isel -verify-machineinstrs -O0 < %s \
3 ; RUN: | FileCheck %s --check-prefixes=RV32,RV32-O0
4 ; RUN: llc -mtriple=riscv64 -global-isel -verify-machineinstrs -O0 < %s \
5 ; RUN: | FileCheck %s --check-prefixes=RV64,RV64-O0
6 ; RUN: llc -mtriple=riscv32 -global-isel -verify-machineinstrs < %s \
7 ; RUN: | FileCheck %s --check-prefixes=RV32,RV32-OPT
8 ; RUN: llc -mtriple=riscv64 -global-isel -verify-machineinstrs < %s \
9 ; RUN: | FileCheck %s --check-prefixes=RV64,RV64-OPT
11 define i32 @constant_to_rhs(i32 %x) {
12 ; RV32-O0-LABEL: constant_to_rhs:
14 ; RV32-O0-NEXT: mv a1, a0
15 ; RV32-O0-NEXT: li a0, 1
16 ; RV32-O0-NEXT: add a0, a0, a1
19 ; RV64-O0-LABEL: constant_to_rhs:
21 ; RV64-O0-NEXT: mv a1, a0
22 ; RV64-O0-NEXT: li a0, 1
23 ; RV64-O0-NEXT: add a0, a0, a1
26 ; RV32-OPT-LABEL: constant_to_rhs:
28 ; RV32-OPT-NEXT: addi a0, a0, 1
31 ; RV64-OPT-LABEL: constant_to_rhs:
33 ; RV64-OPT-NEXT: addi a0, a0, 1
39 define i32 @mul_to_shift(i32 %x) {
40 ; RV32-LABEL: mul_to_shift:
42 ; RV32-NEXT: slli a0, a0, 2
45 ; RV64-LABEL: mul_to_shift:
47 ; RV64-NEXT: slli a0, a0, 2