1; RUN: llc -march=hexagon -O2 -spill-func-threshold=4 < %s | FileCheck %s --check-prefix=NOSAVE 2; RUN: llc -march=hexagon -O2 -spill-func-threshold=2 < %s | FileCheck %s --check-prefix=SAVE 3; NOSAVE-NOT: call __save_r16_ 4; SAVE: call __save_r16_ 5 6target triple = "hexagon" 7 8%s.0 = type { %s.1, [50 x %s.2], i8, i32 } 9%s.1 = type { i8, i8, i8, i8, i8, i8, i8, i8, [2 x i8], [2 x i8], [4 x i8] } 10%s.2 = type { %s.3, [16 x i8] } 11%s.3 = type { %s.4, %s.5 } 12%s.4 = type { i8, i8, [2 x i8], [4 x i8] } 13%s.5 = type { i16, i16 } 14 15@g0 = private unnamed_addr constant [21 x i8] c"....................\00", align 1 16@g1 = internal unnamed_addr global [1 x %s.0*] zeroinitializer, align 4 17 18; Function Attrs: nounwind 19define void @f0(i8 zeroext %a0, %s.0** nocapture %a1) #0 { 20b0: 21 %v0 = tail call i8* @f1(i8 zeroext %a0, i32 1424, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @g0, i32 0, i32 0), i32 118) #0 22 %v1 = bitcast i8* %v0 to %s.0* 23 %v2 = zext i8 %a0 to i32 24 %v3 = getelementptr inbounds [1 x %s.0*], [1 x %s.0*]* @g1, i32 0, i32 %v2 25 store %s.0* %v1, %s.0** %v3, align 4, !tbaa !0 26 store %s.0* %v1, %s.0** %a1, align 4, !tbaa !0 27 ret void 28} 29 30declare i8* @f1(i8 zeroext, i32, i8*, i32) 31 32; Function Attrs: nounwind 33define void @f2(i8 zeroext %a0) #0 { 34b0: 35 %v0 = zext i8 %a0 to i32 36 %v1 = getelementptr inbounds [1 x %s.0*], [1 x %s.0*]* @g1, i32 0, i32 %v0 37 %v2 = load %s.0*, %s.0** %v1, align 4, !tbaa !0 38 %v3 = getelementptr inbounds %s.0, %s.0* %v2, i32 0, i32 0, i32 0 39 tail call void @f3(i8 zeroext %a0, i8* %v3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @g0, i32 0, i32 0), i32 142) #0 40 store %s.0* null, %s.0** %v1, align 4, !tbaa !0 41 ret void 42} 43 44declare void @f3(i8 zeroext, i8*, i8*, i32) 45 46; Function Attrs: nounwind 47define void @f4(i8 zeroext %a0, i8 zeroext %a1, i8 zeroext %a2, i8 zeroext %a3, i8 zeroext %a4) #0 { 48b0: 49 %v0 = alloca [7 x i32], align 4 50 %v1 = zext i8 %a0 to i32 51 %v2 = getelementptr inbounds [1 x %s.0*], [1 x %s.0*]* @g1, i32 0, i32 %v1 52 %v3 = load %s.0*, %s.0** %v2, align 4, !tbaa !0 53 %v4 = getelementptr inbounds %s.0, %s.0* %v3, i32 0, i32 3 54 %v5 = load i32, i32* %v4, align 4, !tbaa !4 55 %v6 = and i32 %v5, 8 56 %v7 = icmp eq i32 %v6, 0 57 br i1 %v7, label %b2, label %b1 58 59b1: ; preds = %b0 60 %v8 = getelementptr inbounds [7 x i32], [7 x i32]* %v0, i32 0, i32 0 61 %v9 = bitcast [7 x i32]* %v0 to %s.2* 62 %v10 = call i32 @f5() #0 63 %v11 = getelementptr [7 x i32], [7 x i32]* %v0, i32 0, i32 1 64 store i32 %v10, i32* %v11, align 4 65 %v12 = call zeroext i16 @f6(i8 zeroext %a0) #0 66 %v13 = zext i16 %v12 to i32 67 %v14 = shl nuw i32 %v13, 16 68 %v15 = or i32 %v14, 260 69 store i32 %v15, i32* %v8, align 4 70 %v16 = zext i8 %a1 to i32 71 %v17 = getelementptr [7 x i32], [7 x i32]* %v0, i32 0, i32 2 72 %v18 = zext i8 %a2 to i32 73 %v19 = shl nuw nsw i32 %v18, 12 74 %v20 = zext i8 %a3 to i32 75 %v21 = shl nuw nsw i32 %v20, 16 76 %v22 = and i32 %v21, 458752 77 %v23 = and i32 %v19, 61440 78 %v24 = zext i8 %a4 to i32 79 %v25 = shl nuw nsw i32 %v24, 19 80 %v26 = and i32 %v25, 3670016 81 %v27 = or i32 %v23, %v16 82 %v28 = or i32 %v27, %v22 83 %v29 = or i32 %v28, %v26 84 %v30 = call zeroext i8 @f7(i8 zeroext %a0, i8 zeroext %a1) #0 85 %v31 = zext i8 %v30 to i32 86 %v32 = shl nuw nsw i32 %v31, 8 87 %v33 = and i32 %v32, 3840 88 %v34 = or i32 %v33, %v29 89 store i32 %v34, i32* %v17, align 4 90 %v35 = call i32 bitcast (i32 (...)* @f8 to i32 (i32, %s.2*)*)(i32 %v1, %s.2* %v9) #0 91 br label %b2 92 93b2: ; preds = %b1, %b0 94 ret void 95} 96 97declare i32 @f5() 98 99declare zeroext i16 @f6(i8 zeroext) 100 101declare zeroext i8 @f7(i8 zeroext, i8 zeroext) 102 103declare i32 @f8(...) 104 105attributes #0 = { nounwind } 106 107!0 = !{!1, !1, i64 0} 108!1 = !{!"any pointer", !2} 109!2 = !{!"omnipotent char", !3} 110!3 = !{!"Simple C/C++ TBAA"} 111!4 = !{!5, !5, i64 0} 112!5 = !{!"long", !2} 113