}
FuncAttrs.addAttribute("frame-pointer", FpKind);
- FuncAttrs.addAttribute("less-precise-fpmad",
- llvm::toStringRef(CodeGenOpts.LessPreciseFPMAD));
+ if (CodeGenOpts.LessPreciseFPMAD)
+ FuncAttrs.addAttribute("less-precise-fpmad", "true");
if (CodeGenOpts.NullPointerIsValid)
FuncAttrs.addAttribute(llvm::Attribute::NullPointerIsValid);
CodeGenOpts.FP32DenormalMode.str());
}
- FuncAttrs.addAttribute("no-trapping-math",
- llvm::toStringRef(LangOpts.getFPExceptionMode() ==
- LangOptions::FPE_Ignore));
+ if (LangOpts.getFPExceptionMode() == LangOptions::FPE_Ignore)
+ FuncAttrs.addAttribute("no-trapping-math", "true");
// Strict (compliant) code is the default, so only add this attribute to
// indicate that we are trying to workaround a problem case.
// TODO: Are these all needed?
// unsafe/inf/nan/nsz are handled by instruction-level FastMathFlags.
- FuncAttrs.addAttribute("no-infs-fp-math",
- llvm::toStringRef(LangOpts.NoHonorInfs));
- FuncAttrs.addAttribute("no-nans-fp-math",
- llvm::toStringRef(LangOpts.NoHonorNaNs));
- FuncAttrs.addAttribute("unsafe-fp-math",
- llvm::toStringRef(LangOpts.UnsafeFPMath));
- FuncAttrs.addAttribute("use-soft-float",
- llvm::toStringRef(CodeGenOpts.SoftFloat));
+ if (LangOpts.NoHonorInfs)
+ FuncAttrs.addAttribute("no-infs-fp-math", "true");
+ if (LangOpts.NoHonorNaNs)
+ FuncAttrs.addAttribute("no-nans-fp-math", "true");
+ if (LangOpts.UnsafeFPMath)
+ FuncAttrs.addAttribute("unsafe-fp-math", "true");
+ if (CodeGenOpts.SoftFloat)
+ FuncAttrs.addAttribute("use-soft-float", "true");
FuncAttrs.addAttribute("stack-protector-buffer-size",
llvm::utostr(CodeGenOpts.SSPBufferSize));
- FuncAttrs.addAttribute("no-signed-zeros-fp-math",
- llvm::toStringRef(LangOpts.NoSignedZero));
+ if (LangOpts.NoSignedZero)
+ FuncAttrs.addAttribute("no-signed-zeros-fp-math", "true");
// TODO: Reciprocal estimate codegen options should apply to instructions?
const std::vector<std::string> &Recips = CodeGenOpts.Reciprocals;
// CHECK: bar{{.*}} #1
// CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87"
-// HARD: "use-soft-float"="false"
+// HARD-NOT: "use-soft-float"
// SOFT: "use-soft-float"="true"
// CHECK: #1 = {{.*}}"target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,-x87"
-// HARD: "use-soft-float"="false"
+// HARD-NOT: "use-soft-float"
// SOFT: "use-soft-float"="true"
}
// CHECK: attributes
-// NORMAL: "no-signed-zeros-fp-math"="false"
+// NORMAL-NOT: "no-signed-zeros-fp-math"
// NO-SIGNED-ZEROS: "no-signed-zeros-fp-math"="true"
}
// CHECK: attributes
-// NORMAL: "less-precise-fpmad"="false"
-// NORMAL: "no-infs-fp-math"="false"
-// NORMAL: "no-nans-fp-math"="false"
-// NORMAL: "no-signed-zeros-fp-math"="false"
-// NORMAL: "unsafe-fp-math"="false"
+// NORMAL-NOT: "less-precise-fpmad"
+// NORMAL-NOT: "no-infs-fp-math"
+// NORMAL-NOT: "no-nans-fp-math"
+// NORMAL-NOT: "no-signed-zeros-fp-math"
+// NORMAL-NOT: "unsafe-fp-math"
// FAST: "less-precise-fpmad"="true"
// FAST: "no-infs-fp-math"="true"
// FAST: "no-signed-zeros-fp-math"="true"
// FAST: "unsafe-fp-math"="true"
-// FINITE: "less-precise-fpmad"="false"
+// FINITE-NOT: "less-precise-fpmad"
// FINITE: "no-infs-fp-math"="true"
// FINITE: "no-nans-fp-math"="true"
-// FINITE: "no-signed-zeros-fp-math"="false"
-// FINITE: "unsafe-fp-math"="false"
+// FINITE-NOT: "no-signed-zeros-fp-math"
+// FINITE-NOT: "unsafe-fp-math"
// UNSAFE: "less-precise-fpmad"="true"
-// UNSAFE: "no-infs-fp-math"="false"
-// UNSAFE: "no-nans-fp-math"="false"
+// UNSAFE-NOT: "no-infs-fp-math"
+// UNSAFE-NOT: "no-nans-fp-math"
// UNSAFE: "no-signed-zeros-fp-math"="true"
// UNSAFE: "unsafe-fp-math"="true"
// MAD: "less-precise-fpmad"="true"
-// MAD: "no-infs-fp-math"="false"
-// MAD: "no-nans-fp-math"="false"
-// MAD: "no-signed-zeros-fp-math"="false"
-// MAD: "unsafe-fp-math"="false"
+// MAD-NOT: "no-infs-fp-math"
+// MAD-NOT: "no-nans-fp-math"
+// MAD-NOT: "no-signed-zeros-fp-math"
+// MAD-NOT: "unsafe-fp-math"
-// NOSIGNED: "less-precise-fpmad"="false"
-// NOSIGNED: "no-infs-fp-math"="false"
-// NOSIGNED: "no-nans-fp-math"="false"
+// NOSIGNED-NOT: "less-precise-fpmad"
+// NOSIGNED-NOT: "no-infs-fp-math"
+// NOSIGNED-NOT: "no-nans-fp-math"
// NOSIGNED: "no-signed-zeros-fp-math"="true"
-// NOSIGNED: "unsafe-fp-math"="false"
+// NOSIGNED-NOT: "unsafe-fp-math"
#else
// Undefine this to avoid putting it in the PCH.