1 ; RUN: opt -passes=verify -S < %s 2>&1 | FileCheck %s
3 declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata)
4 declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata)
6 ; Test that the verifier accepts legal code, and that the correct attributes are
7 ; attached to the FP intrinsic. The attributes are checked at the bottom.
8 ; CHECK: declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata) #[[ATTR:[0-9]+]]
9 ; CHECK: declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata) #[[ATTR]]
10 ; Note: FP exceptions aren't usually caught through normal unwind mechanisms,
11 ; but we may want to revisit this for asynchronous exception handling.
12 define double @f1(double %a, double %b) strictfp {
13 ; CHECK-LABEL: define double @f1
14 ; CHECK-SAME: (double [[A:%.*]], double [[B:%.*]]) #[[STRICTFP:[0-9]+]] {
16 ; CHECK-NEXT: [[FADD:%.*]] = call double @llvm.experimental.constrained.fadd.f64(double [[A]], double [[B]], metadata !"round.dynamic", metadata !"fpexcept.strict")
17 ; CHECK-NEXT: ret double [[FADD]]
19 %fadd = call double @llvm.experimental.constrained.fadd.f64(
21 metadata !"round.dynamic",
22 metadata !"fpexcept.strict")
26 define double @f1u(double %a) strictfp {
27 ; CHECK-LABEL: define double @f1u
28 ; CHECK-SAME: (double [[A:%.*]]) #[[STRICTFP]] {
30 ; CHECK-NEXT: [[FSQRT:%.*]] = call double @llvm.experimental.constrained.sqrt.f64(double [[A]], metadata !"round.dynamic", metadata !"fpexcept.strict")
31 ; CHECK-NEXT: ret double [[FSQRT]]
34 %fsqrt = call double @llvm.experimental.constrained.sqrt.f64(
36 metadata !"round.dynamic",
37 metadata !"fpexcept.strict")
41 ; CHECK: attributes #[[ATTR]] = { nocallback nofree nosync nounwind strictfp willreturn memory(inaccessiblemem: readwrite) }
42 ; CHECK: attributes #[[STRICTFP]] = { strictfp }