1; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 -mattr=+half-rate-64-ops < %s | FileCheck -check-prefixes=FASTF64,FASTF16,ALL %s
2; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mattr=-half-rate-64-ops < %s | FileCheck -check-prefixes=SLOWF64,SLOWF16,ALL %s
3; RUN: opt -cost-model -analyze -cost-kind=code-size -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 -mattr=+half-rate-64-ops < %s | FileCheck -check-prefixes=SIZEALL,FASTF16,ALL %s
4; RUN: opt -cost-model -analyze -cost-kind=code-size -mtriple=amdgcn-unknown-amdhsa -mattr=-half-rate-64-ops < %s | FileCheck -check-prefixes=SIZEALL,SLOWF16,ALL %s
5; END.
6
7; ALL-LABEL: 'fsub_f32'
8; ALL: estimated cost of 1 for {{.*}} fsub float
9; ALL: estimated cost of 2 for {{.*}} fsub <2 x float>
10; ALL: estimated cost of 3 for {{.*}} fsub <3 x float>
11; ALL: estimated cost of 5 for {{.*}} fsub <5 x float>
12define amdgpu_kernel void @fsub_f32() #0 {
13  %f32 = fsub float undef, undef
14  %v2f32 = fsub <2 x float> undef, undef
15  %v3f32 = fsub <3 x float> undef, undef
16  %v5f32 = fsub <5 x float> undef, undef
17  ret void
18}
19
20; ALL-LABEL: 'fsub_f64'
21; FASTF64: estimated cost of 2 for {{.*}} fsub double
22; SLOWF64: estimated cost of 4 for {{.*}} fsub double
23; SIZEALL: estimated cost of 2 for {{.*}} fsub double
24; FASTF64: estimated cost of 4 for {{.*}} fsub <2 x double>
25; SLOWF64: estimated cost of 8 for {{.*}} fsub <2 x double>
26; SIZEALL: estimated cost of 4 for {{.*}} fsub <2 x double>
27; FASTF64: estimated cost of 6 for {{.*}} fsub <3 x double>
28; SLOWF64: estimated cost of 12 for {{.*}} fsub <3 x double>
29; SIZEALL: estimated cost of 6 for {{.*}} fsub <3 x double>
30define amdgpu_kernel void @fsub_f64() #0 {
31  %f64 = fsub double undef, undef
32  %v2f64 = fsub <2 x double> undef, undef
33  %v3f64 = fsub <3 x double> undef, undef
34  ret void
35}
36
37; ALL-LABEL: 'fsub_f16'
38; ALL: estimated cost of 1 for {{.*}} fsub half
39; SLOWF16: estimated cost of 2 for {{.*}} fsub <2 x half>
40; FASTF16: estimated cost of 1 for {{.*}} fsub <2 x half>
41; SLOWF16: estimated cost of 4 for {{.*}} fsub <3 x half>
42; FASTF16: estimated cost of 2 for {{.*}} fsub <3 x half>
43; SLOWF16: estimated cost of 4 for {{.*}} fsub <4 x half>
44; FASTF16: estimated cost of 2 for {{.*}} fsub <4 x half>
45define amdgpu_kernel void @fsub_f16() #0 {
46  %f16 = fsub half undef, undef
47  %v2f16 = fsub <2 x half> undef, undef
48  %v3f16 = fsub <3 x half> undef, undef
49  %v4f16 = fsub <4 x half> undef, undef
50  ret void
51}
52