• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
7define void @test_br_cost(i32 addrspace(1)* %out, i32 addrspace(1)* %vaddr, i32 %b) #0 {
8bb0:
9  br i1 undef, label %bb1, label %bb2
10
11bb1:
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
17bb2:
18  ret void
19
20}
21
22; CHECK: 'test_switch_cost'
23; CHECK: Unknown cost for instruction:   switch
24define void @test_switch_cost(i32 %a) #0 {
25entry:
26  switch i32 %a, label %default [
27    i32 0, label %case0
28    i32 1, label %case1
29  ]
30
31case0:
32  store volatile i32 undef, i32 addrspace(1)* undef
33  ret void
34
35case1:
36  store volatile i32 undef, i32 addrspace(1)* undef
37  ret void
38
39default:
40  store volatile i32 undef, i32 addrspace(1)* undef
41  ret void
42
43end:
44  ret void
45}
46