1 ; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck %s
4 ; CHECK: estimated cost of 3 for {{.*}} mul i32
5 define amdgpu_kernel void @mul_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %vaddr, i32 %b) #0 {
6 %vec = load i32, i32 addrspace(1)* %vaddr
7 %mul = mul i32 %vec, %b
8 store i32 %mul, i32 addrspace(1)* %out
13 ; CHECK: estimated cost of 6 for {{.*}} mul <2 x i32>
14 define amdgpu_kernel void @mul_v2i32(<2 x i32> addrspace(1)* %out, <2 x i32> addrspace(1)* %vaddr, <2 x i32> %b) #0 {
15 %vec = load <2 x i32>, <2 x i32> addrspace(1)* %vaddr
16 %mul = mul <2 x i32> %vec, %b
17 store <2 x i32> %mul, <2 x i32> addrspace(1)* %out
22 ; Allow for 12 when v3i32 is illegal and TargetLowering thinks it needs widening,
23 ; and 9 when it is legal.
24 ; CHECK: estimated cost of {{9|12}} for {{.*}} mul <3 x i32>
25 define amdgpu_kernel void @mul_v3i32(<3 x i32> addrspace(1)* %out, <3 x i32> addrspace(1)* %vaddr, <3 x i32> %b) #0 {
26 %vec = load <3 x i32>, <3 x i32> addrspace(1)* %vaddr
27 %mul = mul <3 x i32> %vec, %b
28 store <3 x i32> %mul, <3 x i32> addrspace(1)* %out
33 ; Allow for 24 when v5i32 is illegal and TargetLowering thinks it needs widening,
34 ; and 15 when it is legal.
35 ; CHECK: estimated cost of {{15|24}} for {{.*}} mul <5 x i32>
36 define amdgpu_kernel void @mul_v5i32(<5 x i32> addrspace(1)* %out, <5 x i32> addrspace(1)* %vaddr, <5 x i32> %b) #0 {
37 %vec = load <5 x i32>, <5 x i32> addrspace(1)* %vaddr
38 %mul = mul <5 x i32> %vec, %b
39 store <5 x i32> %mul, <5 x i32> addrspace(1)* %out
44 ; CHECK: estimated cost of 12 for {{.*}} mul <4 x i32>
45 define amdgpu_kernel void @mul_v4i32(<4 x i32> addrspace(1)* %out, <4 x i32> addrspace(1)* %vaddr, <4 x i32> %b) #0 {
46 %vec = load <4 x i32>, <4 x i32> addrspace(1)* %vaddr
47 %mul = mul <4 x i32> %vec, %b
48 store <4 x i32> %mul, <4 x i32> addrspace(1)* %out
53 ; CHECK: estimated cost of 16 for {{.*}} mul i64
54 define amdgpu_kernel void @mul_i64(i64 addrspace(1)* %out, i64 addrspace(1)* %vaddr, i64 %b) #0 {
55 %vec = load i64, i64 addrspace(1)* %vaddr
56 %mul = mul i64 %vec, %b
57 store i64 %mul, i64 addrspace(1)* %out
62 ; CHECK: estimated cost of 32 for {{.*}} mul <2 x i64>
63 define amdgpu_kernel void @mul_v2i64(<2 x i64> addrspace(1)* %out, <2 x i64> addrspace(1)* %vaddr, <2 x i64> %b) #0 {
64 %vec = load <2 x i64>, <2 x i64> addrspace(1)* %vaddr
65 %mul = mul <2 x i64> %vec, %b
66 store <2 x i64> %mul, <2 x i64> addrspace(1)* %out
71 ; CHECK: estimated cost of 48 for {{.*}} mul <3 x i64>
72 define amdgpu_kernel void @mul_v3i64(<3 x i64> addrspace(1)* %out, <3 x i64> addrspace(1)* %vaddr, <3 x i64> %b) #0 {
73 %vec = load <3 x i64>, <3 x i64> addrspace(1)* %vaddr
74 %mul = mul <3 x i64> %vec, %b
75 store <3 x i64> %mul, <3 x i64> addrspace(1)* %out
80 ; CHECK: estimated cost of 64 for {{.*}} mul <4 x i64>
81 define amdgpu_kernel void @mul_v4i64(<4 x i64> addrspace(1)* %out, <4 x i64> addrspace(1)* %vaddr, <4 x i64> %b) #0 {
82 %vec = load <4 x i64>, <4 x i64> addrspace(1)* %vaddr
83 %mul = mul <4 x i64> %vec, %b
84 store <4 x i64> %mul, <4 x i64> addrspace(1)* %out
90 ; CHECK: estimated cost of 128 for {{.*}} mul <8 x i64>
91 define amdgpu_kernel void @mul_v8i64(<8 x i64> addrspace(1)* %out, <8 x i64> addrspace(1)* %vaddr, <8 x i64> %b) #0 {
92 %vec = load <8 x i64>, <8 x i64> addrspace(1)* %vaddr
93 %mul = mul <8 x i64> %vec, %b
94 store <8 x i64> %mul, <8 x i64> addrspace(1)* %out
98 attributes #0 = { nounwind }