I've reviewed the patch against trunk top-of-tree (revision 156617).
I have not compiled the code.
Generally the code changes look good. I would like to see some test
cases for code generation updates:
- half constant generation
- conversion to and from half, with other type being "float"
- ++ and --
I understand that the code generation cases may depend on inclusion of
your half-llvm.patch
(http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-April/049117.html)
I have one detailed comment:
The following part of the patch seems unnecessary.
I think the existing code should work because the HalfTypeID should be
lower than the other floating types?
@@ -641,7 +641,10 @@ Value
*ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType,
} else {
assert(SrcTy->isFloatingPointTy() && DstTy->isFloatingPointTy() &&
"Unknown real conversion");
- if (DstTy->getTypeID() < SrcTy->getTypeID())
+ int DstId = DstTy->getTypeID();
+ int SrcId = Src->getType()->getTypeID();
+ if ((SrcId != llvm::Type::HalfTyID && DstId < SrcId) ||
+ DstId == llvm::Type::HalfTyID)
Res = Builder.CreateFPTrunc(Src, DstTy, "conv");
else
Res = Builder.CreateFPExt(Src, DstTy, "conv");
thanks,
david