diff options
author | Joey Gouly <joey.gouly@arm.com> | 2013-01-23 11:56:20 +0000 |
---|---|---|
committer | Joey Gouly <joey.gouly@arm.com> | 2013-01-23 11:56:20 +0000 |
commit | 19dbb20ac4371fae3190379a7e7bd467af3c00aa (patch) | |
tree | 4ad0ff118896e57acd79d0f76e8a57311af4bd19 /lib/CodeGen/CGExprConstant.cpp | |
parent | 218b6dfaee321cec558e15d47b68155dd9f35684 (diff) |
Add a new LangOpt NativeHalfType. This option allows for native half/fp16
operations (as opposed to storage only half/fp16).
Also add some semantic checks for OpenCL half types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173254 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r-- | lib/CodeGen/CGExprConstant.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 80ab2ed28c..4344f94045 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -1140,7 +1140,8 @@ llvm::Constant *CodeGenModule::EmitConstantValue(const APValue &Value, } case APValue::Float: { const llvm::APFloat &Init = Value.getFloat(); - if (&Init.getSemantics() == &llvm::APFloat::IEEEhalf) + if (&Init.getSemantics() == &llvm::APFloat::IEEEhalf && + !Context.getLangOpts().NativeHalfType) return llvm::ConstantInt::get(VMContext, Init.bitcastToAPInt()); else return llvm::ConstantFP::get(VMContext, Init); |