[PATCH] D103634: [BitcodeWriter][PowerPC] Avoid clearing lower bits for ppc_fp128 NullValues
Jinsong Ji via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 3 12:35:35 PDT 2021
jsji updated this revision to Diff 349648.
jsji added a comment.
Herald added a subscriber: dexonsmith.
Fix isNullValue for ppc_fp128.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103634/new/
https://reviews.llvm.org/D103634
Files:
llvm/lib/IR/Constants.cpp
llvm/test/CodeGen/PowerPC/ppc_fp128-bcwriter.ll
Index: llvm/test/CodeGen/PowerPC/ppc_fp128-bcwriter.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/ppc_fp128-bcwriter.ll
+++ llvm/test/CodeGen/PowerPC/ppc_fp128-bcwriter.ll
@@ -1,7 +1,7 @@
; RUN: llvm-as < %s -o - | llvm-dis - | FileCheck %s
;CHECK-LABEL: main
-;CHECK: store ppc_fp128 0xM0000000000000000000000000000000
+;CHECK: store ppc_fp128 0xM0000000000000000FFFFFFFFFFFFFFFF
define i32 @main() local_unnamed_addr {
_main_entry:
Index: llvm/lib/IR/Constants.cpp
===================================================================
--- llvm/lib/IR/Constants.cpp
+++ llvm/lib/IR/Constants.cpp
@@ -89,8 +89,13 @@
return CI->isZero();
// +0.0 is null.
- if (const ConstantFP *CFP = dyn_cast<ConstantFP>(this))
+ if (const ConstantFP *CFP = dyn_cast<ConstantFP>(this)) {
+ // ppc_fp128 determine isZero using high order double only
+ // Should check the bitwise value to make sure all bits are zero.
+ if (CFP->getType()->isPPC_FP128Ty())
+ return CFP->isExactlyValue(+0.0);
return CFP->isZero() && !CFP->isNegative();
+ }
// constant zero is zero for aggregates, cpnull is null for pointers, none for
// tokens.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103634.349648.patch
Type: text/x-patch
Size: 1215 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210603/7b310e1e/attachment.bin>
More information about the llvm-commits
mailing list