brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · 179b784 Raw
118 lines · plain
1# RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple powerpc64le-unknown-linux-gnu \2# RUN:   -run-pass=codegenprepare -o - %s | FileCheck %s3# RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple powerpc64le-unknown-linux-gnu \4# RUN:   -run-pass=codegenprepare -o - %s | FileCheck %s5--- |6  define i32 @weighted_select1(i32 %a, i32 %b) {7    %cmp = icmp ne i32 %a, 08    %sel = select i1 %cmp, i32 %a, i32 %b, !prof !149    ret i32 %sel10 11  ; If branch_weights > 99% or branch_weights < 1%, the select will be12  ; converted to branch, here !14 = 99/100, !14 = 99%, so it will do nothing.13  ; CHECK-LABEL: weighted_select114  ; CHECK:         %cmp = icmp ne i32 %a, 015  ; CHECK-NEXT:    %sel = select i1 %cmp, i32 %a, i32 %b, !prof !1416  ; CHECK-NEXT:    ret i32 %sel17  }18 19  define i32 @weighted_select2(i32 %a, i32 %b) {20    %cmp = icmp ne i32 %a, 021    %sel = select i1 %cmp, i32 %a, i32 %b, !prof !1522    ret i32 %sel23 24  ; If branch_weights > 99% or branch_weights < 1%, the select will be converted25  ; to branch, here !15 = 100/101, !15 > 99%, so it will convert select to26  ; branch.27  ; CHECK-LABEL: weighted_select228  ; CHECK:         %sel.frozen = freeze i32 %a29  ; CHECK:         %cmp = icmp ne i32 %sel.frozen, 030  ; CHECK-NEXT:    br i1 %cmp, label %select.end, label %select.false, !prof !1531  ; CHECK:       select.false:32  ; CHECK-NEXT:    br label %select.end33  ; CHECK:       select.end:34  ; CHECK-NEXT:    %sel = phi i32 [ %a, %0 ], [ %b, %select.false ]35  ; CHECK-NEXT:    ret i32 %sel36  }37 38  define i32 @weighted_select3(i32 %a, i32 %b) {39    %cmp = icmp ne i32 %a, 040    %sel = select i1 %cmp, i32 %a, i32 %b, !prof !1641    ret i32 %sel42 43  ; If branch_weights > 99% or branch_weights < 1%, the select will be converted44  ; to branch, here !16 = 1/101, !16 < 1%, so it will convert select to branch.45  ; CHECK-LABEL: weighted_select346  ; CHECK:         %sel.frozen = freeze i32 %a47  ; CHECK:         %cmp = icmp ne i32 %sel.frozen, 048  ; CHECK-NEXT:    br i1 %cmp, label %select.end, label %select.false, !prof !1649  ; CHECK:       select.false:50  ; CHECK-NEXT:    br label %select.end51  ; CHECK:       select.end:52  ; CHECK-NEXT:    %sel = phi i32 [ %a, %0 ], [ %b, %select.false ]53  ; CHECK-NEXT:    ret i32 %sel54  }55 56  define i32 @unweighted_select(i32 %a, i32 %b) {57    %cmp = icmp ne i32 %a, 058    %sel = select i1 %cmp, i32 %a, i32 %b, !prof !1759    ret i32 %sel60 61  ; There is no weight_branch information, so it will do nothing.62  ; CHECK-LABEL: unweighted_select63  ; CHECK:         %cmp = icmp ne i32 %a, 064  ; CHECK-NEXT:    %sel = select i1 %cmp, i32 %a, i32 %b, !prof !1765  ; CHECK-NEXT:    ret i32 %sel66  }67 68  ; Function Attrs: optsize69  define i32 @weighted_select_optsize(i32 %a, i32 %b) #0 {70    %cmp = icmp ne i32 %a, 071    %sel = select i1 %cmp, i32 %a, i32 %b, !prof !1572    ret i32 %sel73 74  ; This function has used the optsize flag, so it will do nothing.75  ; CHECK-LABEL: weighted_select_optsize76  ; CHECK:         %cmp = icmp ne i32 %a, 077  ; CHECK-NEXT:    %sel = select i1 %cmp, i32 %a, i32 %b, !prof !1578  ; CHECK-NEXT:    ret i32 %sel79  }80 81  define i32 @weighted_select_pgso(i32 %a, i32 %b) !prof !18 {82    %cmp = icmp ne i32 %a, 083    %sel = select i1 %cmp, i32 %a, i32 %b, !prof !1584    ret i32 %sel85 86  ; The function_entry_count of this function is 0, so it will do nothing.87  ; CHECK-LABEL: weighted_select_pgso88  ; CHECK:         %cmp = icmp ne i32 %a, 089  ; CHECK-NEXT:    %sel = select i1 %cmp, i32 %a, i32 %b, !prof !1590  ; CHECK-NEXT:    ret i32 %sel91  }92  93  attributes #0 = { optsize }94  95  !llvm.module.flags = !{!0}96  97  !0 = !{i32 1, !"ProfileSummary", !1}98  !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}99  !2 = !{!"ProfileFormat", !"InstrProf"}100  !3 = !{!"TotalCount", i64 10000}101  !4 = !{!"MaxCount", i64 10}102  !5 = !{!"MaxInternalCount", i64 1}103  !6 = !{!"MaxFunctionCount", i64 1000}104  !7 = !{!"NumCounts", i64 3}105  !8 = !{!"NumFunctions", i64 3}106  !9 = !{!"DetailedSummary", !10}107  !10 = !{!11, !12, !13}108  !11 = !{i32 10000, i64 100, i32 1}109  !12 = !{i32 999000, i64 100, i32 1}110  !13 = !{i32 999999, i64 1, i32 2}111  !14 = !{!"branch_weights", i32 1, i32 99}112  !15 = !{!"branch_weights", i32 1, i32 100}113  !16 = !{!"branch_weights", i32 100, i32 1}114  !17 = !{!"branch_weights", i32 0, i32 0}115  !18 = !{!"function_entry_count", i64 0}116 117...118