[all-commits] [llvm/llvm-project] 149f5b: [APFloat] convert SNaN to QNaN in convert() and ra...

RotateRight via All-commits all-commits at lists.llvm.org
Thu Oct 1 11:38:03 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 149f5b573c79eac0c519ada4d2f7c50e17796cdf
      https://github.com/llvm/llvm-project/commit/149f5b573c79eac0c519ada4d2f7c50e17796cdf
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-10-01 (Thu, 01 Oct 2020)

  Changed paths:
    M clang/test/CodeGen/builtin-nan-exception.c
    M clang/test/CodeGen/builtin-nan-legacy.c
    M clang/test/CodeGen/mips-unsupported-nan.c
    M llvm/lib/AsmParser/LLParser.cpp
    M llvm/lib/IR/AsmWriter.cpp
    M llvm/lib/Support/APFloat.cpp
    M llvm/test/Transforms/InstSimplify/ConstProp/cast.ll
    M llvm/test/Transforms/PhaseOrdering/X86/nancvt.ll
    M llvm/unittests/ADT/APFloatTest.cpp

  Log Message:
  -----------
  [APFloat] convert SNaN to QNaN in convert() and raise Invalid signal

This is an alternate fix (see D87835) for a bug where a NaN constant
gets wrongly transformed into Infinity via truncation.
In this patch, we uniformly convert any SNaN to QNaN while raising
'invalid op'.
But we don't have a way to directly specify a 32-bit SNaN value in LLVM IR,
so those are always encoded/decoded by calling convert from/to 64-bit hex.

See D88664 for a clang fix needed to allow this change.

Differential Revision: https://reviews.llvm.org/D88238




More information about the All-commits mailing list