Clang] Fix expansion of response files in -Wp after integrated-cc1 change
[llvm-project.git] / llvm / test / Analysis / CostModel / AMDGPU / fadd.ll
blob1203182a83dd4a3a46a13d81d5d381012edbddd4
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 -cost-kind=code-size -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 -mattr=+half-rate-64-ops < %s | FileCheck -check-prefixes=FASTF64,FASTF16,ALL %s
4 ; RUN: opt -cost-model -cost-kind=code-size -analyze -mtriple=amdgcn-unknown-amdhsa -mattr=-half-rate-64-ops < %s | FileCheck -check-prefixes=SLOWF64,SLOWF16,ALL %s
6 ; ALL: 'fadd_f32'
7 ; ALL: estimated cost of 1 for {{.*}} fadd float
8 define amdgpu_kernel void @fadd_f32(float addrspace(1)* %out, float addrspace(1)* %vaddr, float %b) #0 {
9   %vec = load float, float addrspace(1)* %vaddr
10   %add = fadd float %vec, %b
11   store float %add, float addrspace(1)* %out
12   ret void
15 ; ALL: 'fadd_v2f32'
16 ; ALL: estimated cost of 2 for {{.*}} fadd <2 x float>
17 define amdgpu_kernel void @fadd_v2f32(<2 x float> addrspace(1)* %out, <2 x float> addrspace(1)* %vaddr, <2 x float> %b) #0 {
18   %vec = load <2 x float>, <2 x float> addrspace(1)* %vaddr
19   %add = fadd <2 x float> %vec, %b
20   store <2 x float> %add, <2 x float> addrspace(1)* %out
21   ret void
24 ; ALL: 'fadd_v3f32'
25 ; Allow for 4 when v3f32 is illegal and TargetLowering thinks it needs widening,
26 ; and 3 when it is legal.
27 ; ALL: estimated cost of {{[34]}} for {{.*}} fadd <3 x float>
28 define amdgpu_kernel void @fadd_v3f32(<3 x float> addrspace(1)* %out, <3 x float> addrspace(1)* %vaddr, <3 x float> %b) #0 {
29   %vec = load <3 x float>, <3 x float> addrspace(1)* %vaddr
30   %add = fadd <3 x float> %vec, %b
31   store <3 x float> %add, <3 x float> addrspace(1)* %out
32   ret void
35 ; ALL: 'fadd_v5f32'
36 ; Allow for 8 when v5f32 is illegal and TargetLowering thinks it needs widening,
37 ; and 5 when it is legal.
38 ; ALL: estimated cost of {{[58]}} for {{.*}} fadd <5 x float>
39 define amdgpu_kernel void @fadd_v5f32(<5 x float> addrspace(1)* %out, <5 x float> addrspace(1)* %vaddr, <5 x float> %b) #0 {
40   %vec = load <5 x float>, <5 x float> addrspace(1)* %vaddr
41   %add = fadd <5 x float> %vec, %b
42   store <5 x float> %add, <5 x float> addrspace(1)* %out
43   ret void
46 ; ALL: 'fadd_f64'
47 ; FASTF64: estimated cost of 2 for {{.*}} fadd double
48 ; SLOWF64: estimated cost of 3 for {{.*}} fadd double
49 define amdgpu_kernel void @fadd_f64(double addrspace(1)* %out, double addrspace(1)* %vaddr, double %b) #0 {
50   %vec = load double, double addrspace(1)* %vaddr
51   %add = fadd double %vec, %b
52   store double %add, double addrspace(1)* %out
53   ret void
56 ; ALL: 'fadd_v2f64'
57 ; FASTF64: estimated cost of 4 for {{.*}} fadd <2 x double>
58 ; SLOWF64: estimated cost of 6 for {{.*}} fadd <2 x double>
59 define amdgpu_kernel void @fadd_v2f64(<2 x double> addrspace(1)* %out, <2 x double> addrspace(1)* %vaddr, <2 x double> %b) #0 {
60   %vec = load <2 x double>, <2 x double> addrspace(1)* %vaddr
61   %add = fadd <2 x double> %vec, %b
62   store <2 x double> %add, <2 x double> addrspace(1)* %out
63   ret void
66 ; ALL: 'fadd_v3f64'
67 ; FASTF64: estimated cost of 6 for {{.*}} fadd <3 x double>
68 ; SLOWF64: estimated cost of 9 for {{.*}} fadd <3 x double>
69 define amdgpu_kernel void @fadd_v3f64(<3 x double> addrspace(1)* %out, <3 x double> addrspace(1)* %vaddr, <3 x double> %b) #0 {
70   %vec = load <3 x double>, <3 x double> addrspace(1)* %vaddr
71   %add = fadd <3 x double> %vec, %b
72   store <3 x double> %add, <3 x double> addrspace(1)* %out
73   ret void
76 ; ALL: 'fadd_f16'
77 ; ALL: estimated cost of 1 for {{.*}} fadd half
78 define amdgpu_kernel void @fadd_f16(half addrspace(1)* %out, half addrspace(1)* %vaddr, half %b) #0 {
79   %vec = load half, half addrspace(1)* %vaddr
80   %add = fadd half %vec, %b
81   store half %add, half addrspace(1)* %out
82   ret void
85 ; ALL: 'fadd_v2f16'
86 ; SLOWF16: estimated cost of 2 for {{.*}} fadd <2 x half>
87 ; FASTF16: estimated cost of 1 for {{.*}} fadd <2 x half>
88 define amdgpu_kernel void @fadd_v2f16(<2 x half> addrspace(1)* %out, <2 x half> addrspace(1)* %vaddr, <2 x half> %b) #0 {
89   %vec = load <2 x half>, <2 x half> addrspace(1)* %vaddr
90   %add = fadd <2 x half> %vec, %b
91   store <2 x half> %add, <2 x half> addrspace(1)* %out
92   ret void
95 ; ALL: 'fadd_v3f16'
96 ; SLOWF16: estimated cost of 4 for {{.*}} fadd <3 x half>
97 ; FASTF16: estimated cost of 2 for {{.*}} fadd <3 x half>
98 define amdgpu_kernel void @fadd_v3f16(<3 x half> addrspace(1)* %out, <3 x half> addrspace(1)* %vaddr, <3 x half> %b) #0 {
99   %vec = load <3 x half>, <3 x half> addrspace(1)* %vaddr
100   %add = fadd <3 x half> %vec, %b
101   store <3 x half> %add, <3 x half> addrspace(1)* %out
102   ret void
105 ; ALL: 'fadd_v4f16'
106 ; SLOWF16: estimated cost of 4 for {{.*}} fadd <4 x half>
107 ; FASTF16: estimated cost of 2 for {{.*}} fadd <4 x half>
108 define amdgpu_kernel void @fadd_v4f16(<4 x half> addrspace(1)* %out, <4 x half> addrspace(1)* %vaddr, <4 x half> %b) #0 {
109   %vec = load <4 x half>, <4 x half> addrspace(1)* %vaddr
110   %add = fadd <4 x half> %vec, %b
111   store <4 x half> %add, <4 x half> addrspace(1)* %out
112   ret void
115 attributes #0 = { nounwind }