1; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck %s
2; RUN: opt -cost-model -cost-kind=code-size -analyze -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck %s
3; END.
4
5; CHECK-LABEL: 'fabs_f32'
6; CHECK: estimated cost of 0 for {{.*}} call float @llvm.fabs.f32
7; CHECK: estimated cost of 0 for {{.*}} call <2 x float> @llvm.fabs.v2f32
8; CHECK: estimated cost of 0 for {{.*}} call <3 x float> @llvm.fabs.v3f32
9; CHECK: estimated cost of 0 for {{.*}} call <5 x float> @llvm.fabs.v5f32
10define amdgpu_kernel void @fabs_f32() #0 {
11  %f32 = call float @llvm.fabs.f32(float undef) #1
12  %v2f32 = call <2 x float> @llvm.fabs.v2f32(<2 x float> undef) #1
13  %v3f32 = call <3 x float> @llvm.fabs.v3f32(<3 x float> undef) #1
14  %v5f32 = call <5 x float> @llvm.fabs.v5f32(<5 x float> undef) #1
15  ret void
16}
17
18; CHECK-LABEL: 'fabs_f64'
19; CHECK: estimated cost of 0 for {{.*}} call double @llvm.fabs.f64
20; CHECK: estimated cost of 0 for {{.*}} call <2 x double> @llvm.fabs.v2f64
21; CHECK: estimated cost of 0 for {{.*}} call <3 x double> @llvm.fabs.v3f64
22define amdgpu_kernel void @fabs_f64() #0 {
23  %f64 = call double @llvm.fabs.f64(double undef) #1
24  %v2f64 = call <2 x double> @llvm.fabs.v2f64(<2 x double> undef) #1
25  %v3f64 = call <3 x double> @llvm.fabs.v3f64(<3 x double> undef) #1
26  ret void
27}
28
29; CHECK-LABEL: 'fabs_f16'
30; CHECK: estimated cost of 0 for {{.*}} call half @llvm.fabs.f16
31; CHECK: estimated cost of 0 for {{.*}} call <2 x half> @llvm.fabs.v2f16
32; CHECK: estimated cost of 0 for {{.*}} call <3 x half> @llvm.fabs.v3f16
33define amdgpu_kernel void @fabs_f16() #0 {
34  %f16 = call half @llvm.fabs.f16(half undef) #1
35  %v2f16 = call <2 x half> @llvm.fabs.v2f16(<2 x half> undef) #1
36  %v3f16 = call <3 x half> @llvm.fabs.v3f16(<3 x half> undef) #1
37  ret void
38}
39
40declare float @llvm.fabs.f32(float) #1
41declare <2 x float> @llvm.fabs.v2f32(<2 x float>) #1
42declare <3 x float> @llvm.fabs.v3f32(<3 x float>) #1
43declare <5 x float> @llvm.fabs.v5f32(<5 x float>) #1
44
45declare double @llvm.fabs.f64(double) #1
46declare <2 x double> @llvm.fabs.v2f64(<2 x double>) #1
47declare <3 x double> @llvm.fabs.v3f64(<3 x double>) #1
48
49declare half @llvm.fabs.f16(half) #1
50declare <2 x half> @llvm.fabs.v2f16(<2 x half>) #1
51declare <3 x half> @llvm.fabs.v3f16(<3 x half>) #1
52
53attributes #0 = { nounwind }
54attributes #1 = { nounwind readnone }
55