diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 54b0a7d4826e..c3134dc795a5 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -90,7 +90,9 @@ bool Constant::isNullValue() const { // +0.0 is null. if (const ConstantFP *CFP = dyn_cast(this)) - return CFP->isZero() && !CFP->isNegative(); + // ppc_fp128 determine isZero using high order double only + // Should check the bitwise value to make sure all bits are zero. + return CFP->isExactlyValue(+0.0); // constant zero is zero for aggregates, cpnull is null for pointers, none for // tokens. diff --git a/llvm/test/CodeGen/PowerPC/ppc_fp128-bcwriter.ll b/llvm/test/CodeGen/PowerPC/ppc_fp128-bcwriter.ll index 7bf361f52d2a..101a0e49abde 100644 --- a/llvm/test/CodeGen/PowerPC/ppc_fp128-bcwriter.ll +++ b/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: