authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2021-04-15 18:17:31+02:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2021-04-15 18:17:31+02:00
log7a4dad7e87bd5561bbe62f5d38fda1b968f9d529
treeb6d7f66a132aef0589e0732972c4e87310a6b122
parent2d00f17d155b46e8effb47c363e051f50b866d47

stage1: More precise serialization of f16 values

Taking a detour trough a f64 is dangerous as the softfloat library doesn't like converting sNaN values. The error went unnoticed as an exception is raised by the library but the stage1 compiler doesn't give a damn.

1 files changed, 4 insertions(+), 1 deletions(-)

src/stage1/codegen.cpp+4-1
......@@ -7436,7 +7436,10 @@ static LLVMValueRef gen_const_val(CodeGen *g, ZigValue *const_val, const char *n
74367436 case ZigTypeIdFloat:
74377437 switch (type_entry->data.floating.bit_count) {
74387438 case 16:
7439 return LLVMConstReal(get_llvm_type(g, type_entry), zig_f16_to_double(const_val->data.x_f16));
7439 {
7440 LLVMValueRef as_int = LLVMConstInt(LLVMInt16Type(), const_val->data.x_f16.v, false);
7441 return LLVMConstBitCast(as_int, get_llvm_type(g, type_entry));
7442 }
74407443 case 32:
74417444 return LLVMConstReal(get_llvm_type(g, type_entry), const_val->data.x_f32);
74427445 case 64: