[PATCH] D152768: [Clang][BFloat16] Upgrade __bf16 by supporting increment/decrement operations
Jun Sha via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 28 01:21:13 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG62a251f824f6: [Clang][BFloat16] Upgrade __bf16 by supporting increment/decrement operations (authored by joshua-arch1).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Changed prior to commit:
https://reviews.llvm.org/D152768?vs=530750&id=545049#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152768/new/
https://reviews.llvm.org/D152768
Files:
clang/lib/CodeGen/CGExprScalar.cpp
clang/test/Sema/arm-bfloat.cpp
Index: clang/test/Sema/arm-bfloat.cpp
===================================================================
--- clang/test/Sema/arm-bfloat.cpp
+++ clang/test/Sema/arm-bfloat.cpp
@@ -19,6 +19,8 @@
bf16 - bf16;
bf16 * bf16;
bf16 / bf16;
+ ++bf16;
+ --bf16;
__fp16 fp16;
Index: clang/lib/CodeGen/CGExprScalar.cpp
===================================================================
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -2764,8 +2764,8 @@
amt = llvm::ConstantFP::get(VMContext,
llvm::APFloat(static_cast<double>(amount)));
else {
- // Remaining types are Half, LongDouble, __ibm128 or __float128. Convert
- // from float.
+ // Remaining types are Half, Bfloat16, LongDouble, __ibm128 or __float128.
+ // Convert from float.
llvm::APFloat F(static_cast<float>(amount));
bool ignored;
const llvm::fltSemantics *FS;
@@ -2775,6 +2775,8 @@
FS = &CGF.getTarget().getFloat128Format();
else if (value->getType()->isHalfTy())
FS = &CGF.getTarget().getHalfFormat();
+ else if (value->getType()->isBFloatTy())
+ FS = &CGF.getTarget().getBFloat16Format();
else if (value->getType()->isPPC_FP128Ty())
FS = &CGF.getTarget().getIbm128Format();
else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152768.545049.patch
Type: text/x-patch
Size: 1338 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230728/e5ec69e5/attachment-0001.bin>
More information about the cfe-commits
mailing list