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