64 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py2; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck --check-prefixes=ALL %s3; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck --check-prefixes=ALL-SIZE %s4; END.5 6define amdgpu_kernel void @test_br_cost(ptr addrspace(1) %vaddr, i32 %b) #0 {7; ALL-LABEL: 'test_br_cost'8; ALL-NEXT: Cost Model: Found an estimated cost of 7 for instruction: br i1 undef, label %bb1, label %bb29; ALL-NEXT: Cost Model: Found an estimated cost of 4 for instruction: br label %bb210; ALL-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %phi = phi i32 [ %b, %bb0 ], [ undef, %bb1 ]11; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void12;13; ALL-SIZE-LABEL: 'test_br_cost'14; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 5 for instruction: br i1 undef, label %bb1, label %bb215; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: br label %bb216; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %phi = phi i32 [ %b, %bb0 ], [ undef, %bb1 ]17; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void18;19bb0:20 br i1 undef, label %bb1, label %bb221 22bb1:23 br label %bb224 25bb2:26 %phi = phi i32 [ %b, %bb0 ], [ undef, %bb1 ]27 ret void28}29 30define amdgpu_kernel void @test_switch_cost(i32 %a) #0 {31; ALL-LABEL: 'test_switch_cost'32; ALL-NEXT: Cost Model: Found an estimated cost of 24 for instruction: switch i32 %a, label %default [33; ALL-NEXT: i32 0, label %case034; ALL-NEXT: i32 1, label %case135; ALL-NEXT: ]36; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void37; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void38; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void39;40; ALL-SIZE-LABEL: 'test_switch_cost'41; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 18 for instruction: switch i32 %a, label %default [42; ALL-SIZE-NEXT: i32 0, label %case043; ALL-SIZE-NEXT: i32 1, label %case144; ALL-SIZE-NEXT: ]45; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void46; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void47; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void48;49entry:50 switch i32 %a, label %default [51 i32 0, label %case052 i32 1, label %case153 ]54 55case0:56 ret void57 58case1:59 ret void60 61default:62 ret void63}64