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
7 define i32 @and_0xfff_shl_2(i32 %x) {
8 ; RV32I-LABEL: and_0xfff_shl_2:
10 ; RV32I-NEXT: slli a0, a0, 20
11 ; RV32I-NEXT: srli a0, a0, 18
14 ; RV64I-LABEL: and_0xfff_shl_2:
16 ; RV64I-NEXT: slli a0, a0, 52
17 ; RV64I-NEXT: srli a0, a0, 50
24 define i32 @and_0x7ff_shl_2(i32 %x) {
25 ; RV32I-LABEL: and_0x7ff_shl_2:
27 ; RV32I-NEXT: andi a0, a0, 2047
28 ; RV32I-NEXT: slli a0, a0, 2
31 ; RV64I-LABEL: and_0x7ff_shl_2:
33 ; RV64I-NEXT: andi a0, a0, 2047
34 ; RV64I-NEXT: slli a0, a0, 2
41 define i64 @and_0xffffffff_shl_2(i64 %x) {
42 ; RV32I-LABEL: and_0xffffffff_shl_2:
44 ; RV32I-NEXT: slli a2, a0, 2
45 ; RV32I-NEXT: srli a1, a0, 30
46 ; RV32I-NEXT: mv a0, a2
49 ; RV64I-LABEL: and_0xffffffff_shl_2:
51 ; RV64I-NEXT: slli a0, a0, 32
52 ; RV64I-NEXT: srli a0, a0, 30
54 %a = and i64 %x, 4294967295
59 define i32 @and_0xfff_shl_2_multi_use(i32 %x) {
60 ; RV32I-LABEL: and_0xfff_shl_2_multi_use:
62 ; RV32I-NEXT: slli a0, a0, 20
63 ; RV32I-NEXT: srli a0, a0, 20
64 ; RV32I-NEXT: slli a1, a0, 2
65 ; RV32I-NEXT: add a0, a0, a1
68 ; RV64I-LABEL: and_0xfff_shl_2_multi_use:
70 ; RV64I-NEXT: slli a0, a0, 52
71 ; RV64I-NEXT: srli a0, a0, 52
72 ; RV64I-NEXT: slli a1, a0, 2
73 ; RV64I-NEXT: add a0, a0, a1