blob: 621a0de281db541e3f1d5c7bfc9a2d998d89a57a [file] [log] [blame]
Matt Arsenault6689abe2016-05-05 20:07:37 +00001; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck %s -check-prefix=SI -check-prefix=FUNC
Matt Arsenault7aad8fd2017-01-24 22:02:15 +00002; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck %s -check-prefix=SI -check-prefix=FUNC
Matt Arsenault6689abe2016-05-05 20:07:37 +00003; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck %s -check-prefix=R600 -check-prefix=FUNC
Tom Stellard75aadc22012-12-11 21:25:42 +00004
Tom Stellard79243d92014-10-01 17:15:17 +00005; FUNC-LABEL: {{^}}fadd_f32:
Matt Arsenaulta6dc6c22014-08-06 20:27:55 +00006; R600: ADD {{\** *}}T{{[0-9]+\.[XYZW]}}, KC0[2].Z, KC0[2].W
Tom Stellard326d6ec2014-11-05 14:50:53 +00007; SI: v_add_f32
Matt Arsenault3dbeefa2017-03-21 21:39:51 +00008define amdgpu_kernel void @fadd_f32(float addrspace(1)* %out, float %a, float %b) #0 {
Matt Arsenaulta6dc6c22014-08-06 20:27:55 +00009 %add = fadd float %a, %b
10 store float %add, float addrspace(1)* %out, align 4
Tom Stellard75aadc22012-12-11 21:25:42 +000011 ret void
12}
13
Tom Stellard79243d92014-10-01 17:15:17 +000014; FUNC-LABEL: {{^}}fadd_v2f32:
Matt Arsenaulta6dc6c22014-08-06 20:27:55 +000015; R600-DAG: ADD {{\** *}}T{{[0-9]\.[XYZW]}}, KC0[3].X, KC0[3].Z
16; R600-DAG: ADD {{\** *}}T{{[0-9]\.[XYZW]}}, KC0[2].W, KC0[3].Y
Tom Stellard326d6ec2014-11-05 14:50:53 +000017; SI: v_add_f32
18; SI: v_add_f32
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000019define amdgpu_kernel void @fadd_v2f32(<2 x float> addrspace(1)* %out, <2 x float> %a, <2 x float> %b) #0 {
Matt Arsenaulta6dc6c22014-08-06 20:27:55 +000020 %add = fadd <2 x float> %a, %b
21 store <2 x float> %add, <2 x float> addrspace(1)* %out, align 8
Tom Stellard0344cdf2013-08-01 15:23:42 +000022 ret void
23}
24
Tom Stellard79243d92014-10-01 17:15:17 +000025; FUNC-LABEL: {{^}}fadd_v4f32:
Matt Arsenaulta6dc6c22014-08-06 20:27:55 +000026; R600: ADD {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
27; R600: ADD {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
28; R600: ADD {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
29; R600: ADD {{\** *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
Tom Stellard326d6ec2014-11-05 14:50:53 +000030; SI: v_add_f32
31; SI: v_add_f32
32; SI: v_add_f32
33; SI: v_add_f32
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000034define amdgpu_kernel void @fadd_v4f32(<4 x float> addrspace(1)* %out, <4 x float> addrspace(1)* %in) #0 {
David Blaikie79e6c742015-02-27 19:29:02 +000035 %b_ptr = getelementptr <4 x float>, <4 x float> addrspace(1)* %in, i32 1
David Blaikiea79ac142015-02-27 21:17:42 +000036 %a = load <4 x float>, <4 x float> addrspace(1)* %in, align 16
37 %b = load <4 x float>, <4 x float> addrspace(1)* %b_ptr, align 16
Tom Stellard5a6b0d82013-04-19 02:10:53 +000038 %result = fadd <4 x float> %a, %b
Matt Arsenaulta6dc6c22014-08-06 20:27:55 +000039 store <4 x float> %result, <4 x float> addrspace(1)* %out, align 16
Tom Stellard5a6b0d82013-04-19 02:10:53 +000040 ret void
41}
Tom Stellard967bf582014-02-13 23:34:15 +000042
Tom Stellard79243d92014-10-01 17:15:17 +000043; FUNC-LABEL: {{^}}fadd_v8f32:
Matt Arsenaulta6dc6c22014-08-06 20:27:55 +000044; R600: ADD
45; R600: ADD
46; R600: ADD
47; R600: ADD
48; R600: ADD
49; R600: ADD
50; R600: ADD
51; R600: ADD
Tom Stellard326d6ec2014-11-05 14:50:53 +000052; SI: v_add_f32
53; SI: v_add_f32
54; SI: v_add_f32
55; SI: v_add_f32
56; SI: v_add_f32
57; SI: v_add_f32
58; SI: v_add_f32
59; SI: v_add_f32
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000060define amdgpu_kernel void @fadd_v8f32(<8 x float> addrspace(1)* %out, <8 x float> %a, <8 x float> %b) #0 {
Matt Arsenaulta6dc6c22014-08-06 20:27:55 +000061 %add = fadd <8 x float> %a, %b
62 store <8 x float> %add, <8 x float> addrspace(1)* %out, align 32
Tom Stellard967bf582014-02-13 23:34:15 +000063 ret void
64}
Matt Arsenault9a3fd872017-03-09 01:36:39 +000065
66; FUNC-LABEL: {{^}}fadd_0_nsz_attr_f32:
67; SI-NOT: v_add_f32
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000068define amdgpu_kernel void @fadd_0_nsz_attr_f32(float addrspace(1)* %out, float %a) #1 {
Matt Arsenault9a3fd872017-03-09 01:36:39 +000069 %add = fadd float %a, 0.0
70 store float %add, float addrspace(1)* %out, align 4
71 ret void
72}
73
74attributes #0 = { nounwind }
75attributes #1 = { nounwind "no-signed-zeros-fp-math"="true" }