1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck --check-prefixes=ALL %s
3 ; RUN: opt -passes="print<cost-model>" -cost-kind=code-size 2>&1 -disable-output -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck --check-prefixes=ALL-SIZE %s
6 define 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 %bb2
9 ; ALL-NEXT: Cost Model: Found an estimated cost of 4 for instruction: br label %bb2
10 ; 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 void
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 %bb2
15 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: br label %bb2
16 ; 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 void
20 br i1 undef, label %bb1, label %bb2
26 %phi = phi i32 [ %b, %bb0 ], [ undef, %bb1 ]
30 define 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 %case0
34 ; ALL-NEXT: i32 1, label %case1
36 ; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
37 ; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
38 ; ALL-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
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 %case0
43 ; ALL-SIZE-NEXT: i32 1, label %case1
45 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
46 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
47 ; ALL-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
50 switch i32 %a, label %default [