blob: cc3c3bc2ed88adf3f7917cc3fb600316ea251701 [file] [log] [blame]
Andrew Kaylore6f10d32017-01-26 23:27:59 +00001; RUN: opt -verify -S < %s 2>&1 | FileCheck --check-prefix=CHECK1 %s
2; RUN: sed -e s/.T2:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK2 %s
3; RUN: sed -e s/.T3:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK3 %s
Andrew Kaylor325c6862017-05-25 21:31:00 +00004; RUN: sed -e s/.T4:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK4 %s
5; RUN: sed -e s/.T5:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK5 %s
Andrew Kaylore6f10d32017-01-26 23:27:59 +00006
Andrew Kaylor325c6862017-05-25 21:31:00 +00007; Common declarations used for all runs.
Andrew Kaylore6f10d32017-01-26 23:27:59 +00008declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata)
Andrew Kaylor325c6862017-05-25 21:31:00 +00009declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata)
Andrew Kaylore6f10d32017-01-26 23:27:59 +000010
11; Test that the verifier accepts legal code, and that the correct attributes are
12; attached to the FP intrinsic.
13; CHECK1: declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata) #[[ATTR:[0-9]+]]
Andrew Kaylor325c6862017-05-25 21:31:00 +000014; CHECK1: declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata) #[[ATTR]]
Andrew Kaylore6f10d32017-01-26 23:27:59 +000015; CHECK1: attributes #[[ATTR]] = { inaccessiblememonly nounwind }
16; Note: FP exceptions aren't usually caught through normal unwind mechanisms,
17; but we may want to revisit this for asynchronous exception handling.
18define double @f1(double %a, double %b) {
19entry:
20 %fadd = call double @llvm.experimental.constrained.fadd.f64(
21 double %a, double %b,
22 metadata !"round.dynamic",
23 metadata !"fpexcept.strict")
24 ret double %fadd
25}
26
Andrew Kaylor325c6862017-05-25 21:31:00 +000027define double @f1u(double %a) {
28entry:
29 %fsqrt = call double @llvm.experimental.constrained.sqrt.f64(
30 double %a,
31 metadata !"round.dynamic",
32 metadata !"fpexcept.strict")
33 ret double %fsqrt
34}
35
Andrew Kaylore6f10d32017-01-26 23:27:59 +000036; Test an illegal value for the rounding mode argument.
37; CHECK2: invalid rounding mode argument
38;T2: define double @f2(double %a, double %b) {
39;T2: entry:
40;T2: %fadd = call double @llvm.experimental.constrained.fadd.f64(
41;T2: double %a, double %b,
42;T2: metadata !"round.dynomite",
43;T2: metadata !"fpexcept.strict")
44;T2: ret double %fadd
45;T2: }
46
47; Test an illegal value for the exception behavior argument.
48; CHECK3: invalid exception behavior argument
Andrew Kaylor325c6862017-05-25 21:31:00 +000049;T3: define double @f3(double %a, double %b) {
Andrew Kaylore6f10d32017-01-26 23:27:59 +000050;T3: entry:
51;T3: %fadd = call double @llvm.experimental.constrained.fadd.f64(
52;T3: double %a, double %b,
53;T3: metadata !"round.dynamic",
54;T3: metadata !"fpexcept.restrict")
55;T3: ret double %fadd
56;T3: }
Andrew Kaylor325c6862017-05-25 21:31:00 +000057
58; Test an illegal value for the rounding mode argument.
59; CHECK4: invalid rounding mode argument
60;T4: define double @f4(double %a) {
61;T4: entry:
62;T4: %fadd = call double @llvm.experimental.constrained.sqrt.f64(
63;T4: double %a,
64;T4: metadata !"round.dynomite",
65;T4: metadata !"fpexcept.strict")
66;T4: ret double %fadd
67;T4: }
68
69; Test an illegal value for the exception behavior argument.
70; CHECK5: invalid exception behavior argument
71;T5: define double @f5(double %a) {
72;T5: entry:
73;T5: %fadd = call double @llvm.experimental.constrained.sqrt.f64(
74;T5: double %a,
75;T5: metadata !"round.dynamic",
76;T5: metadata !"fpexcept.restrict")
77;T5: ret double %fadd
78;T5: }