Skip to content

Commit 8d60458

Browse files
committed
[RISCV][test] Add and-shl.ll
1 parent 7ea1fe7 commit 8d60458

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

llvm/test/CodeGen/RISCV/and-shl.ll

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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
6+
7+
define i32 @and_0xfff_shl_2(i32 %x) {
8+
; RV32I-LABEL: and_0xfff_shl_2:
9+
; RV32I: # %bb.0:
10+
; RV32I-NEXT: slli a0, a0, 20
11+
; RV32I-NEXT: srli a0, a0, 20
12+
; RV32I-NEXT: slli a0, a0, 2
13+
; RV32I-NEXT: ret
14+
;
15+
; RV64I-LABEL: and_0xfff_shl_2:
16+
; RV64I: # %bb.0:
17+
; RV64I-NEXT: slli a0, a0, 52
18+
; RV64I-NEXT: srli a0, a0, 52
19+
; RV64I-NEXT: slli a0, a0, 2
20+
; RV64I-NEXT: ret
21+
%a = and i32 %x, 4095
22+
%s = shl i32 %a, 2
23+
ret i32 %s
24+
}

0 commit comments

Comments
 (0)