1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
3 ; RUN: | FileCheck %s -check-prefix=RV64I
5 ; These tests must not compile to sllw/srlw/sraw, as this would be semantically
6 ; incorrect in the case that %b holds a value between 32 and 63. Selection
7 ; patterns might make the mistake of assuming that a (sext_inreg foo, i32) can
8 ; only be produced when sign-extending an i32 type.
10 define i64 @tricky_shl(i64 %a, i64 %b) nounwind {
11 ; RV64I-LABEL: tricky_shl:
13 ; RV64I-NEXT: sll a0, a0, a1
14 ; RV64I-NEXT: sext.w a0, a0
22 define i64 @tricky_lshr(i64 %a, i64 %b) nounwind {
23 ; RV64I-LABEL: tricky_lshr:
25 ; RV64I-NEXT: slli a0, a0, 32
26 ; RV64I-NEXT: srli a0, a0, 32
27 ; RV64I-NEXT: srl a0, a0, a1
29 %1 = and i64 %a, 4294967295
34 define i64 @tricky_ashr(i64 %a, i64 %b) nounwind {
35 ; RV64I-LABEL: tricky_ashr:
37 ; RV64I-NEXT: sext.w a0, a0
38 ; RV64I-NEXT: sra a0, a0, a1