AMDGPU: Override getCFInstrCost
[oota-llvm.git] / test / Analysis / CostModel / AMDGPU / br.ll
1 ; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck %s
2
3 ; CHECK: 'test_br_cost'
4 ; CHECK: estimated cost of 10 for instruction: br i1
5 ; CHECK: estimated cost of 10 for instruction: br label
6 ; CHECK: estimated cost of 10 for instruction: ret void
7 define void @test_br_cost(i32 addrspace(1)* %out, i32 addrspace(1)* %vaddr, i32 %b) #0 {
8 bb0:
9   br i1 undef, label %bb1, label %bb2
10
11 bb1:
12   %vec = load i32, i32 addrspace(1)* %vaddr
13   %add = add i32 %vec, %b
14   store i32 %add, i32 addrspace(1)* %out
15   br label %bb2
16
17 bb2:
18   ret void
19
20 }
21
22 ; CHECK: 'test_switch_cost'
23 ; CHECK: Unknown cost for instruction:   switch
24 define void @test_switch_cost(i32 %a) #0 {
25 entry:
26   switch i32 %a, label %default [
27     i32 0, label %case0
28     i32 1, label %case1
29   ]
30
31 case0:
32   store volatile i32 undef, i32 addrspace(1)* undef
33   ret void
34
35 case1:
36   store volatile i32 undef, i32 addrspace(1)* undef
37   ret void
38
39 default:
40   store volatile i32 undef, i32 addrspace(1)* undef
41   ret void
42
43 end:
44   ret void
45 }