1 ; RUN: llc < %s -mtriple=ve | FileCheck %s
3 %struct.data = type { [4 x i8] }
5 ;;; Check basic usage of rri format load instructions.
6 ;;; Our target is DAG selection mechanism for LD1BSXrri.
7 ;;; We prepared following three styles.
8 ;;; 1. LD1BSXrri with %reg1 + %reg2
9 ;;; 2. LD1BSXrri with %frame-index + %reg
10 ;;; 3. LD1BSXrri with %reg + %frame-index
12 ; Function Attrs: norecurse nounwind readonly
13 define signext i8 @func_rr(%struct.data* nocapture readonly %0, i32 signext %1) {
14 ; CHECK-LABEL: func_rr:
16 ; CHECK-NEXT: sll %s1, %s1, 2
17 ; CHECK-NEXT: ld1b.sx %s0, (%s1, %s0)
18 ; CHECK-NEXT: b.l.t (, %s10)
19 %3 = sext i32 %1 to i64
20 %4 = getelementptr inbounds %struct.data, %struct.data* %0, i64 %3, i32 0, i64 0
21 %5 = load i8, i8* %4, align 1
25 ; Function Attrs: nounwind
26 define signext i8 @func_fr(%struct.data* readonly %0, i32 signext %1) {
27 ; CHECK-LABEL: func_fr:
28 ; CHECK: .LBB{{[0-9]+}}_2:
29 ; CHECK-NEXT: sll %s1, %s1, 2
30 ; CHECK-NEXT: ldl.sx %s0, (%s1, %s0)
31 ; CHECK-NEXT: stl %s0, 8(%s1, %s11)
32 ; CHECK-NEXT: ld1b.sx %s0, 8(%s1, %s11)
33 ; CHECK-NEXT: adds.l %s11, 48, %s11
34 ; CHECK-NEXT: b.l.t (, %s10)
35 %3 = alloca [10 x %struct.data], align 1
36 %4 = getelementptr inbounds [10 x %struct.data], [10 x %struct.data]* %3, i64 0, i64 0, i32 0, i64 0
37 call void @llvm.lifetime.start.p0i8(i64 40, i8* nonnull %4)
38 %5 = sext i32 %1 to i64
39 %6 = getelementptr inbounds [10 x %struct.data], [10 x %struct.data]* %3, i64 0, i64 %5, i32 0, i64 0
40 %7 = getelementptr inbounds %struct.data, %struct.data* %0, i64 %5, i32 0, i64 0
41 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 1 %6, i8* align 1 %7, i64 4, i1 true)
42 %8 = load volatile i8, i8* %6, align 1
43 call void @llvm.lifetime.end.p0i8(i64 40, i8* nonnull %4)
47 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
48 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg)
49 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
51 %"basic_string" = type { %union.anon.3, [23 x i8] }
52 %union.anon.3 = type { i8 }
54 define signext i8 @func_rf(i8* readonly %0, i64 %1, i32 signext %2) {
55 ; CHECK-LABEL: func_rf:
56 ; CHECK: .LBB{{[0-9]+}}_2:
57 ; CHECK-NEXT: ld1b.sx %s0, 8(%s1, %s11)
58 ; CHECK-NEXT: adds.l %s11, 32, %s11
59 ; CHECK-NEXT: b.l.t (, %s10)
60 %buf = alloca %"basic_string", align 8
62 %sub631 = add nsw i64 %1, -1
63 %add.ptr.i = getelementptr inbounds %"basic_string", %"basic_string"* %buf, i64 0, i32 1, i64 %sub631
64 %ret = load i8, i8* %add.ptr.i, align 1