66 lines · plain
1; RUN: llc < %s -mtriple=ve | FileCheck %s2 3%struct.data = type { [4 x i8] }4 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 + %reg29;;; 2. LD1BSXrri with %frame-index + %reg10;;; 3. LD1BSXrri with %reg + %frame-index11 12; Function Attrs: norecurse nounwind readonly13define signext i8 @func_rr(ptr nocapture readonly %0, i32 signext %1) {14; CHECK-LABEL: func_rr:15; CHECK: # %bb.0:16; CHECK-NEXT: sll %s1, %s1, 217; CHECK-NEXT: ld1b.sx %s0, (%s1, %s0)18; CHECK-NEXT: b.l.t (, %s10)19 %3 = sext i32 %1 to i6420 %4 = getelementptr inbounds %struct.data, ptr %0, i64 %3, i32 0, i64 021 %5 = load i8, ptr %4, align 122 ret i8 %523}24 25; Function Attrs: nounwind26define signext i8 @func_fr(ptr readonly %0, i32 signext %1) {27; CHECK-LABEL: func_fr:28; CHECK: .LBB{{[0-9]+}}_2:29; CHECK-NEXT: sll %s1, %s1, 230; 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, %s1134; CHECK-NEXT: b.l.t (, %s10)35 %3 = alloca [10 x %struct.data], align 136 call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3)37 %4 = sext i32 %1 to i6438 %5 = getelementptr inbounds [10 x %struct.data], ptr %3, i64 0, i64 %4, i32 0, i64 039 %6 = getelementptr inbounds %struct.data, ptr %0, i64 %4, i32 0, i64 040 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %5, ptr align 1 %6, i64 4, i1 true)41 %7 = load volatile i8, ptr %5, align 142 call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3)43 ret i8 %744}45 46declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)47declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg)48declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)49 50%"basic_string" = type { %union.anon.3, [23 x i8] }51%union.anon.3 = type { i8 }52 53define signext i8 @func_rf(ptr readonly %0, i64 %1, i32 signext %2) {54; CHECK-LABEL: func_rf:55; CHECK: .LBB{{[0-9]+}}_2:56; CHECK-NEXT: ld1b.sx %s0, 8(%s1, %s11)57; CHECK-NEXT: adds.l %s11, 32, %s1158; CHECK-NEXT: b.l.t (, %s10)59 %buf = alloca %"basic_string", align 860 61 %sub631 = add nsw i64 %1, -162 %add.ptr.i = getelementptr inbounds %"basic_string", ptr %buf, i64 0, i32 1, i64 %sub63163 %ret = load i8, ptr %add.ptr.i, align 164 ret i8 %ret65}66