43 lines · plain
1; RUN: opt -passes=verify -S < %s 2>&1 | FileCheck %s2 3declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata)4declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata)5 6; Test that the verifier accepts legal code, and that the correct attributes are7; 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.12define double @f1(double %a, double %b) strictfp {13; CHECK-LABEL: define double @f114; CHECK-SAME: (double [[A:%.*]], double [[B:%.*]]) #[[STRICTFP:[0-9]+]] {15; CHECK-NEXT: entry: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]]18entry:19 %fadd = call double @llvm.experimental.constrained.fadd.f64(20 double %a, double %b,21 metadata !"round.dynamic",22 metadata !"fpexcept.strict")23 ret double %fadd24}25 26define double @f1u(double %a) strictfp {27; CHECK-LABEL: define double @f1u28; CHECK-SAME: (double [[A:%.*]]) #[[STRICTFP]] {29; CHECK-NEXT: entry: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]]32;33entry:34 %fsqrt = call double @llvm.experimental.constrained.sqrt.f64(35 double %a,36 metadata !"round.dynamic",37 metadata !"fpexcept.strict")38 ret double %fsqrt39}40 41; CHECK: attributes #[[ATTR]] = { nocallback nofree nosync nounwind strictfp willreturn memory(inaccessiblemem: readwrite) }42; CHECK: attributes #[[STRICTFP]] = { strictfp }43