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_fadd_f32_fpexcept_strict(float %x, float %y) #0 {
5; GCN-LABEL: v_constained_fadd_f32_fpexcept_strict:
6; GCN:       ; %bb.0:
7; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8; GCN-NEXT:    v_add_f32_e32 v0, v0, v1
9; GCN-NEXT:    s_setpc_b64 s[30:31]
10  %val = call float @llvm.experimental.constrained.fadd.f32(float %x, float %y, metadata !"round.tonearest", metadata !"fpexcept.strict")
11  ret float %val
12}
13
14define float @v_constained_fadd_f32_fpexcept_ignore(float %x, float %y) #0 {
15; GCN-LABEL: v_constained_fadd_f32_fpexcept_ignore:
16; GCN:       ; %bb.0:
17; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18; GCN-NEXT:    v_add_f32_e32 v0, v0, v1
19; GCN-NEXT:    s_setpc_b64 s[30:31]
20  %val = call float @llvm.experimental.constrained.fadd.f32(float %x, float %y, metadata !"round.tonearest", metadata !"fpexcept.ignore")
21  ret float %val
22}
23
24define float @v_constained_fadd_f32_fpexcept_maytrap(float %x, float %y) #0 {
25; GCN-LABEL: v_constained_fadd_f32_fpexcept_maytrap:
26; GCN:       ; %bb.0:
27; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
28; GCN-NEXT:    v_add_f32_e32 v0, v0, v1
29; GCN-NEXT:    s_setpc_b64 s[30:31]
30  %val = call float @llvm.experimental.constrained.fadd.f32(float %x, float %y, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
31  ret float %val
32}
33
34define <2 x float> @v_constained_fadd_v2f32_fpexcept_strict(<2 x float> %x, <2 x float> %y) #0 {
35; GCN-LABEL: v_constained_fadd_v2f32_fpexcept_strict:
36; GCN:       ; %bb.0:
37; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
38; GCN-NEXT:    v_add_f32_e32 v0, v0, v2
39; GCN-NEXT:    v_add_f32_e32 v1, v1, v3
40; GCN-NEXT:    s_setpc_b64 s[30:31]
41  %val = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %x, <2 x float> %y, metadata !"round.tonearest", metadata !"fpexcept.strict")
42  ret <2 x float> %val
43}
44
45define <2 x float> @v_constained_fadd_v2f32_fpexcept_ignore(<2 x float> %x, <2 x float> %y) #0 {
46; GCN-LABEL: v_constained_fadd_v2f32_fpexcept_ignore:
47; GCN:       ; %bb.0:
48; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
49; GCN-NEXT:    v_add_f32_e32 v0, v0, v2
50; GCN-NEXT:    v_add_f32_e32 v1, v1, v3
51; GCN-NEXT:    s_setpc_b64 s[30:31]
52  %val = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %x, <2 x float> %y, metadata !"round.tonearest", metadata !"fpexcept.ignore")
53  ret <2 x float> %val
54}
55
56define <2 x float> @v_constained_fadd_v2f32_fpexcept_maytrap(<2 x float> %x, <2 x float> %y) #0 {
57; GCN-LABEL: v_constained_fadd_v2f32_fpexcept_maytrap:
58; GCN:       ; %bb.0:
59; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
60; GCN-NEXT:    v_add_f32_e32 v0, v0, v2
61; GCN-NEXT:    v_add_f32_e32 v1, v1, v3
62; GCN-NEXT:    s_setpc_b64 s[30:31]
63  %val = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %x, <2 x float> %y, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
64  ret <2 x float> %val
65}
66
67define <3 x float> @v_constained_fadd_v3f32_fpexcept_strict(<3 x float> %x, <3 x float> %y) #0 {
68; GCN-LABEL: v_constained_fadd_v3f32_fpexcept_strict:
69; GCN:       ; %bb.0:
70; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
71; GCN-NEXT:    v_add_f32_e32 v0, v0, v3
72; GCN-NEXT:    v_add_f32_e32 v1, v1, v4
73; GCN-NEXT:    v_add_f32_e32 v2, v2, v5
74; GCN-NEXT:    s_setpc_b64 s[30:31]
75  %val = call <3 x float> @llvm.experimental.constrained.fadd.v3f32(<3 x float> %x, <3 x float> %y, metadata !"round.tonearest", metadata !"fpexcept.strict")
76  ret <3 x float> %val
77}
78
79define amdgpu_ps float @s_constained_fadd_f32_fpexcept_strict(float inreg %x, float inreg %y) #0 {
80; GCN-LABEL: s_constained_fadd_f32_fpexcept_strict:
81; GCN:       ; %bb.0:
82; GCN-NEXT:    v_mov_b32_e32 v0, s3
83; GCN-NEXT:    v_add_f32_e32 v0, s2, v0
84; GCN-NEXT:    ; return to shader part epilog
85  %val = call float @llvm.experimental.constrained.fadd.f32(float %x, float %y, metadata !"round.tonearest", metadata !"fpexcept.strict")
86  ret float %val
87}
88
89define float @v_constained_fadd_f32_fpexcept_strict_fabs_lhs(float %x, float %y) #0 {
90; GCN-LABEL: v_constained_fadd_f32_fpexcept_strict_fabs_lhs:
91; GCN:       ; %bb.0:
92; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
93; GCN-NEXT:    v_add_f32_e64 v0, |v0|, v1
94; GCN-NEXT:    s_setpc_b64 s[30:31]
95  %fabs.x = call float @llvm.fabs.f32(float %x)
96  %val = call float @llvm.experimental.constrained.fadd.f32(float %fabs.x, float %y, metadata !"round.tonearest", metadata !"fpexcept.strict")
97  ret float %val
98}
99
100define float @v_constained_fadd_f32_fpexcept_strict_fabs_rhs(float %x, float %y) #0 {
101; GCN-LABEL: v_constained_fadd_f32_fpexcept_strict_fabs_rhs:
102; GCN:       ; %bb.0:
103; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
104; GCN-NEXT:    v_add_f32_e64 v0, v0, |v1|
105; GCN-NEXT:    s_setpc_b64 s[30:31]
106  %fabs.y = call float @llvm.fabs.f32(float %y)
107  %val = call float @llvm.experimental.constrained.fadd.f32(float %x, float %fabs.y, metadata !"round.tonearest", metadata !"fpexcept.strict")
108  ret float %val
109}
110
111define float @v_constained_fadd_f32_fpexcept_strict_fneg_fabs_lhs(float %x, float %y) #0 {
112; GCN-LABEL: v_constained_fadd_f32_fpexcept_strict_fneg_fabs_lhs:
113; GCN:       ; %bb.0:
114; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
115; GCN-NEXT:    v_sub_f32_e64 v0, v1, |v0|
116; GCN-NEXT:    s_setpc_b64 s[30:31]
117  %fabs.x = call float @llvm.fabs.f32(float %x)
118  %neg.fabs.x = fneg float %fabs.x
119  %val = call float @llvm.experimental.constrained.fadd.f32(float %neg.fabs.x, float %y, metadata !"round.tonearest", metadata !"fpexcept.strict")
120  ret float %val
121}
122
123declare float @llvm.fabs.f32(float) #1
124declare float @llvm.experimental.constrained.fadd.f32(float, float, metadata, metadata) #1
125declare <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float>, <2 x float>, metadata, metadata) #1
126declare <3 x float> @llvm.experimental.constrained.fadd.v3f32(<3 x float>, <3 x float>, metadata, metadata) #1
127
128attributes #0 = { strictfp }
129attributes #1 = { inaccessiblememonly nounwind willreturn }
130