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
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)
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) {
20 %fadd = call double @llvm.experimental.constrained.fadd.f64(
22 metadata !"round.dynamic",
23 metadata !"fpexcept.strict")
27 define double @f1u(double %a) {
29 %fsqrt = call double @llvm.experimental.constrained.sqrt.f64(
31 metadata !"round.dynamic",
32 metadata !"fpexcept.strict")
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) {
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")
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) {
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")
58 ; Test an illegal value for the rounding mode argument.
59 ; CHECK4: invalid rounding mode argument
60 ;T4: define double @f4(double %a) {
62 ;T4: %fadd = call double @llvm.experimental.constrained.sqrt.f64(
64 ;T4: metadata !"round.dynomite",
65 ;T4: metadata !"fpexcept.strict")
69 ; Test an illegal value for the exception behavior argument.
70 ; CHECK5: invalid exception behavior argument
71 ;T5: define double @f5(double %a) {
73 ;T5: %fadd = call double @llvm.experimental.constrained.sqrt.f64(
75 ;T5: metadata !"round.dynamic",
76 ;T5: metadata !"fpexcept.restrict")