1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mtriple=riscv32 -mattr=+v,+xtheadmemidx -verify-machineinstrs < %s \
3 ; RUN: | FileCheck %s --check-prefix RV32
4 ; RUN: llc -mtriple=riscv64 -mattr=+v,+xtheadmemidx -verify-machineinstrs < %s \
5 ; RUN: | FileCheck %s --check-prefix RV64
7 define i32 @test(i32 %size, ptr %add.ptr, i64 %const) {
9 ; RV32: # %bb.0: # %entry
10 ; RV32-NEXT: addi a3, a2, 1
11 ; RV32-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
12 ; RV32-NEXT: .LBB0_1: # %for.body
13 ; RV32-NEXT: # =>This Inner Loop Header: Depth=1
14 ; RV32-NEXT: mv a4, a1
15 ; RV32-NEXT: th.lbib a5, (a4), -1, 0
16 ; RV32-NEXT: th.lrb a4, a4, a0, 0
17 ; RV32-NEXT: vmv.v.x v8, a5
18 ; RV32-NEXT: vmv.s.x v9, zero
19 ; RV32-NEXT: vsetvli zero, a3, e8, mf2, tu, ma
20 ; RV32-NEXT: vslideup.vx v8, v9, a2
21 ; RV32-NEXT: vsetivli zero, 8, e8, mf2, tu, ma
22 ; RV32-NEXT: vmv.s.x v8, a4
23 ; RV32-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
24 ; RV32-NEXT: vmseq.vi v8, v8, 0
25 ; RV32-NEXT: vmv.x.s a4, v8
26 ; RV32-NEXT: andi a4, a4, 255
27 ; RV32-NEXT: bnez a4, .LBB0_1
28 ; RV32-NEXT: # %bb.2: # %if.then381
33 ; RV64: # %bb.0: # %entry
34 ; RV64-NEXT: sext.w a0, a0
35 ; RV64-NEXT: addi a3, a2, 1
36 ; RV64-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
37 ; RV64-NEXT: .LBB0_1: # %for.body
38 ; RV64-NEXT: # =>This Inner Loop Header: Depth=1
39 ; RV64-NEXT: mv a4, a1
40 ; RV64-NEXT: th.lbib a5, (a4), -1, 0
41 ; RV64-NEXT: th.lrb a4, a4, a0, 0
42 ; RV64-NEXT: vmv.v.x v8, a5
43 ; RV64-NEXT: vmv.s.x v9, zero
44 ; RV64-NEXT: vsetvli zero, a3, e8, mf2, tu, ma
45 ; RV64-NEXT: vslideup.vx v8, v9, a2
46 ; RV64-NEXT: vsetivli zero, 8, e8, mf2, tu, ma
47 ; RV64-NEXT: vmv.s.x v8, a4
48 ; RV64-NEXT: vsetvli zero, zero, e8, mf2, ta, ma
49 ; RV64-NEXT: vmseq.vi v8, v8, 0
50 ; RV64-NEXT: vmv.x.s a4, v8
51 ; RV64-NEXT: andi a4, a4, 255
52 ; RV64-NEXT: bnez a4, .LBB0_1
53 ; RV64-NEXT: # %bb.2: # %if.then381
59 for.body: ; preds = %for.body, %entry
60 %add.ptr1 = getelementptr i8, ptr %add.ptr, i32 -1
61 %add.ptr2 = getelementptr i8, ptr %add.ptr1, i32 %size
62 %0 = load i8, ptr %add.ptr1, align 1
63 %1 = load i8, ptr %add.ptr2, align 1
64 %2 = insertelement <8 x i8> poison, i8 %0, i64 0
65 %3 = insertelement <8 x i8> %2, i8 0, i64 %const
66 %4 = insertelement <8 x i8> %3, i8 %1, i64 0
67 %5 = icmp ult <8 x i8> %4, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
68 %6 = bitcast <8 x i1> %5 to i8
69 %7 = zext i8 %6 to i32
70 %cond = icmp eq i32 %7, 0
71 br i1 %cond, label %if.then381, label %for.body
73 if.then381: ; preds = %for.body