diff options
author | Xiang Li <python3kgae@outlook.com> | 2022-06-19 15:37:00 -0700 |
---|---|---|
committer | Xiang Li <python3kgae@outlook.com> | 2022-06-23 12:56:26 -0700 |
commit | 77f72ac15bcac8923c6bd104f303feaa1e964692 (patch) | |
tree | 74a1dba38dc61a8b1bdc1f824f3371b64616fda4 /clang/lib/Basic/LangOptions.cpp | |
parent | a2c1f7c90da770167cecdb008fcf40eaa9f123ce (diff) | |
download | llvm-77f72ac15bcac8923c6bd104f303feaa1e964692.zip llvm-77f72ac15bcac8923c6bd104f303feaa1e964692.tar.gz llvm-77f72ac15bcac8923c6bd104f303feaa1e964692.tar.bz2 |
[HLSL] Enable half type for hlsl.
HLSL supports half type.
When enable-16bit-types is not set, half will be treated as float.
When enable-16bit-types is set, half will be treated like real 16bit float type and map to llvm half type.
Also change CXXABI to Microsoft to match dxc behavior.
The mangle name for half is "$f16@" when half is treat as native half type and "$halff@" when treat as float.
In AST, half is still half.
The special thing is done at clang codeGen, when NativeHalfType is false, half will translated into float.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D124790
Diffstat (limited to 'clang/lib/Basic/LangOptions.cpp')
-rw-r--r-- | clang/lib/Basic/LangOptions.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Basic/LangOptions.cpp b/clang/lib/Basic/LangOptions.cpp index 7549f3f..0bf410c 100644 --- a/clang/lib/Basic/LangOptions.cpp +++ b/clang/lib/Basic/LangOptions.cpp @@ -195,8 +195,8 @@ void LangOptions::setLangDefaults(LangOptions &Opts, Language Lang, // OpenCL, C++ and C2x have bool, true, false keywords. Opts.Bool = Opts.OpenCL || Opts.CPlusPlus || Opts.C2x; - // OpenCL has half keyword - Opts.Half = Opts.OpenCL; + // OpenCL and HLSL have half keyword + Opts.Half = Opts.OpenCL || Opts.HLSL; } FPOptions FPOptions::defaultWithoutTrailingStorage(const LangOptions &LO) { |