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
5 ; This test checks that unnecessary masking of shift amount operands is
6 ; eliminated during instruction selection. The test needs to ensure that the
7 ; masking is not removed if it may affect the shift amount.
9 define i32 @sll_redundant_mask(i32 %a, i32 %b) nounwind {
10 ; RV32I-LABEL: sll_redundant_mask:
12 ; RV32I-NEXT: sll a0, a0, a1
19 define i32 @sll_non_redundant_mask(i32 %a, i32 %b) nounwind {
20 ; RV32I-LABEL: sll_non_redundant_mask:
22 ; RV32I-NEXT: andi a1, a1, 15
23 ; RV32I-NEXT: sll a0, a0, a1
30 define i32 @srl_redundant_mask(i32 %a, i32 %b) nounwind {
31 ; RV32I-LABEL: srl_redundant_mask:
33 ; RV32I-NEXT: srl a0, a0, a1
40 define i32 @srl_non_redundant_mask(i32 %a, i32 %b) nounwind {
41 ; RV32I-LABEL: srl_non_redundant_mask:
43 ; RV32I-NEXT: andi a1, a1, 7
44 ; RV32I-NEXT: srl a0, a0, a1
51 define i32 @sra_redundant_mask(i32 %a, i32 %b) nounwind {
52 ; RV32I-LABEL: sra_redundant_mask:
54 ; RV32I-NEXT: sra a0, a0, a1
56 %1 = and i32 %b, 65535
61 define i32 @sra_non_redundant_mask(i32 %a, i32 %b) nounwind {
62 ; RV32I-LABEL: sra_non_redundant_mask:
64 ; RV32I-NEXT: andi a1, a1, 32
65 ; RV32I-NEXT: sra a0, a0, a1