1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx900 < %s | FileCheck -check-prefix=GCN %s
3
4define float @v_constained_fma_f32_fpexcept_strict(float %x, float %y, float %z) #0 {
5; GCN-LABEL: v_constained_fma_f32_fpexcept_strict:
6; GCN:       ; %bb.0:
7; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8; GCN-NEXT:    v_fma_f32 v0, v0, v1, v2
9; GCN-NEXT:    s_setpc_b64 s[30:31]
10  %val = call float @llvm.experimental.constrained.fma.f32(float %x, float %y, float %z, metadata !"round.tonearest", metadata !"fpexcept.strict")
11  ret float %val
12}
13
14define <2 x float> @v_constained_fma_v2f32_fpexcept_strict(<2 x float> %x, <2 x float> %y, <2 x float> %z) #0 {
15; GCN-LABEL: v_constained_fma_v2f32_fpexcept_strict:
16; GCN:       ; %bb.0:
17; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18; GCN-NEXT:    v_fma_f32 v0, v0, v2, v4
19; GCN-NEXT:    v_fma_f32 v1, v1, v3, v5
20; GCN-NEXT:    s_setpc_b64 s[30:31]
21  %val = call <2 x float> @llvm.experimental.constrained.fma.v2f32(<2 x float> %x, <2 x float> %y, <2 x float> %z, metadata !"round.tonearest", metadata !"fpexcept.strict")
22  ret <2 x float> %val
23}
24
25define <3 x float> @v_constained_fma_v3f32_fpexcept_strict(<3 x float> %x, <3 x float> %y, <3 x float> %z) #0 {
26; GCN-LABEL: v_constained_fma_v3f32_fpexcept_strict:
27; GCN:       ; %bb.0:
28; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
29; GCN-NEXT:    v_fma_f32 v0, v0, v3, v6
30; GCN-NEXT:    v_fma_f32 v1, v1, v4, v7
31; GCN-NEXT:    v_fma_f32 v2, v2, v5, v8
32; GCN-NEXT:    s_setpc_b64 s[30:31]
33  %val = call <3 x float> @llvm.experimental.constrained.fma.v3f32(<3 x float> %x, <3 x float> %y, <3 x float> %z, metadata !"round.tonearest", metadata !"fpexcept.strict")
34  ret <3 x float> %val
35}
36
37define <4 x float> @v_constained_fma_v4f32_fpexcept_strict(<4 x float> %x, <4 x float> %y, <4 x float> %z) #0 {
38; GCN-LABEL: v_constained_fma_v4f32_fpexcept_strict:
39; GCN:       ; %bb.0:
40; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
41; GCN-NEXT:    v_fma_f32 v0, v0, v4, v8
42; GCN-NEXT:    v_fma_f32 v1, v1, v5, v9
43; GCN-NEXT:    v_fma_f32 v2, v2, v6, v10
44; GCN-NEXT:    v_fma_f32 v3, v3, v7, v11
45; GCN-NEXT:    s_setpc_b64 s[30:31]
46  %val = call <4 x float> @llvm.experimental.constrained.fma.v4f32(<4 x float> %x, <4 x float> %y, <4 x float> %z, metadata !"round.tonearest", metadata !"fpexcept.strict")
47  ret <4 x float> %val
48}
49
50define float @v_constained_fma_f32_fpexcept_strict_fneg(float %x, float %y, float %z) #0 {
51; GCN-LABEL: v_constained_fma_f32_fpexcept_strict_fneg:
52; GCN:       ; %bb.0:
53; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
54; GCN-NEXT:    v_fma_f32 v0, v0, v1, -v2
55; GCN-NEXT:    s_setpc_b64 s[30:31]
56  %neg.z = fneg float %z
57  %val = call float @llvm.experimental.constrained.fma.f32(float %x, float %y, float %neg.z, metadata !"round.tonearest", metadata !"fpexcept.strict")
58  ret float %val
59}
60
61define float @v_constained_fma_f32_fpexcept_strict_fneg_fneg(float %x, float %y, float %z) #0 {
62; GCN-LABEL: v_constained_fma_f32_fpexcept_strict_fneg_fneg:
63; GCN:       ; %bb.0:
64; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
65; GCN-NEXT:    v_fma_f32 v0, -v0, -v1, v2
66; GCN-NEXT:    s_setpc_b64 s[30:31]
67  %neg.x = fneg float %x
68  %neg.y = fneg float %y
69  %val = call float @llvm.experimental.constrained.fma.f32(float %neg.x, float %neg.y, float %z, metadata !"round.tonearest", metadata !"fpexcept.strict")
70  ret float %val
71}
72
73define float @v_constained_fma_f32_fpexcept_strict_fabs_fabs(float %x, float %y, float %z) #0 {
74; GCN-LABEL: v_constained_fma_f32_fpexcept_strict_fabs_fabs:
75; GCN:       ; %bb.0:
76; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
77; GCN-NEXT:    v_fma_f32 v0, |v0|, |v1|, v2
78; GCN-NEXT:    s_setpc_b64 s[30:31]
79  %neg.x = call float @llvm.fabs.f32(float %x)
80  %neg.y = call float @llvm.fabs.f32(float %y)
81  %val = call float @llvm.experimental.constrained.fma.f32(float %neg.x, float %neg.y, float %z, metadata !"round.tonearest", metadata !"fpexcept.strict")
82  ret float %val
83}
84
85define <2 x float> @v_constained_fma_v2f32_fpexcept_strict_fneg_fneg(<2 x float> %x, <2 x float> %y, <2 x float> %z) #0 {
86; GCN-LABEL: v_constained_fma_v2f32_fpexcept_strict_fneg_fneg:
87; GCN:       ; %bb.0:
88; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
89; GCN-NEXT:    v_fma_f32 v0, -v0, -v2, v4
90; GCN-NEXT:    v_fma_f32 v1, -v1, -v3, v5
91; GCN-NEXT:    s_setpc_b64 s[30:31]
92  %neg.x = fneg <2 x float> %x
93  %neg.y = fneg <2 x float> %y
94  %val = call <2 x float> @llvm.experimental.constrained.fma.v2f32(<2 x float> %neg.x, <2 x float> %neg.y, <2 x float> %z, metadata !"round.tonearest", metadata !"fpexcept.strict")
95  ret <2 x float> %val
96}
97
98declare float @llvm.fabs.f32(float) #1
99declare float @llvm.experimental.constrained.fma.f32(float, float, float, metadata, metadata) #1
100declare <2 x float> @llvm.experimental.constrained.fma.v2f32(<2 x float>, <2 x float>, <2 x float>, metadata, metadata) #1
101declare <3 x float> @llvm.experimental.constrained.fma.v3f32(<3 x float>, <3 x float>, <3 x float>, metadata, metadata) #1
102declare <4 x float> @llvm.experimental.constrained.fma.v4f32(<4 x float>, <4 x float>, <4 x float>, metadata, metadata) #1
103
104attributes #0 = { strictfp }
105attributes #1 = { inaccessiblememonly nounwind willreturn }
106