1 ; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck %s
4 ; CHECK: estimated cost of 0 for {{.*}} call float @llvm.fabs.f32
5 define amdgpu_kernel void @fabs_f32(float addrspace(1)* %out, float addrspace(1)* %vaddr) #0 {
6 %vec = load float, float addrspace(1)* %vaddr
7 %fabs = call float @llvm.fabs.f32(float %vec) #1
8 store float %fabs, float addrspace(1)* %out
13 ; CHECK: estimated cost of 0 for {{.*}} call <2 x float> @llvm.fabs.v2f32
14 define amdgpu_kernel void @fabs_v2f32(<2 x float> addrspace(1)* %out, <2 x float> addrspace(1)* %vaddr) #0 {
15 %vec = load <2 x float>, <2 x float> addrspace(1)* %vaddr
16 %fabs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %vec) #1
17 store <2 x float> %fabs, <2 x float> addrspace(1)* %out
22 ; CHECK: estimated cost of 0 for {{.*}} call <3 x float> @llvm.fabs.v3f32
23 define amdgpu_kernel void @fabs_v3f32(<3 x float> addrspace(1)* %out, <3 x float> addrspace(1)* %vaddr) #0 {
24 %vec = load <3 x float>, <3 x float> addrspace(1)* %vaddr
25 %fabs = call <3 x float> @llvm.fabs.v3f32(<3 x float> %vec) #1
26 store <3 x float> %fabs, <3 x float> addrspace(1)* %out
31 ; CHECK: estimated cost of 0 for {{.*}} call <5 x float> @llvm.fabs.v5f32
32 define amdgpu_kernel void @fabs_v5f32(<5 x float> addrspace(1)* %out, <5 x float> addrspace(1)* %vaddr) #0 {
33 %vec = load <5 x float>, <5 x float> addrspace(1)* %vaddr
34 %fabs = call <5 x float> @llvm.fabs.v5f32(<5 x float> %vec) #1
35 store <5 x float> %fabs, <5 x float> addrspace(1)* %out
40 ; CHECK: estimated cost of 0 for {{.*}} call double @llvm.fabs.f64
41 define amdgpu_kernel void @fabs_f64(double addrspace(1)* %out, double addrspace(1)* %vaddr) #0 {
42 %vec = load double, double addrspace(1)* %vaddr
43 %fabs = call double @llvm.fabs.f64(double %vec) #1
44 store double %fabs, double addrspace(1)* %out
49 ; CHECK: estimated cost of 0 for {{.*}} call <2 x double> @llvm.fabs.v2f64
50 define amdgpu_kernel void @fabs_v2f64(<2 x double> addrspace(1)* %out, <2 x double> addrspace(1)* %vaddr) #0 {
51 %vec = load <2 x double>, <2 x double> addrspace(1)* %vaddr
52 %fabs = call <2 x double> @llvm.fabs.v2f64(<2 x double> %vec) #1
53 store <2 x double> %fabs, <2 x double> addrspace(1)* %out
58 ; CHECK: estimated cost of 0 for {{.*}} call <3 x double> @llvm.fabs.v3f64
59 define amdgpu_kernel void @fabs_v3f64(<3 x double> addrspace(1)* %out, <3 x double> addrspace(1)* %vaddr) #0 {
60 %vec = load <3 x double>, <3 x double> addrspace(1)* %vaddr
61 %fabs = call <3 x double> @llvm.fabs.v3f64(<3 x double> %vec) #1
62 store <3 x double> %fabs, <3 x double> addrspace(1)* %out
67 ; CHECK: estimated cost of 0 for {{.*}} call half @llvm.fabs.f16
68 define amdgpu_kernel void @fabs_f16(half addrspace(1)* %out, half addrspace(1)* %vaddr) #0 {
69 %vec = load half, half addrspace(1)* %vaddr
70 %fabs = call half @llvm.fabs.f16(half %vec) #1
71 store half %fabs, half addrspace(1)* %out
76 ; CHECK: estimated cost of 0 for {{.*}} call <2 x half> @llvm.fabs.v2f16
77 define amdgpu_kernel void @fabs_v2f16(<2 x half> addrspace(1)* %out, <2 x half> addrspace(1)* %vaddr) #0 {
78 %vec = load <2 x half>, <2 x half> addrspace(1)* %vaddr
79 %fabs = call <2 x half> @llvm.fabs.v2f16(<2 x half> %vec) #1
80 store <2 x half> %fabs, <2 x half> addrspace(1)* %out
85 ; CHECK: estimated cost of 0 for {{.*}} call <3 x half> @llvm.fabs.v3f16
86 define amdgpu_kernel void @fabs_v3f16(<3 x half> addrspace(1)* %out, <3 x half> addrspace(1)* %vaddr) #0 {
87 %vec = load <3 x half>, <3 x half> addrspace(1)* %vaddr
88 %fabs = call <3 x half> @llvm.fabs.v3f16(<3 x half> %vec) #1
89 store <3 x half> %fabs, <3 x half> addrspace(1)* %out
93 declare float @llvm.fabs.f32(float) #1
94 declare <2 x float> @llvm.fabs.v2f32(<2 x float>) #1
95 declare <3 x float> @llvm.fabs.v3f32(<3 x float>) #1
96 declare <5 x float> @llvm.fabs.v5f32(<5 x float>) #1
98 declare double @llvm.fabs.f64(double) #1
99 declare <2 x double> @llvm.fabs.v2f64(<2 x double>) #1
100 declare <3 x double> @llvm.fabs.v3f64(<3 x double>) #1
102 declare half @llvm.fabs.f16(half) #1
103 declare <2 x half> @llvm.fabs.v2f16(<2 x half>) #1
104 declare <3 x half> @llvm.fabs.v3f16(<3 x half>) #1
106 attributes #0 = { nounwind }
107 attributes #1 = { nounwind readnone }