1; RUN: opt -hexagon-loop-idiom -S < %s | FileCheck %s 2 3; Make sure that we generate correct runtime checks. 4 5; CHECK: b7.old: 6; CHECK: [[LEN:%[0-9]+]] = shl i32 %len, 3 7; CHECK: [[SRC:%[0-9]+]] = ptrtoint i8* %src to i32 8; CHECK: [[DST:%[0-9]+]] = ptrtoint i8* %dst to i32 9; CHECK: [[ULT:%[0-9]+]] = icmp ult i32 [[DST]], [[SRC]] 10; CHECK: [[SUB:%[0-9]+]] = sub i32 [[DST]], [[SRC]] 11; CHECK: [[SLT:%[0-9]+]] = icmp sle i32 [[LEN]], [[SUB]] 12; CHECK: [[CND:%[0-9]+]] = or i1 [[ULT]], [[SLT]] 13; CHECK: br i1 [[CND]], label %b8.rtli, label %b8.rtli.ph 14 15target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048" 16target triple = "hexagon" 17 18define void @fred(i8* %dst, i8* %src, i32 %len) #0 { 19b3: 20 %v4 = bitcast i8* %src to i64* 21 %v5 = bitcast i8* %dst to i64* 22 %v6 = icmp slt i32 0, %len 23 br i1 %v6, label %b7, label %b16 24 25b7: ; preds = %b3 26 br label %b8 27 28b8: ; preds = %b13, %b7 29 %v9 = phi i32 [ 0, %b7 ], [ %v14, %b13 ] 30 %v10 = getelementptr inbounds i64, i64* %v4, i32 %v9 31 %v11 = load i64, i64* %v10, align 8 32 %v12 = getelementptr inbounds i64, i64* %v5, i32 %v9 33 store i64 %v11, i64* %v12, align 8 34 br label %b13 35 36b13: ; preds = %b8 37 %v14 = add nsw i32 %v9, 1 38 %v15 = icmp slt i32 %v14, %len 39 br i1 %v15, label %b8, label %b16 40 41b16: ; preds = %b13, %b3 42 ret void 43} 44 45attributes #0 = { noinline nounwind "target-cpu"="hexagonv60" } 46