[PATCH] D27028: Add intrinsics for constrained floating point operations
Andy Kaylor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 5 15:43:04 PST 2016
andrew.w.kaylor added a comment.
In https://reviews.llvm.org/D27028#613867, @mehdi_amini wrote:
> Having the llvm_unreachable right after the StringSwitch should achieve the same thing.
I'm not sure I understand what you're suggesting here. If I do this:
return StringSwitch<RoundingMode>(RoundingArg)
.Case("round.dynamic", rmDynamic)
.Case("round.tonearest", rmToNearest)
.Case("round.downward", rmDownward)
.Case("round.upward", rmUpward)
.Case("round.towardzero", rmTowardZero);
llvm_unreachable("Unexpected rounding mode argument in FP intrinsic!");
the llvm_unreachable statement is purely unreachable because the implicit default from StringSwitch will assert or dereference a null pointer. The llvm_unreachable in this case effectively becomes a comment. So what I'd like to do is this:
return StringSwitch<RoundingMode>(RoundingArg)
.Case("round.dynamic", rmDynamic)
.Case("round.tonearest", rmToNearest)
.Case("round.downward", rmDownward)
.Case("round.upward", rmUpward)
.Case("round.towardzero", rmTowardZero)
.UnreachableDefault("Unexpected rounding mode argument in FP intrinsic!");
which at least in !NDEBUG builds will produce a useful message. This would be fairly trivial to implement.
Repository:
rL LLVM
https://reviews.llvm.org/D27028
More information about the llvm-commits
mailing list