diff options
| author | Artem Belevich <tra@google.com> | 2017-01-13 20:56:17 +0000 |
|---|---|---|
| committer | Artem Belevich <tra@google.com> | 2017-01-13 20:56:17 +0000 |
| commit | 64dc9be7b48e3e3ec1f7dec270bf433d2084915a (patch) | |
| tree | ca4f810515a29fb080b1341aaee69917aadc06b0 /llvm/lib/Target/NVPTX/NVPTXMCExpr.h | |
| parent | 836a3b416d222f0703d2e964a8e08f3892dd0278 (diff) | |
| download | bcm5719-llvm-64dc9be7b48e3e3ec1f7dec270bf433d2084915a.tar.gz bcm5719-llvm-64dc9be7b48e3e3ec1f7dec270bf433d2084915a.zip | |
[NVPTX] Added support for half-precision floating point.
Only scalar half-precision operations are supported at the moment.
- Adds general support for 'half' type in NVPTX.
- fp16 math operations are supported on sm_53+ GPUs only
(can be disabled with --nvptx-no-f16-math).
- Type conversions to/from fp16 are supported on all GPU variants.
- On GPU variants that do not have full fp16 support (or if it's disabled),
fp16 operations are promoted to fp32 and results are converted back
to fp16 for storage.
Differential Revision: https://reviews.llvm.org/D28540
llvm-svn: 291956
Diffstat (limited to 'llvm/lib/Target/NVPTX/NVPTXMCExpr.h')
| -rw-r--r-- | llvm/lib/Target/NVPTX/NVPTXMCExpr.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXMCExpr.h b/llvm/lib/Target/NVPTX/NVPTXMCExpr.h index 7f833c42fa8..95741d9b045 100644 --- a/llvm/lib/Target/NVPTX/NVPTXMCExpr.h +++ b/llvm/lib/Target/NVPTX/NVPTXMCExpr.h @@ -22,8 +22,9 @@ class NVPTXFloatMCExpr : public MCTargetExpr { public: enum VariantKind { VK_NVPTX_None, - VK_NVPTX_SINGLE_PREC_FLOAT, // FP constant in single-precision - VK_NVPTX_DOUBLE_PREC_FLOAT // FP constant in double-precision + VK_NVPTX_HALF_PREC_FLOAT, // FP constant in half-precision + VK_NVPTX_SINGLE_PREC_FLOAT, // FP constant in single-precision + VK_NVPTX_DOUBLE_PREC_FLOAT // FP constant in double-precision }; private: @@ -40,6 +41,11 @@ public: static const NVPTXFloatMCExpr *create(VariantKind Kind, const APFloat &Flt, MCContext &Ctx); + static const NVPTXFloatMCExpr *createConstantFPHalf(const APFloat &Flt, + MCContext &Ctx) { + return create(VK_NVPTX_HALF_PREC_FLOAT, Flt, Ctx); + } + static const NVPTXFloatMCExpr *createConstantFPSingle(const APFloat &Flt, MCContext &Ctx) { return create(VK_NVPTX_SINGLE_PREC_FLOAT, Flt, Ctx); |

