From: Junyan He <[email protected]> llvm 3.6 will give a UNDEF value for NAN. The will cause the store instruction for UNDEF to be ignored. We need to modify it to NAN here.
Signed-off-by: Junyan He <[email protected]> --- backend/src/llvm/llvm_printf_parser.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/src/llvm/llvm_printf_parser.cpp b/backend/src/llvm/llvm_printf_parser.cpp index 7800c01..2f85443 100644 --- a/backend/src/llvm/llvm_printf_parser.cpp +++ b/backend/src/llvm/llvm_printf_parser.cpp @@ -831,6 +831,12 @@ error: case Type::DoubleTyID: case Type::FloatTyID: { + /* llvm 3.6 will give a undef value for NAN. */ + if (dyn_cast<llvm::UndefValue>(arg)) { + APFloat nan = APFloat::getNaN(APFloat::IEEEsingle, false); + arg = ConstantFP::get(module->getContext(), nan); + } + /* Because the printf is a variable parameter function, it does not have the function prototype, so the compiler will always promote the arg to the longest precise type for float. So here, we can always find it is double. */ -- 1.7.9.5 _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
