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 double @v_constained_fadd_f64_fpexcept_strict(double %x, double %y) #0 {
5; GCN-LABEL: v_constained_fadd_f64_fpexcept_strict:
6; GCN:       ; %bb.0:
7; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8; GCN-NEXT:    v_add_f64 v[0:1], v[0:1], v[2:3]
9; GCN-NEXT:    s_setpc_b64 s[30:31]
10  %val = call double @llvm.experimental.constrained.fadd.f64(double %x, double %y, metadata !"round.tonearest", metadata !"fpexcept.strict")
11  ret double %val
12}
13
14define double @v_constained_fadd_f64_fpexcept_ignore(double %x, double %y) #0 {
15; GCN-LABEL: v_constained_fadd_f64_fpexcept_ignore:
16; GCN:       ; %bb.0:
17; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18; GCN-NEXT:    v_add_f64 v[0:1], v[0:1], v[2:3]
19; GCN-NEXT:    s_setpc_b64 s[30:31]
20  %val = call double @llvm.experimental.constrained.fadd.f64(double %x, double %y, metadata !"round.tonearest", metadata !"fpexcept.ignore")
21  ret double %val
22}
23
24define double @v_constained_fadd_f64_fpexcept_maytrap(double %x, double %y) #0 {
25; GCN-LABEL: v_constained_fadd_f64_fpexcept_maytrap:
26; GCN:       ; %bb.0:
27; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
28; GCN-NEXT:    v_add_f64 v[0:1], v[0:1], v[2:3]
29; GCN-NEXT:    s_setpc_b64 s[30:31]
30  %val = call double @llvm.experimental.constrained.fadd.f64(double %x, double %y, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
31  ret double %val
32}
33
34define <2 x double> @v_constained_fadd_v2f64_fpexcept_strict(<2 x double> %x, <2 x double> %y) #0 {
35; GCN-LABEL: v_constained_fadd_v2f64_fpexcept_strict:
36; GCN:       ; %bb.0:
37; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
38; GCN-NEXT:    v_add_f64 v[0:1], v[0:1], v[4:5]
39; GCN-NEXT:    v_add_f64 v[2:3], v[2:3], v[6:7]
40; GCN-NEXT:    s_setpc_b64 s[30:31]
41  %val = call <2 x double> @llvm.experimental.constrained.fadd.v2f64(<2 x double> %x, <2 x double> %y, metadata !"round.tonearest", metadata !"fpexcept.strict")
42  ret <2 x double> %val
43}
44
45define <2 x double> @v_constained_fadd_v2f64_fpexcept_ignore(<2 x double> %x, <2 x double> %y) #0 {
46; GCN-LABEL: v_constained_fadd_v2f64_fpexcept_ignore:
47; GCN:       ; %bb.0:
48; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
49; GCN-NEXT:    v_add_f64 v[0:1], v[0:1], v[4:5]
50; GCN-NEXT:    v_add_f64 v[2:3], v[2:3], v[6:7]
51; GCN-NEXT:    s_setpc_b64 s[30:31]
52  %val = call <2 x double> @llvm.experimental.constrained.fadd.v2f64(<2 x double> %x, <2 x double> %y, metadata !"round.tonearest", metadata !"fpexcept.ignore")
53  ret <2 x double> %val
54}
55
56define <2 x double> @v_constained_fadd_v2f64_fpexcept_maytrap(<2 x double> %x, <2 x double> %y) #0 {
57; GCN-LABEL: v_constained_fadd_v2f64_fpexcept_maytrap:
58; GCN:       ; %bb.0:
59; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
60; GCN-NEXT:    v_add_f64 v[0:1], v[0:1], v[4:5]
61; GCN-NEXT:    v_add_f64 v[2:3], v[2:3], v[6:7]
62; GCN-NEXT:    s_setpc_b64 s[30:31]
63  %val = call <2 x double> @llvm.experimental.constrained.fadd.v2f64(<2 x double> %x, <2 x double> %y, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
64  ret <2 x double> %val
65}
66
67define <3 x double> @v_constained_fadd_v3f64_fpexcept_strict(<3 x double> %x, <3 x double> %y) #0 {
68; GCN-LABEL: v_constained_fadd_v3f64_fpexcept_strict:
69; GCN:       ; %bb.0:
70; GCN-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
71; GCN-NEXT:    v_add_f64 v[0:1], v[0:1], v[6:7]
72; GCN-NEXT:    v_add_f64 v[2:3], v[2:3], v[8:9]
73; GCN-NEXT:    v_add_f64 v[4:5], v[4:5], v[10:11]
74; GCN-NEXT:    s_setpc_b64 s[30:31]
75  %val = call <3 x double> @llvm.experimental.constrained.fadd.v3f64(<3 x double> %x, <3 x double> %y, metadata !"round.tonearest", metadata !"fpexcept.strict")
76  ret <3 x double> %val
77}
78
79define amdgpu_ps <2 x float> @s_constained_fadd_f64_fpexcept_strict(double inreg %x, double inreg %y) #0 {
80; GCN-LABEL: s_constained_fadd_f64_fpexcept_strict:
81; GCN:       ; %bb.0:
82; GCN-NEXT:    v_mov_b32_e32 v0, s4
83; GCN-NEXT:    v_mov_b32_e32 v1, s5
84; GCN-NEXT:    v_add_f64 v[0:1], s[2:3], v[0:1]
85; GCN-NEXT:    ; return to shader part epilog
86  %val = call double @llvm.experimental.constrained.fadd.f64(double %x, double %y, metadata !"round.tonearest", metadata !"fpexcept.strict")
87  %cast = bitcast double %val to <2 x float>
88  ret <2 x float> %cast
89}
90
91declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata) #1
92declare <2 x double> @llvm.experimental.constrained.fadd.v2f64(<2 x double>, <2 x double>, metadata, metadata) #1
93declare <3 x double> @llvm.experimental.constrained.fadd.v3f64(<3 x double>, <3 x double>, metadata, metadata) #1
94
95attributes #0 = { strictfp }
96attributes #1 = { inaccessiblememonly nounwind willreturn }
97