@@ -914,7 +914,7 @@ static void output_op_cast(struct function *fn, struct instruction *insn, LLVMOp
assert(!is_float_type(insn->type));
- dtype = insn_symbol_type(insn);
+ dtype = symbol_type(insn->type);
switch (LLVMGetTypeKind(LLVMTypeOf(src))) {
case LLVMPointerTypeKind:
op = LLVMPtrToInt;
@@ -926,6 +926,14 @@ static void output_op_cast(struct function *fn, struct instruction *insn, LLVMOp
else if (insn->size == width)
op = LLVMBitCast;
break;
+ case LLVMHalfTypeKind:
+ case LLVMFloatTypeKind:
+ case LLVMDoubleTypeKind:
+ case LLVMX86_FP80TypeKind:
+ case LLVMFP128TypeKind:
+ case LLVMPPC_FP128TypeKind:
+ op = (op == LLVMZExt) ? LLVMFPToUI : LLVMFPToSI;
+ break;
default:
assert(0);
}
@@ -40,10 +40,8 @@ DEFINE_CASTS(long)
DEFINE_CASTS(ulong)
DEFINE_CASTS(longlong)
DEFINE_CASTS(ulonglong)
-/*
DEFINE_CASTS(float)
DEFINE_CASTS(double)
-*/
/*
* check-name: Cast code generation
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- sparse-llvm.c | 10 +++++++++- validation/backend/cast.c | 2 -- 2 files changed, 9 insertions(+), 3 deletions(-)