1; RUN: llc -march=hexagon -O3 -verify-machineinstrs < %s | FileCheck %s 2; REQUIRES: asserts 3 4; Check for sane output. This testcase used to crash. 5; CHECK: jumpr r31 6 7target triple = "hexagon" 8 9@g0 = external hidden unnamed_addr constant [9 x i16], align 8 10 11; Function Attrs: nounwind readnone 12define i64 @fred(i32 %a0) local_unnamed_addr #0 { 13b1: 14 %v2 = icmp slt i32 %a0, 1 15 br i1 %v2, label %b26, label %b3 16 17b3: ; preds = %b1 18 %v4 = tail call i32 @llvm.hexagon.S2.clb(i32 %a0) 19 %v5 = add nsw i32 %v4, -12 20 %v6 = add nsw i32 %v4, -28 21 %v7 = tail call i32 @llvm.hexagon.S2.asl.r.r(i32 %a0, i32 %v6) 22 %v8 = add nsw i32 %v7, -8 23 %v9 = tail call i32 @llvm.hexagon.S2.asl.r.r(i32 %a0, i32 %v5) 24 %v10 = getelementptr inbounds [9 x i16], [9 x i16]* @g0, i32 0, i32 %v8 25 %v11 = load i16, i16* %v10, align 2 26 %v12 = sext i16 %v11 to i32 27 %v13 = shl nsw i32 %v12, 16 28 %v14 = add nsw i32 %v7, -7 29 %v15 = getelementptr inbounds [9 x i16], [9 x i16]* @g0, i32 0, i32 %v14 30 %v16 = load i16, i16* %v15, align 2 31 %v17 = sub i16 %v11, %v16 32 %v18 = and i32 %v9, 65535 33 %v19 = zext i16 %v17 to i32 34 %v20 = tail call i32 @llvm.hexagon.M2.mpyu.nac.ll.s0(i32 %v13, i32 %v18, i32 %v19) #1 35 %v21 = add nsw i32 %v4, -32 36 %v22 = zext i32 %v21 to i64 37 %v23 = shl nuw i64 %v22, 32 38 %v24 = zext i32 %v20 to i64 39 %v25 = or i64 %v23, %v24 40 br label %b26 41 42b26: ; preds = %b3, %b1 43 %v27 = phi i64 [ %v25, %b3 ], [ 2147483648, %b1 ] 44 ret i64 %v27 45} 46 47declare i32 @llvm.hexagon.S2.clb(i32) #1 48declare i32 @llvm.hexagon.S2.asl.r.r(i32, i32) #1 49declare i32 @llvm.hexagon.M2.mpyu.nac.ll.s0(i32, i32, i32) #1 50 51attributes #0 = { nounwind readnone "target-cpu"="hexagonv55" "target-features"="-hvx,-long-calls" } 52attributes #1 = { nounwind readnone } 53