121
|
1 ; 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
|
|
4 ; 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
|
|
6
|
|
7 ; Common declarations used for all runs.
|
|
8 declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata)
|
|
9 declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata)
|
|
10
|
|
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]+]]
|
|
14 ; CHECK1: declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata) #[[ATTR]]
|
|
15 ; 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.
|
|
18 define double @f1(double %a, double %b) {
|
|
19 entry:
|
|
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
|
|
27 define double @f1u(double %a) {
|
|
28 entry:
|
|
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
|
|
36 ; 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
|
|
49 ;T3: define double @f3(double %a, double %b) {
|
|
50 ;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: }
|
|
57
|
|
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: }
|