Home | History | Annotate | Download | only in Hexagon
      1 ; RUN: llc -O2 < %s
      2 ; REQUIRES: asserts
      3 
      4 target datalayout = "e-m:e-p:32:32-i1:32-i64:64-a:0-v32:32-n16:32"
      5 target triple = "hexagon-unknown--elf"
      6 
      7 %struct.cpumask = type { [1 x i32] }
      8 %struct.load_weight = type { i32, i32 }
      9 
     10 @sysctl_sched_latency = global i32 6000000, align 4
     11 @normalized_sysctl_sched_latency = global i32 6000000, align 4
     12 @sysctl_sched_tunable_scaling = global i8 1, align 1
     13 @sysctl_sched_min_granularity = global i32 750000, align 4
     14 @normalized_sysctl_sched_min_granularity = global i32 750000, align 4
     15 @sysctl_sched_wakeup_granularity = global i32 1000000, align 4
     16 @normalized_sysctl_sched_wakeup_granularity = global i32 1000000, align 4
     17 @sysctl_sched_migration_cost = constant i32 500000, align 4
     18 @sysctl_sched_shares_window = global i32 10000000, align 4
     19 @sysctl_sched_child_runs_first = common global i32 0, align 4
     20 @cpu_online_mask = external constant %struct.cpumask*
     21 
     22 ; Function Attrs: noinline nounwind
     23 define void @sched_init_granularity() #0 {
     24 entry:
     25   tail call fastcc void @update_sysctl()
     26   ret void
     27 }
     28 
     29 ; Function Attrs: noinline nounwind
     30 define internal fastcc void @update_sysctl() #0 {
     31 entry:
     32   %call = tail call i32 @get_update_sysctl_factor()
     33   %0 = load i32, i32* @normalized_sysctl_sched_min_granularity, align 4, !tbaa !1
     34   %mul = mul i32 %0, %call
     35   store i32 %mul, i32* @sysctl_sched_min_granularity, align 4, !tbaa !1
     36   %1 = load i32, i32* @normalized_sysctl_sched_latency, align 4, !tbaa !1
     37   %mul1 = mul i32 %1, %call
     38   store i32 %mul1, i32* @sysctl_sched_latency, align 4, !tbaa !1
     39   %2 = load i32, i32* @normalized_sysctl_sched_wakeup_granularity, align 4, !tbaa !1
     40   %mul2 = mul i32 %2, %call
     41   store i32 %mul2, i32* @sysctl_sched_wakeup_granularity, align 4, !tbaa !1
     42   ret void
     43 }
     44 
     45 ; Function Attrs: noinline nounwind
     46 define i32 @calc_delta_mine(i32 %delta_exec, i32 %weight, %struct.load_weight* nocapture %lw) #0 {
     47 entry:
     48   %cmp = icmp ugt i32 %weight, 1
     49   %conv = zext i32 %delta_exec to i64
     50   br i1 %cmp, label %if.then, label %if.end, !prof !5
     51 
     52 if.then:                                          ; preds = %entry
     53   %conv2 = zext i32 %weight to i64
     54   %mul = mul i64 %conv2, %conv
     55   br label %if.end
     56 
     57 if.end:                                           ; preds = %entry, %if.then
     58   %tmp.0 = phi i64 [ %mul, %if.then ], [ %conv, %entry ]
     59   %inv_weight = getelementptr inbounds %struct.load_weight, %struct.load_weight* %lw, i32 0, i32 1
     60   %0 = load i32, i32* %inv_weight, align 4, !tbaa !6
     61   %tobool4 = icmp eq i32 %0, 0
     62   br i1 %tobool4, label %if.then5, label %if.end22
     63 
     64 if.then5:                                         ; preds = %if.end
     65   %weight7 = getelementptr inbounds %struct.load_weight, %struct.load_weight* %lw, i32 0, i32 0
     66   %1 = load i32, i32* %weight7, align 4, !tbaa !9
     67   %lnot9 = icmp eq i32 %1, 0
     68   br i1 %lnot9, label %if.then17, label %if.else19, !prof !10
     69 
     70 if.then17:                                        ; preds = %if.then5
     71   store i32 -1, i32* %inv_weight, align 4, !tbaa !6
     72   br label %if.end22
     73 
     74 if.else19:                                        ; preds = %if.then5
     75   %div = udiv i32 -1, %1
     76   store i32 %div, i32* %inv_weight, align 4, !tbaa !6
     77   br label %if.end22
     78 
     79 if.end22:                                         ; preds = %if.end, %if.then17, %if.else19
     80   %2 = phi i32 [ %0, %if.end ], [ -1, %if.then17 ], [ %div, %if.else19 ]
     81   %cmp23 = icmp ugt i64 %tmp.0, 4294967295
     82   br i1 %cmp23, label %if.then31, label %if.else37, !prof !10
     83 
     84 if.then31:                                        ; preds = %if.end22
     85   %add = add i64 %tmp.0, 32768
     86   %shr = lshr i64 %add, 16
     87   %conv33 = zext i32 %2 to i64
     88   %mul34 = mul i64 %conv33, %shr
     89   %add35 = add i64 %mul34, 32768
     90   %shr36 = lshr i64 %add35, 16
     91   br label %if.end43
     92 
     93 if.else37:                                        ; preds = %if.end22
     94   %conv39 = zext i32 %2 to i64
     95   %mul40 = mul i64 %conv39, %tmp.0
     96   %add41 = add i64 %mul40, 2147483648
     97   %shr42 = lshr i64 %add41, 32
     98   br label %if.end43
     99 
    100 if.end43:                                         ; preds = %if.else37, %if.then31
    101   %tmp.1 = phi i64 [ %shr36, %if.then31 ], [ %shr42, %if.else37 ]
    102   %cmp49 = icmp ult i64 %tmp.1, 2147483647
    103   %3 = trunc i64 %tmp.1 to i32
    104   %conv51 = select i1 %cmp49, i32 %3, i32 2147483647
    105   ret i32 %conv51
    106 }
    107 
    108 declare i32 @get_update_sysctl_factor() #0
    109 declare i32 @__bitmap_weight(i32*, i32) #1
    110 
    111 attributes #0 = { noinline nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
    112 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
    113 attributes #2 = { nounwind }
    114 
    115 !llvm.ident = !{!0}
    116 
    117 !0 = !{!"Clang 3.1"}
    118 !1 = !{!2, !2, i64 0}
    119 !2 = !{!"int", !3, i64 0}
    120 !3 = !{!"omnipotent char", !4, i64 0}
    121 !4 = !{!"Simple C/C++ TBAA"}
    122 !5 = !{!"branch_weights", i32 64, i32 4}
    123 !6 = !{!7, !8, i64 4}
    124 !7 = !{!"load_weight", !8, i64 0, !8, i64 4}
    125 !8 = !{!"long", !3, i64 0}
    126 !9 = !{!7, !8, i64 0}
    127 !10 = !{!"branch_weights", i32 4, i32 64}
    128 !11 = !{!12, !12, i64 0}
    129 !12 = !{!"any pointer", !3, i64 0}
    130 !13 = !{!3, !3, i64 0}
    131 !14 = !{i32 45854, i32 45878}
    132