[clang] [llvm] [AsmWriter] Print `nan`, `pinf`, and `ninf` when applicable (PR #105618)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 22:38:21 PDT 2024


https://github.com/mshockwave created https://github.com/llvm/llvm-project/pull/105618

Instead of hexidecimal values, print `nan`, `pinf`, and `ninf` when the floating point constant is equal to positive quiet NaN with zero payload, positive infinity, and negative infinity, respectively.

This patch also introduce `-force-print-hex-special-fp` to revert back to the old behavior.

-----

This PR stacks on top of #102790 

>From 56afe104594d4a206eb1334b0af8e5d1b8345775 Mon Sep 17 00:00:00 2001
From: Min Hsu <min at myhsu.dev>
Date: Sat, 10 Aug 2024 21:58:37 -0700
Subject: [PATCH 1/3] [LLParser] Support identifiers like `qnan` and `pinf` for
 FP constants

Users can now write `qnan`, `snan`, `pinf`, and `ninf` for certain
special floating point constants, instead of the hexidecimal values.
---
 llvm/docs/LangRef.rst                      | 36 +++++++++++++------
 llvm/lib/AsmParser/LLParser.cpp            | 15 ++++++++
 llvm/unittests/AsmParser/AsmParserTest.cpp | 40 ++++++++++++++++++++++
 3 files changed, 80 insertions(+), 11 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 0ee4d7b444cfcf..899474d2cc413b 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -4387,12 +4387,12 @@ Simple Constants
     zeros. So '``s0x0001``' of type '``i16``' will be -1, not 1.
 **Floating-point constants**
     Floating-point constants use standard decimal notation (e.g.
-    123.421), exponential notation (e.g. 1.23421e+2), or a more precise
-    hexadecimal notation (see below). The assembler requires the exact
-    decimal value of a floating-point constant. For example, the
-    assembler accepts 1.25 but rejects 1.3 because 1.3 is a repeating
-    decimal in binary. Floating-point constants must have a
-    :ref:`floating-point <t_floating>` type.
+    123.421), exponential notation (e.g. 1.23421e+2), identifiers for special
+    values like ``qnan``, or a more precise hexadecimal notation (see below).
+    The assembler requires the exact decimal value of a floating-point
+    constant. For example, the assembler accepts 1.25 but rejects 1.3
+    because 1.3 is a repeating decimal in binary. Floating-point constants
+    must have a :ref:`floating-point <t_floating>` type.
 **Null pointer constants**
     The identifier '``null``' is recognized as a null pointer constant
     and must be of :ref:`pointer type <t_pointer>`.
@@ -4403,13 +4403,12 @@ Simple Constants
 The one non-intuitive notation for constants is the hexadecimal form of
 floating-point constants. For example, the form
 '``double    0x432ff973cafa8000``' is equivalent to (but harder to read
-than) '``double 4.5e+15``'. The only time hexadecimal floating-point
-constants are required (and the only time that they are generated by the
-disassembler) is when a floating-point constant must be emitted but it
+than) '``double 4.5e+15``'. Hexadecimal floating-point
+constants are used when a floating-point constant must be emitted but it
 cannot be represented as a decimal floating-point number in a reasonable
 number of digits. For example, NaN's, infinities, and other special
-values are represented in their IEEE hexadecimal format so that assembly
-and disassembly do not cause any bits to change in the constants.
+values are represented in their IEEE hexadecimal format. This ensures that
+assembly and disassembly do not cause any bits to change in the constants.
 
 When using the hexadecimal form, constants of types bfloat, half, float, and
 double are represented using the 16-digit form shown above (which matches the
@@ -4426,6 +4425,21 @@ represented by ``0xH`` followed by 4 hexadecimal digits. The bfloat 16-bit
 format is represented by ``0xR`` followed by 4 hexadecimal digits. All
 hexadecimal formats are big-endian (sign bit at the left).
 
+Some of the special floating point values can be represented by the following
+identifiers:
+
+    +-----------+---------------------------------------------------+
+    | Name      | Description                                       |
+    +===========+===================================================+
+    | ``qnan``  | Positive quiet NaN w/ payload equals to zero      |
+    +-----------+---------------------------------------------------+
+    | ``snan``  | Positive signaling NaN w/ payload equals to zero  |
+    +-----------+---------------------------------------------------+
+    | ``pinf``  | Positive infinity                                 |
+    +-----------+---------------------------------------------------+
+    | ``ninf``  | Negative infinity                                 |
+    +-----------+---------------------------------------------------+
+
 There are no constants of type x86_amx.
 
 .. _complexconstants:
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index f41907f0351257..fe909415eeab5b 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -3833,6 +3833,21 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
   case lltok::kw_poison: ID.Kind = ValID::t_Poison; break;
   case lltok::kw_zeroinitializer: ID.Kind = ValID::t_Zero; break;
   case lltok::kw_none: ID.Kind = ValID::t_None; break;
+  case lltok::kw_qnan:
+    ID.APFloatVal = APFloat::getQNaN(APFloat::IEEEdouble());
+    ID.Kind = ValID::t_APFloat;
+    break;
+  case lltok::kw_snan:
+    ID.APFloatVal = APFloat::getSNaN(APFloat::IEEEdouble());
+    ID.Kind = ValID::t_APFloat;
+    break;
+  case lltok::kw_pinf:
+  case lltok::kw_ninf:
+    ID.APFloatVal =
+        APFloat::getInf(APFloat::IEEEdouble(),
+                        /*Negative=*/Lex.getKind() == lltok::kw_ninf);
+    ID.Kind = ValID::t_APFloat;
+    break;
 
   case lltok::lbrace: {
     // ValID ::= '{' ConstVector '}'
diff --git a/llvm/unittests/AsmParser/AsmParserTest.cpp b/llvm/unittests/AsmParser/AsmParserTest.cpp
index a70c061d3e3044..7e1b000f17f922 100644
--- a/llvm/unittests/AsmParser/AsmParserTest.cpp
+++ b/llvm/unittests/AsmParser/AsmParserTest.cpp
@@ -82,6 +82,46 @@ TEST(AsmParserTest, TypeAndConstantValueParsing) {
   ASSERT_TRUE(isa<ConstantFP>(V));
   EXPECT_TRUE(cast<ConstantFP>(V)->isExactlyValue(3.5));
 
+  // Special floating point constants.
+  const APFloat *APFloatVal;
+  V = parseConstantValue("double qnan", Error, M);
+  ASSERT_TRUE(V);
+  EXPECT_TRUE(V->getType()->isDoubleTy());
+  ASSERT_TRUE(isa<ConstantFP>(V));
+  APFloatVal = &cast<ConstantFP>(V)->getValueAPF();
+  EXPECT_TRUE(APFloatVal->isNaN() && !APFloatVal->isSignaling());
+
+  V = parseConstantValue("double snan", Error, M);
+  ASSERT_TRUE(V);
+  EXPECT_TRUE(V->getType()->isDoubleTy());
+  ASSERT_TRUE(isa<ConstantFP>(V));
+  APFloatVal = &cast<ConstantFP>(V)->getValueAPF();
+  EXPECT_TRUE(APFloatVal->isNaN() && APFloatVal->isSignaling());
+
+  V = parseConstantValue("double pinf", Error, M);
+  ASSERT_TRUE(V);
+  EXPECT_TRUE(V->getType()->isDoubleTy());
+  ASSERT_TRUE(isa<ConstantFP>(V));
+  APFloatVal = &cast<ConstantFP>(V)->getValueAPF();
+  EXPECT_TRUE(APFloatVal->isInfinity() && !APFloatVal->isNegative());
+
+  V = parseConstantValue("double ninf", Error, M);
+  ASSERT_TRUE(V);
+  EXPECT_TRUE(V->getType()->isDoubleTy());
+  ASSERT_TRUE(isa<ConstantFP>(V));
+  APFloatVal = &cast<ConstantFP>(V)->getValueAPF();
+  EXPECT_TRUE(APFloatVal->isInfinity() && APFloatVal->isNegative());
+
+  // We always parse special values into IEEEdouble first before converting
+  // them into the right semantics once the type info is available.
+  // The following tests whether this conversion works as expected.
+  V = parseConstantValue("bfloat pinf", Error, M);
+  ASSERT_TRUE(V);
+  EXPECT_TRUE(V->getType()->isBFloatTy());
+  ASSERT_TRUE(isa<ConstantFP>(V));
+  APFloatVal = &cast<ConstantFP>(V)->getValueAPF();
+  EXPECT_TRUE(APFloatVal->isInfinity() && !APFloatVal->isNegative());
+
   V = parseConstantValue("i32 42", Error, M);
   ASSERT_TRUE(V);
   EXPECT_TRUE(V->getType()->isIntegerTy());

>From a87596eea207a9cc9b0116346995bb2e91327521 Mon Sep 17 00:00:00 2001
From: Min Hsu <min at myhsu.dev>
Date: Sun, 18 Aug 2024 22:13:56 -0700
Subject: [PATCH 2/3] Allow custom payload for SNaN and QNaN

And address review feedbacks.
---
 llvm/docs/LangRef.rst                      | 35 ++++++++++++++--------
 llvm/lib/AsmParser/LLParser.cpp            | 27 ++++++++++++++---
 llvm/test/Feature/float-special.ll         | 27 +++++++++++++++++
 llvm/unittests/AsmParser/AsmParserTest.cpp | 12 ++------
 4 files changed, 76 insertions(+), 25 deletions(-)
 create mode 100644 llvm/test/Feature/float-special.ll

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 899474d2cc413b..1bcc8089326ac1 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -4388,7 +4388,7 @@ Simple Constants
 **Floating-point constants**
     Floating-point constants use standard decimal notation (e.g.
     123.421), exponential notation (e.g. 1.23421e+2), identifiers for special
-    values like ``qnan``, or a more precise hexadecimal notation (see below).
+    values like ``nan``, or a more precise hexadecimal notation (see below).
     The assembler requires the exact decimal value of a floating-point
     constant. For example, the assembler accepts 1.25 but rejects 1.3
     because 1.3 is a repeating decimal in binary. Floating-point constants
@@ -4428,17 +4428,28 @@ hexadecimal formats are big-endian (sign bit at the left).
 Some of the special floating point values can be represented by the following
 identifiers:
 
-    +-----------+---------------------------------------------------+
-    | Name      | Description                                       |
-    +===========+===================================================+
-    | ``qnan``  | Positive quiet NaN w/ payload equals to zero      |
-    +-----------+---------------------------------------------------+
-    | ``snan``  | Positive signaling NaN w/ payload equals to zero  |
-    +-----------+---------------------------------------------------+
-    | ``pinf``  | Positive infinity                                 |
-    +-----------+---------------------------------------------------+
-    | ``ninf``  | Negative infinity                                 |
-    +-----------+---------------------------------------------------+
+    +-------------------+---------------------------------------------------+
+    | Name              | Description                                       |
+    +===================+===================================================+
+    | ``nan``           | Positive quiet NaN w/ payload equal to zero       |
+    +-------------------+---------------------------------------------------+
+    | ``qnan(payload)`` | Positive quiet NaN w/ custom payload              |
+    +-------------------+---------------------------------------------------+
+    | ``snan(payload)`` | Positive signaling NaN w/ custom payload          |
+    +-------------------+---------------------------------------------------+
+    | ``pinf``          | Positive infinity                                 |
+    +-------------------+---------------------------------------------------+
+    | ``ninf``          | Negative infinity                                 |
+    +-------------------+---------------------------------------------------+
+
+Please be careful when specifying the payload of ``snan`` and ``qnan``: the parser
+always uses a ``double`` to carry floating point constants before converting it to
+the target type. In some conversion cases, converting to ``float`` for instance,
+it "truncates" the significand bits (where the payloads are stored) from LSB
+rather than MSB. And if this conversion leads to any precision lost, it throws
+an error. For example, a value like ``float qnan(12)`` will give you an error
+because the lower 29 bits are lost after conversion and the new payload is now
+zero, which is considered a precision lost.
 
 There are no constants of type x86_amx.
 
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index fe909415eeab5b..925794ae07e646 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -3833,14 +3833,33 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
   case lltok::kw_poison: ID.Kind = ValID::t_Poison; break;
   case lltok::kw_zeroinitializer: ID.Kind = ValID::t_Zero; break;
   case lltok::kw_none: ID.Kind = ValID::t_None; break;
-  case lltok::kw_qnan:
+  case lltok::kw_nan:
     ID.APFloatVal = APFloat::getQNaN(APFloat::IEEEdouble());
     ID.Kind = ValID::t_APFloat;
     break;
-  case lltok::kw_snan:
-    ID.APFloatVal = APFloat::getSNaN(APFloat::IEEEdouble());
+  case lltok::kw_qnan:
+  case lltok::kw_snan: {
+    bool IsSignaling = Lex.getKind() == lltok::kw_snan;
+    Lex.Lex();
+    if (parseToken(lltok::lparen, "expected '('") ||
+        (Lex.getKind() != lltok::APSInt &&
+         tokError("expected an integer as payload")))
+      return true;
+    const APSInt &Payload = Lex.getAPSIntVal();
+    if (IsSignaling) {
+      if (Payload.isZero())
+        return tokError("expected non-zero value for SNaN's payload");
+      ID.APFloatVal =
+          APFloat::getSNaN(APFloat::IEEEdouble(), /*Negative=*/false, &Payload);
+    } else {
+      ID.APFloatVal =
+          APFloat::getQNaN(APFloat::IEEEdouble(), /*Negative=*/false, &Payload);
+    }
     ID.Kind = ValID::t_APFloat;
-    break;
+
+    Lex.Lex();
+    return parseToken(lltok::rparen, "expected ')'");
+  }
   case lltok::kw_pinf:
   case lltok::kw_ninf:
     ID.APFloatVal =
diff --git a/llvm/test/Feature/float-special.ll b/llvm/test/Feature/float-special.ll
new file mode 100644
index 00000000000000..84e07165f8fb94
--- /dev/null
+++ b/llvm/test/Feature/float-special.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+define float @nan(float %a) {
+; CHECK-LABEL: define float @nan(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT:    [[T:%.*]] = fadd float [[A]], 0x7FF8000000000000
+; CHECK-NEXT:    [[T1:%.*]] = fadd float [[T]], 0x7FFA000000000000
+; CHECK-NEXT:    [[R:%.*]] = fadd float [[T1]], 0x7FF4000000000000
+; CHECK-NEXT:    ret float [[T1]]
+;
+  %t = fadd float %a, nan
+  %t1 = fadd float %t, qnan(u0x2000000000000)
+  %r = fadd float %t1, snan(u0x4000000000000)
+  ret float %t1
+}
+
+define float @inf(float %a) {
+; CHECK-LABEL: define float @inf(
+; CHECK-SAME: float [[A:%.*]]) {
+; CHECK-NEXT:    [[T:%.*]] = fadd float [[A]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fadd float [[T]], 0xFFF0000000000000
+; CHECK-NEXT:    ret float [[R]]
+;
+  %t = fadd float %a, pinf
+  %r = fadd float %t, ninf
+  ret float %r
+}
diff --git a/llvm/unittests/AsmParser/AsmParserTest.cpp b/llvm/unittests/AsmParser/AsmParserTest.cpp
index 7e1b000f17f922..c804d702ee50a0 100644
--- a/llvm/unittests/AsmParser/AsmParserTest.cpp
+++ b/llvm/unittests/AsmParser/AsmParserTest.cpp
@@ -84,19 +84,13 @@ TEST(AsmParserTest, TypeAndConstantValueParsing) {
 
   // Special floating point constants.
   const APFloat *APFloatVal;
-  V = parseConstantValue("double qnan", Error, M);
+  V = parseConstantValue("double nan", Error, M);
   ASSERT_TRUE(V);
   EXPECT_TRUE(V->getType()->isDoubleTy());
   ASSERT_TRUE(isa<ConstantFP>(V));
   APFloatVal = &cast<ConstantFP>(V)->getValueAPF();
-  EXPECT_TRUE(APFloatVal->isNaN() && !APFloatVal->isSignaling());
-
-  V = parseConstantValue("double snan", Error, M);
-  ASSERT_TRUE(V);
-  EXPECT_TRUE(V->getType()->isDoubleTy());
-  ASSERT_TRUE(isa<ConstantFP>(V));
-  APFloatVal = &cast<ConstantFP>(V)->getValueAPF();
-  EXPECT_TRUE(APFloatVal->isNaN() && APFloatVal->isSignaling());
+  EXPECT_TRUE(
+      APFloatVal->bitwiseIsEqual(APFloat::getQNaN(APFloat::IEEEdouble())));
 
   V = parseConstantValue("double pinf", Error, M);
   ASSERT_TRUE(V);

>From e7b0a1b6b40101bc7d56456a63c265bdfb1ebe4b Mon Sep 17 00:00:00 2001
From: Min Hsu <min at myhsu.dev>
Date: Wed, 21 Aug 2024 22:34:20 -0700
Subject: [PATCH 3/3] [AsmWriter] Print `nan`, `pinf`, and `ninf` when
 applicable

Instead of hexidecimal values, print `nan`, `pinf`, and `ninf` when the
floating point constant is equal to positive quiet NaN with zero
payload, positive infinity, and negative infinity, respectively.

This patch also introduce `-force-print-hex-special-fp` to revert back
to the old behavior.
---
 clang/test/CodeGen/builtin-nan-exception.c    |   6 +-
 clang/test/CodeGen/builtin-nan-legacy.c       |   4 +-
 clang/test/CodeGen/builtin-nanf.c             |   2 +-
 clang/test/CodeGen/builtin_Float16.c          |   6 +-
 clang/test/CodeGen/builtins.c                 |  20 +--
 clang/test/CodeGen/complex-init-list.c        |   2 +-
 clang/test/CodeGen/ext-vector.c               |   2 +-
 clang/test/CodeGen/isfpclass.c                |   2 +-
 clang/test/CodeGen/math-builtins-long.c       |  16 +--
 clang/test/CodeGen/mips-unsupported-nan.c     |   4 +-
 clang/test/CodeGen/strictfp_builtins.c        |   4 +-
 clang/test/Headers/cuda_wrapper_algorithm.cu  |   8 +-
 clang/test/Lexer/11-27-2007-FloatLiterals.c   |   2 +-
 llvm/lib/IR/AsmWriter.cpp                     |  37 +++--
 llvm/test/Assembler/2002-04-07-InfConstant.ll |   2 +-
 llvm/test/Assembler/bfloat.ll                 |   6 +-
 .../GlobalISel/combine-fminimum-fmaximum.mir  |  16 +--
 llvm/test/Feature/float-special.ll            |   6 +-
 llvm/test/Feature/float.ll                    |   4 +
 .../Attributor/nofpclass-canonicalize.ll      |  24 ++--
 .../Attributor/nofpclass-implied-by-fcmp.ll   |  12 +-
 .../Attributor/nofpclass-nan-fmul.ll          |   2 +-
 .../Transforms/Attributor/nofpclass-select.ll |  28 ++--
 llvm/test/Transforms/Attributor/nofpclass.ll  |  32 +++--
 llvm/test/Transforms/DCE/calls-errno.ll       |   8 +-
 llvm/test/Transforms/EarlyCSE/atan.ll         |  14 +-
 llvm/test/Transforms/GVNHoist/hoist-call.ll   |  14 +-
 ...instruction-computeKnownFPClass-context.ll |   4 +-
 .../InstCombine/2007-03-25-BadShiftMask.ll    |   2 +-
 ...2009-01-19-fmod-constant-float-specials.ll |  34 ++---
 llvm/test/Transforms/InstCombine/and-fcmp.ll  |  48 +++----
 llvm/test/Transforms/InstCombine/atomicrmw.ll |   8 +-
 .../Transforms/InstCombine/binop-select.ll    |   4 +-
 .../InstCombine/canonicalize-fcmp-inf.ll      |  22 +--
 .../InstCombine/cast-int-fcmp-eq-0.ll         |   2 +-
 .../combine-is.fpclass-and-fcmp.ll            |  12 +-
 .../InstCombine/copysign-fneg-fabs.ll         |   4 +-
 .../create-class-from-logic-fcmp.ll           | 120 ++++++++--------
 .../InstCombine/fcmp-range-check-idiom.ll     |   2 +-
 llvm/test/Transforms/InstCombine/fdiv.ll      |  20 +--
 llvm/test/Transforms/InstCombine/fma.ll       |  34 ++---
 llvm/test/Transforms/InstCombine/fneg.ll      |  12 +-
 .../test/Transforms/InstCombine/fold-calls.ll |   4 +-
 .../InstCombine/fold-select-fmul-if-zero.ll   |  10 +-
 .../InstCombine/fpclass-check-idioms.ll       |  20 +--
 .../InstCombine/fpclass-from-dom-cond.ll      |   8 +-
 .../InstCombine/intrinsic-select.ll           |  16 +--
 .../test/Transforms/InstCombine/is_fpclass.ll |  64 ++++-----
 .../test/Transforms/InstCombine/known-bits.ll |   4 +-
 llvm/test/Transforms/InstCombine/maximum.ll   |  16 +--
 llvm/test/Transforms/InstCombine/maxnum.ll    |   4 +-
 llvm/test/Transforms/InstCombine/minimum.ll   |  16 +--
 llvm/test/Transforms/InstCombine/minnum.ll    |   4 +-
 llvm/test/Transforms/InstCombine/nan.ll       |   4 +-
 .../test/Transforms/InstCombine/nanl-fp128.ll |   2 +-
 llvm/test/Transforms/InstCombine/nanl-fp80.ll |   2 +-
 .../Transforms/InstCombine/nanl-ppc-fp128.ll  |   2 +-
 llvm/test/Transforms/InstCombine/pow-1.ll     |  24 ++--
 llvm/test/Transforms/InstCombine/pow-3.ll     |   4 +-
 llvm/test/Transforms/InstCombine/pow-exp.ll   |  16 +--
 llvm/test/Transforms/InstCombine/pow-sqrt.ll  |  18 +--
 llvm/test/Transforms/InstCombine/remquo.ll    |   6 +-
 .../shufflevec-constant-inseltpoison.ll       |   2 +-
 .../InstCombine/shufflevec-constant.ll        |   2 +-
 .../InstCombine/simplify-demanded-fpclass.ll  |  58 ++++----
 llvm/test/Transforms/InstCombine/sqrt.ll      |   2 +-
 .../ConstProp/WebAssembly/trunc.ll            |  48 +++----
 .../InstSimplify/ConstProp/calls.ll           |   2 +-
 .../Transforms/InstSimplify/ConstProp/cast.ll |  10 +-
 .../Transforms/InstSimplify/ConstProp/fma.ll  |  42 +++---
 .../InstSimplify/ConstProp/fp-undef.ll        | 128 +++++++++---------
 .../InstSimplify/ConstProp/min-max.ll         |  24 ++--
 .../vector-undef-elts-inseltpoison.ll         |   4 +-
 .../ConstProp/vector-undef-elts.ll            |   4 +-
 .../InstSimplify/X86/fp-nan-strictfp.ll       | 104 +++++++-------
 .../assume-fcmp-constant-implies-class.ll     |  30 ++--
 llvm/test/Transforms/InstSimplify/call.ll     |  30 ++--
 .../Transforms/InstSimplify/canonicalize.ll   |  34 ++---
 .../InstSimplify/constfold-constrained.ll     |  16 +--
 llvm/test/Transforms/InstSimplify/exp10.ll    |  32 ++---
 .../InstSimplify/floating-point-arithmetic.ll |  32 ++---
 .../InstSimplify/floating-point-compare.ll    |  12 +-
 .../Transforms/InstSimplify/fminmax-folds.ll  |  54 ++++----
 llvm/test/Transforms/InstSimplify/fp-nan.ll   |   8 +-
 .../InstSimplify/fp-undef-poison-strictfp.ll  |  28 ++--
 .../InstSimplify/fp-undef-poison.ll           |  26 ++--
 llvm/test/Transforms/InstSimplify/frexp.ll    |  30 ++--
 .../InstSimplify/known-never-infinity.ll      | 110 +++++++--------
 .../InstSimplify/known-never-nan.ll           |   8 +-
 llvm/test/Transforms/InstSimplify/ldexp.ll    |  26 ++--
 .../Transforms/InstSimplify/strictfp-fadd.ll  |   8 +-
 .../AArch64/scalable-reduction-inloop-cond.ll |   2 +-
 ...ze-force-tail-with-evl-inloop-reduction.ll |   4 +-
 .../LoopVectorize/reduction-inloop-cond.ll    |   2 +-
 .../LoopVectorize/select-cmp-multiuse.ll      |   6 +-
 .../PreISelIntrinsicLowering/expand-vp.ll     |  14 +-
 llvm/test/Transforms/Reassociate/pr42349.ll   |   2 +-
 .../SCCP/float-nan-simplification.ll          |   4 +-
 .../SLPVectorizer/X86/buildvector-shuffle.ll  |  10 +-
 .../SLPVectorizer/X86/catchswitch.ll          |  16 +--
 .../SLPVectorizer/X86/fabs-cost-softfp.ll     |   2 +-
 .../SimplifyCFG/fold-branch-to-common-dest.ll |   2 +-
 .../Transforms/SimplifyCFG/speculate-math.ll  |  16 +--
 .../Util/libcalls-shrinkwrap-double.ll        |  16 +--
 .../Util/libcalls-shrinkwrap-float.ll         |  16 +--
 .../Util/libcalls-shrinkwrap-long-double.ll   |  16 +--
 .../X86/insert-binop-with-constant.ll         |  32 ++---
 .../tools/llvm-reduce/reduce-operands-fp.ll   |  32 ++---
 108 files changed, 1000 insertions(+), 961 deletions(-)

diff --git a/clang/test/CodeGen/builtin-nan-exception.c b/clang/test/CodeGen/builtin-nan-exception.c
index 7445411ddf89ea..ba8bbf9c3b1d7d 100644
--- a/clang/test/CodeGen/builtin-nan-exception.c
+++ b/clang/test/CodeGen/builtin-nan-exception.c
@@ -8,7 +8,7 @@
 // An SNaN with no payload is formed by setting the bit after the
 // the quiet bit (MSB of the significand).
 
-// CHECK: float 0x7FF8000000000000, float 0x7FF4000000000000
+// CHECK: float nan, float 0x7FF4000000000000
 
 float f[] = {
   __builtin_nanf(""),
@@ -22,14 +22,14 @@ float f[] = {
 // but that should not cause a compilation error in the default
 // (ignore FP exceptions) mode.
 
-// CHECK: float 0x7FF8000000000000, float 0x7FFC000000000000
+// CHECK: float nan, float 0x7FFC000000000000
 
 float converted_to_float[] = {
   __builtin_nan(""),
   __builtin_nans(""),
 };
 
-// CHECK: double 0x7FF8000000000000, double 0x7FF4000000000000
+// CHECK: double nan, double 0x7FF4000000000000
 
 double d[] = {
   __builtin_nan(""),
diff --git a/clang/test/CodeGen/builtin-nan-legacy.c b/clang/test/CodeGen/builtin-nan-legacy.c
index de6c15379a4ddd..989c6976fb9500 100644
--- a/clang/test/CodeGen/builtin-nan-legacy.c
+++ b/clang/test/CodeGen/builtin-nan-legacy.c
@@ -1,6 +1,6 @@
 // RUN: %clang -target mipsel-unknown-linux -mnan=legacy -emit-llvm -S %s -o - | FileCheck %s
-// CHECK: float 0x7FFC000000000000, float 0x7FF8000000000000
-// CHECK: double 0x7FF4000000000000, double 0x7FF8000000000000
+// CHECK: float 0x7FFC000000000000, float nan
+// CHECK: double 0x7FF4000000000000, double nan
 
 // The first line shows an unintended consequence.
 // __builtin_nan() creates a legacy QNAN double with an empty payload
diff --git a/clang/test/CodeGen/builtin-nanf.c b/clang/test/CodeGen/builtin-nanf.c
index ae37c9dc807793..a6ef126da33f92 100644
--- a/clang/test/CodeGen/builtin-nanf.c
+++ b/clang/test/CodeGen/builtin-nanf.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s
-// RUN: grep 'float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000020000000, float 0x7FF8000000000000, float 0x7FF80001E0000000, float 0x7FF8001E00000000, float 0x7FF801E000000000, float 0x7FF81E0000000000, float 0x7FF9E00000000000, float 0x7FFFFFFFE0000000' %t
+// RUN: grep 'float nan, float nan, float 0x7FF8000020000000, float nan, float 0x7FF80001E0000000, float 0x7FF8001E00000000, float 0x7FF801E000000000, float 0x7FF81E0000000000, float 0x7FF9E00000000000, float 0x7FFFFFFFE0000000' %t
 
 float n[] = {
   __builtin_nanf("0"),
diff --git a/clang/test/CodeGen/builtin_Float16.c b/clang/test/CodeGen/builtin_Float16.c
index 099d2ad5697e34..9d3c481fa43c08 100644
--- a/clang/test/CodeGen/builtin_Float16.c
+++ b/clang/test/CodeGen/builtin_Float16.c
@@ -6,11 +6,11 @@
 void test_float16_builtins(void) {
   volatile _Float16 res;
 
-  // CHECK: store volatile half 0xH7C00, ptr %res, align 2
+  // CHECK: store volatile half pinf, ptr %res, align 2
   res = __builtin_huge_valf16();
-  // CHECK: store volatile half 0xH7C00, ptr %res, align 2
+  // CHECK: store volatile half pinf, ptr %res, align 2
   res = __builtin_inff16();
-  // CHECK: store volatile half 0xH7E00, ptr %res, align 2
+  // CHECK: store volatile half nan, ptr %res, align 2
   res = __builtin_nanf16("");
   // CHECK: store volatile half 0xH7D00, ptr %res, align 2
   res = __builtin_nansf16("");
diff --git a/clang/test/CodeGen/builtins.c b/clang/test/CodeGen/builtins.c
index 6383a3c65e3750..28ac628952655f 100644
--- a/clang/test/CodeGen/builtins.c
+++ b/clang/test/CodeGen/builtins.c
@@ -169,12 +169,12 @@ void bar(void) {
   // 0xAE98 == 1010111010011000
   // 0x15D3 == 1010111010011
 
-  f = __builtin_huge_valf();     // CHECK: float    0x7FF0000000000000
-  d = __builtin_huge_val();      // CHECK: double   0x7FF0000000000000
-  ld = __builtin_huge_vall();    // CHECK: x86_fp80 0xK7FFF8000000000000000
-  f = __builtin_nanf("");        // CHECK: float    0x7FF8000000000000
-  d = __builtin_nan("");         // CHECK: double   0x7FF8000000000000
-  ld = __builtin_nanl("");       // CHECK: x86_fp80 0xK7FFFC000000000000000
+  f = __builtin_huge_valf();     // CHECK: float    pinf
+  d = __builtin_huge_val();      // CHECK: double   pinf
+  ld = __builtin_huge_vall();    // CHECK: x86_fp80 pinf
+  f = __builtin_nanf("");        // CHECK: float    nan
+  d = __builtin_nan("");         // CHECK: double   nan
+  ld = __builtin_nanl("");       // CHECK: x86_fp80 nan
   f = __builtin_nanf("0xAE98");  // CHECK: float    0x7FF815D300000000
   d = __builtin_nan("0xAE98");   // CHECK: double   0x7FF800000000AE98
   ld = __builtin_nanl("0xAE98"); // CHECK: x86_fp80 0xK7FFFC00000000000AE98
@@ -238,7 +238,7 @@ void test_float_builtins(__fp16 *H, float F, double D, long double LD) {
 
   res = __builtin_isinf_sign(*H);
   // CHECK:  %[[ABS:.*]] = call half @llvm.fabs.f16(half %[[ARG:.*]])
-  // CHECK:  %[[ISINF:.*]] = fcmp oeq half %[[ABS]], 0xH7C00
+  // CHECK:  %[[ISINF:.*]] = fcmp oeq half %[[ABS]], pinf
   // CHECK:  %[[BITCAST:.*]] = bitcast half %[[ARG]] to i16
   // CHECK:  %[[ISNEG:.*]] = icmp slt i16 %[[BITCAST]], 0
   // CHECK:  %[[SIGN:.*]] = select i1 %[[ISNEG]], i32 -1, i32 1
@@ -246,7 +246,7 @@ void test_float_builtins(__fp16 *H, float F, double D, long double LD) {
 
   res = __builtin_isinf_sign(F);
   // CHECK:  %[[ABS:.*]] = call float @llvm.fabs.f32(float %[[ARG:.*]])
-  // CHECK:  %[[ISINF:.*]] = fcmp oeq float %[[ABS]], 0x7FF0000000000000
+  // CHECK:  %[[ISINF:.*]] = fcmp oeq float %[[ABS]], pinf
   // CHECK:  %[[BITCAST:.*]] = bitcast float %[[ARG]] to i32
   // CHECK:  %[[ISNEG:.*]] = icmp slt i32 %[[BITCAST]], 0
   // CHECK:  %[[SIGN:.*]] = select i1 %[[ISNEG]], i32 -1, i32 1
@@ -254,7 +254,7 @@ void test_float_builtins(__fp16 *H, float F, double D, long double LD) {
 
   res = __builtin_isinf_sign(D);
   // CHECK:  %[[ABS:.*]] = call double @llvm.fabs.f64(double %[[ARG:.*]])
-  // CHECK:  %[[ISINF:.*]] = fcmp oeq double %[[ABS]], 0x7FF0000000000000
+  // CHECK:  %[[ISINF:.*]] = fcmp oeq double %[[ABS]], pinf
   // CHECK:  %[[BITCAST:.*]] = bitcast double %[[ARG]] to i64
   // CHECK:  %[[ISNEG:.*]] = icmp slt i64 %[[BITCAST]], 0
   // CHECK:  %[[SIGN:.*]] = select i1 %[[ISNEG]], i32 -1, i32 1
@@ -262,7 +262,7 @@ void test_float_builtins(__fp16 *H, float F, double D, long double LD) {
 
   res = __builtin_isinf_sign(LD);
   // CHECK:  %[[ABS:.*]] = call x86_fp80 @llvm.fabs.f80(x86_fp80 %[[ARG:.*]])
-  // CHECK:  %[[ISINF:.*]] = fcmp oeq x86_fp80 %[[ABS]], 0xK7FFF8000000000000000
+  // CHECK:  %[[ISINF:.*]] = fcmp oeq x86_fp80 %[[ABS]], pinf
   // CHECK:  %[[BITCAST:.*]] = bitcast x86_fp80 %[[ARG]] to i80
   // CHECK:  %[[ISNEG:.*]] = icmp slt i80 %[[BITCAST]], 0
   // CHECK:  %[[SIGN:.*]] = select i1 %[[ISNEG]], i32 -1, i32 1
diff --git a/clang/test/CodeGen/complex-init-list.c b/clang/test/CodeGen/complex-init-list.c
index 262b44d213b3f1..90a08669065002 100644
--- a/clang/test/CodeGen/complex-init-list.c
+++ b/clang/test/CodeGen/complex-init-list.c
@@ -5,7 +5,7 @@
 // extensive description and test in test/Sema/complex-init-list.c.)
 
 _Complex float x = { 1.0f, 1.0f/0.0f };
-// CHECK: @x ={{.*}} global { float, float } { float 1.000000e+00, float 0x7FF0000000000000 }, align 4
+// CHECK: @x ={{.*}} global { float, float } { float 1.000000e+00, float pinf }, align 4
 
 _Complex float f(float x, float y) { _Complex float z = { x, y }; return z; }
 // CHECK-LABEL: define{{.*}} <2 x float> @f
diff --git a/clang/test/CodeGen/ext-vector.c b/clang/test/CodeGen/ext-vector.c
index db8baf054ac7b8..bd2600a3061b5f 100644
--- a/clang/test/CodeGen/ext-vector.c
+++ b/clang/test/CodeGen/ext-vector.c
@@ -8,7 +8,7 @@ typedef __attribute__(( ext_vector_type(4) )) unsigned int uint4;
 // CHECK: @foo = {{(dso_local )?}}global <4 x float> <float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00>
 float4 foo = (float4){ 1.0, 2.0, 3.0, 4.0 };
 
-// CHECK: @bar = {{(dso_local )?}}constant <4 x float> <float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 0x7FF0000000000000>
+// CHECK: @bar = {{(dso_local )?}}constant <4 x float> <float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float pinf>
 const float4 bar = (float4){ 1.0, 2.0, 3.0, __builtin_inff() };
 
 // CHECK: @test1
diff --git a/clang/test/CodeGen/isfpclass.c b/clang/test/CodeGen/isfpclass.c
index a0e04eaad5929d..3cd3a475e49c1d 100644
--- a/clang/test/CodeGen/isfpclass.c
+++ b/clang/test/CodeGen/isfpclass.c
@@ -5,7 +5,7 @@
 // CHECK-SAME: (float noundef [[X:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.fabs.f32(float [[X]])
-// CHECK-NEXT:    [[TMP1:%.*]] = fcmp one float [[TMP0]], 0x7FF0000000000000
+// CHECK-NEXT:    [[TMP1:%.*]] = fcmp one float [[TMP0]], pinf
 // CHECK-NEXT:    ret i1 [[TMP1]]
 //
 _Bool check_isfpclass_finite(float x) {
diff --git a/clang/test/CodeGen/math-builtins-long.c b/clang/test/CodeGen/math-builtins-long.c
index 183349e0f01734..f63099db04c07a 100644
--- a/clang/test/CodeGen/math-builtins-long.c
+++ b/clang/test/CodeGen/math-builtins-long.c
@@ -40,16 +40,16 @@ void foo(long double f, long double *l, int *i, const char *c) {
   // PPCF128: call { fp128, i32 } @llvm.frexp.f128.i32(fp128 %{{.+}})
   __builtin_frexpl(f,i);
 
-  // F80: store x86_fp80 0xK7FFF8000000000000000, ptr
-  // PPC: store ppc_fp128 0xM7FF00000000000000000000000000000, ptr
-  // X86F128: store fp128 0xL00000000000000007FFF000000000000, ptr
-  // PPCF128: store fp128 0xL00000000000000007FFF000000000000, ptr
+  // F80: store x86_fp80 pinf, ptr
+  // PPC: store ppc_fp128 pinf, ptr
+  // X86F128: store fp128 pinf, ptr
+  // PPCF128: store fp128 pinf, ptr
   *l = __builtin_huge_vall();
 
-  // F80: store x86_fp80 0xK7FFF8000000000000000, ptr
-  // PPC: store ppc_fp128 0xM7FF00000000000000000000000000000, ptr
-  // X86F128: store fp128 0xL00000000000000007FFF000000000000, ptr
-  // PPCF128: store fp128 0xL00000000000000007FFF000000000000, ptr
+  // F80: store x86_fp80 pinf, ptr
+  // PPC: store ppc_fp128 pinf, ptr
+  // X86F128: store fp128 pinf, ptr
+  // PPCF128: store fp128 pinf, ptr
   *l = __builtin_infl();
 
   // F80: call x86_fp80 @ldexpl(x86_fp80 noundef %{{.+}}, i32 noundef %{{.+}})
diff --git a/clang/test/CodeGen/mips-unsupported-nan.c b/clang/test/CodeGen/mips-unsupported-nan.c
index 16cea3c2e7e182..b2d08104d76f06 100644
--- a/clang/test/CodeGen/mips-unsupported-nan.c
+++ b/clang/test/CodeGen/mips-unsupported-nan.c
@@ -45,7 +45,7 @@
 // In regular (2008) mode, the quiet bit is set to indicate QNAN.
 
 // CHECK-NANLEGACY: double 0x7FF4000000000000
-// CHECK-NAN2008: double 0x7FF8000000000000
+// CHECK-NAN2008: double nan
 
 double d =  __builtin_nan("");
 
@@ -54,6 +54,6 @@ double d =  __builtin_nan("");
 // quiet bit on conversion independently of the setting in clang.
 
 // CHECK-NANLEGACY: float 0x7FFC000000000000
-// CHECK-NAN2008: float 0x7FF8000000000000
+// CHECK-NAN2008: float nan
 
 float f =  __builtin_nan("");
diff --git a/clang/test/CodeGen/strictfp_builtins.c b/clang/test/CodeGen/strictfp_builtins.c
index 58815c7de4fa94..b66983af4457c5 100644
--- a/clang/test/CodeGen/strictfp_builtins.c
+++ b/clang/test/CodeGen/strictfp_builtins.c
@@ -42,7 +42,7 @@ void p(char *str, int x) {
 // CHECK-NEXT:    br i1 [[CMP]], label [[FPCLASSIFY_END]], label [[FPCLASSIFY_NOT_NAN]]
 // CHECK:       fpclassify_not_nan:
 // CHECK-NEXT:    [[TMP1:%.*]] = call double @llvm.fabs.f64(double [[TMP0]]) #[[ATTR5:[0-9]+]]
-// CHECK-NEXT:    [[ISINF:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x7FF0000000000000, metadata !"oeq", metadata !"fpexcept.strict") #[[ATTR4]]
+// CHECK-NEXT:    [[ISINF:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double pinf, metadata !"oeq", metadata !"fpexcept.strict") #[[ATTR4]]
 // CHECK-NEXT:    br i1 [[ISINF]], label [[FPCLASSIFY_END]], label [[FPCLASSIFY_NOT_INF]]
 // CHECK:       fpclassify_not_inf:
 // CHECK-NEXT:    [[ISNORMAL:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x10000000000000, metadata !"uge", metadata !"fpexcept.strict") #[[ATTR4]]
@@ -157,7 +157,7 @@ void test_double_isfinite(double d) {
 // CHECK-NEXT:    store double [[D:%.*]], ptr [[D_ADDR]], align 8
 // CHECK-NEXT:    [[TMP0:%.*]] = load double, ptr [[D_ADDR]], align 8
 // CHECK-NEXT:    [[TMP1:%.*]] = call double @llvm.fabs.f64(double [[TMP0]]) #[[ATTR5]]
-// CHECK-NEXT:    [[ISINF:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double 0x7FF0000000000000, metadata !"oeq", metadata !"fpexcept.strict") #[[ATTR4]]
+// CHECK-NEXT:    [[ISINF:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double [[TMP1]], double pinf, metadata !"oeq", metadata !"fpexcept.strict") #[[ATTR4]]
 // CHECK-NEXT:    [[TMP2:%.*]] = bitcast double [[TMP0]] to i64
 // CHECK-NEXT:    [[TMP3:%.*]] = icmp slt i64 [[TMP2]], 0
 // CHECK-NEXT:    [[TMP4:%.*]] = select i1 [[TMP3]], i32 -1, i32 1
diff --git a/clang/test/Headers/cuda_wrapper_algorithm.cu b/clang/test/Headers/cuda_wrapper_algorithm.cu
index d514285f7e17bb..45fa408814c72e 100644
--- a/clang/test/Headers/cuda_wrapper_algorithm.cu
+++ b/clang/test/Headers/cuda_wrapper_algorithm.cu
@@ -16,7 +16,7 @@ extern "C" bool cmp(double a, double b) { return a<b; }
 
 // CHECK-LABEL: @test_std_min(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:    ret double 0x7FF8000000000000
+// CHECK-NEXT:    ret double nan
 //
 extern "C" double test_std_min() {
   return std::min(__builtin_nan(""), 0.0);
@@ -24,7 +24,7 @@ extern "C" double test_std_min() {
 
 // CHECK-LABEL: @test_std_min_cmp(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:    ret double 0x7FF8000000000000
+// CHECK-NEXT:    ret double nan
 //
 extern "C" double test_std_min_cmp() {
   return std::min(__builtin_nan(""), 0.0, cmp);
@@ -32,7 +32,7 @@ extern "C" double test_std_min_cmp() {
 
 // CHECK-LABEL: @test_std_max(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:    ret double 0x7FF8000000000000
+// CHECK-NEXT:    ret double nan
 //
 extern "C" double test_std_max() {
   return std::max(__builtin_nan(""), 0.0);
@@ -40,7 +40,7 @@ extern "C" double test_std_max() {
 
 // CHECK-LABEL: @test_std_max_cmp(
 // CHECK-NEXT:  entry:
-// CHECK-NEXT:    ret double 0x7FF8000000000000
+// CHECK-NEXT:    ret double nan
 //
 extern "C" double test_std_max_cmp() {
   return std::max(__builtin_nan(""), 0.0, cmp);
diff --git a/clang/test/Lexer/11-27-2007-FloatLiterals.c b/clang/test/Lexer/11-27-2007-FloatLiterals.c
index f3d978b06925cd..2033c87a0a2a1b 100644
--- a/clang/test/Lexer/11-27-2007-FloatLiterals.c
+++ b/clang/test/Lexer/11-27-2007-FloatLiterals.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -mllvm -force-print-hex-special-fp -o - | FileCheck %s
 
 // CHECK: 0x3BFD83C940000000
 // CHECK: 2.000000e+{{[0]*}}32
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 01a16ccd688f43..5b25b554476adc 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -67,6 +67,7 @@
 #include "llvm/IR/Value.h"
 #include "llvm/Support/AtomicOrdering.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -89,6 +90,13 @@
 
 using namespace llvm;
 
+static cl::opt<bool>
+    ForcePrintHexForSpecialFP("force-print-hex-special-fp",
+                              cl::desc("Force print hex on special floating-"
+                                       "point constants rather than identifiers"
+                                       " like `nan` or `pinf`."),
+                              cl::Hidden, cl::init(false));
+
 // Make virtual table appear in this compilation unit.
 AssemblyAnnotationWriter::~AssemblyAnnotationWriter() = default;
 
@@ -1441,15 +1449,28 @@ static void WriteOptimizationInfo(raw_ostream &Out, const User *U) {
 }
 
 static void WriteAPFloatInternal(raw_ostream &Out, const APFloat &APF) {
-  if (&APF.getSemantics() == &APFloat::IEEEsingle() ||
-      &APF.getSemantics() == &APFloat::IEEEdouble()) {
+  const fltSemantics &Semantics = APF.getSemantics();
+
+  // First, try to see if we can print it as `nan`, `pinf`, or `ninf`.
+  if (!ForcePrintHexForSpecialFP &&
+      APF.bitwiseIsEqual(APFloat::getQNaN(Semantics))) {
+    Out << "nan";
+    return;
+  }
+  if (!ForcePrintHexForSpecialFP && APF.isInfinity()) {
+    Out << (APF.isNegative() ? "ninf" : "pinf");
+    return;
+  }
+
+  if (&Semantics == &APFloat::IEEEsingle() ||
+      &Semantics == &APFloat::IEEEdouble()) {
     // We would like to output the FP constant value in exponential notation,
     // but we cannot do this if doing so will lose precision.  Check here to
     // make sure that we only output it in exponential format if we can parse
     // the value back and get the same value.
     //
     bool ignored;
-    bool isDouble = &APF.getSemantics() == &APFloat::IEEEdouble();
+    bool isDouble = &Semantics == &APFloat::IEEEdouble();
     bool isInf = APF.isInfinity();
     bool isNaN = APF.isNaN();
 
@@ -1503,29 +1524,29 @@ static void WriteAPFloatInternal(raw_ostream &Out, const APFloat &APF) {
   // fixed number of hex digits.
   Out << "0x";
   APInt API = APF.bitcastToAPInt();
-  if (&APF.getSemantics() == &APFloat::x87DoubleExtended()) {
+  if (&Semantics == &APFloat::x87DoubleExtended()) {
     Out << 'K';
     Out << format_hex_no_prefix(API.getHiBits(16).getZExtValue(), 4,
                                 /*Upper=*/true);
     Out << format_hex_no_prefix(API.getLoBits(64).getZExtValue(), 16,
                                 /*Upper=*/true);
-  } else if (&APF.getSemantics() == &APFloat::IEEEquad()) {
+  } else if (&Semantics == &APFloat::IEEEquad()) {
     Out << 'L';
     Out << format_hex_no_prefix(API.getLoBits(64).getZExtValue(), 16,
                                 /*Upper=*/true);
     Out << format_hex_no_prefix(API.getHiBits(64).getZExtValue(), 16,
                                 /*Upper=*/true);
-  } else if (&APF.getSemantics() == &APFloat::PPCDoubleDouble()) {
+  } else if (&Semantics == &APFloat::PPCDoubleDouble()) {
     Out << 'M';
     Out << format_hex_no_prefix(API.getLoBits(64).getZExtValue(), 16,
                                 /*Upper=*/true);
     Out << format_hex_no_prefix(API.getHiBits(64).getZExtValue(), 16,
                                 /*Upper=*/true);
-  } else if (&APF.getSemantics() == &APFloat::IEEEhalf()) {
+  } else if (&Semantics == &APFloat::IEEEhalf()) {
     Out << 'H';
     Out << format_hex_no_prefix(API.getZExtValue(), 4,
                                 /*Upper=*/true);
-  } else if (&APF.getSemantics() == &APFloat::BFloat()) {
+  } else if (&Semantics == &APFloat::BFloat()) {
     Out << 'R';
     Out << format_hex_no_prefix(API.getZExtValue(), 4,
                                 /*Upper=*/true);
diff --git a/llvm/test/Assembler/2002-04-07-InfConstant.ll b/llvm/test/Assembler/2002-04-07-InfConstant.ll
index 6cd544791c5741..b3ce9fe4c99049 100644
--- a/llvm/test/Assembler/2002-04-07-InfConstant.ll
+++ b/llvm/test/Assembler/2002-04-07-InfConstant.ll
@@ -1,6 +1,6 @@
 ; The output formater prints out 1.0e100 as Inf!
 ;
-; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | grep 0x7FF0000000000000
+; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis --force-print-hex-special-fp | grep 0x7FF0000000000000
 ; RUN: verify-uselistorder %s
 
 define float @test() {
diff --git a/llvm/test/Assembler/bfloat.ll b/llvm/test/Assembler/bfloat.ll
index 3a3b4c2b277db7..9ee03a65da1020 100644
--- a/llvm/test/Assembler/bfloat.ll
+++ b/llvm/test/Assembler/bfloat.ll
@@ -45,18 +45,18 @@ define bfloat @snan_bfloat() {
 
 ; ASSEM-DISASS-LABEL @qnan_bfloat
 define bfloat @qnan_bfloat() {
-; ASSEM-DISASS: ret bfloat 0xR7FC0
+; ASSEM-DISASS: ret bfloat nan
     ret bfloat 0xR7FC0
 }
 
 ; ASSEM-DISASS-LABEL @pos_inf_bfloat
 define bfloat @pos_inf_bfloat() {
-; ASSEM-DISASS: ret bfloat 0xR7F80
+; ASSEM-DISASS: ret bfloat pinf
     ret bfloat 0xR7F80
 }
 
 ; ASSEM-DISASS-LABEL @neg_inf_bfloat
 define bfloat @neg_inf_bfloat() {
-; ASSEM-DISASS: ret bfloat 0xRFF80
+; ASSEM-DISASS: ret bfloat ninf
     ret bfloat 0xRFF80
 }
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/combine-fminimum-fmaximum.mir b/llvm/test/CodeGen/AArch64/GlobalISel/combine-fminimum-fmaximum.mir
index 6e675c00d846ba..81acb24707dd97 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/combine-fminimum-fmaximum.mir
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/combine-fminimum-fmaximum.mir
@@ -20,7 +20,7 @@ body:             |
   bb.1:
   liveins:
     ; CHECK-LABEL: name: test_combine_nan_rhs_fminimum_float
-    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0x7FF8000000000000
+    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float nan
     ; CHECK-NEXT: $w0 = COPY [[C]](s32)
     %0:_(s32) = COPY $w0
     %1:_(s32) = G_FCONSTANT float 0x7FF8000000000000
@@ -33,7 +33,7 @@ body:             |
   bb.1:
   liveins:
     ; CHECK-LABEL: name: test_combine_nan_rhs_fminimum_double
-    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0x7FF8000000000000
+    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double nan
     ; CHECK-NEXT: $x0 = COPY [[C]](s64)
     %0:_(s64) = COPY $x0
     %1:_(s64) = G_FCONSTANT double 0x7FF8000000000000
@@ -59,7 +59,7 @@ body:             |
   bb.1:
   liveins:
     ; CHECK-LABEL: name: test_combine_nan_lhs_fminimum_float
-    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0x7FF8000000000000
+    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float nan
     ; CHECK-NEXT: $w0 = COPY [[C]](s32)
     %0:_(s32) = COPY $w0
     %1:_(s32) = G_FCONSTANT float 0x7FF8000000000000
@@ -72,7 +72,7 @@ body:             |
   bb.1:
   liveins:
     ; CHECK-LABEL: name: test_combine_nan_lhs_fminimum_double
-    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0x7FF8000000000000
+    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double nan
     ; CHECK-NEXT: $x0 = COPY [[C]](s64)
     %0:_(s64) = COPY $x0
     %1:_(s64) = G_FCONSTANT double 0x7FF8000000000000
@@ -98,7 +98,7 @@ body:             |
   bb.1:
   liveins:
     ; CHECK-LABEL: name: test_combine_nan_rhs_fmaximum_float
-    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0x7FF8000000000000
+    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float nan
     ; CHECK-NEXT: $w0 = COPY [[C]](s32)
     %0:_(s32) = COPY $w0
     %1:_(s32) = G_FCONSTANT float 0x7FF8000000000000
@@ -111,7 +111,7 @@ body:             |
   bb.1:
   liveins:
     ; CHECK-LABEL: name: test_combine_nan_rhs_fmaximum_double
-    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0x7FF8000000000000
+    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double nan
     ; CHECK-NEXT: $x0 = COPY [[C]](s64)
     %0:_(s64) = COPY $x0
     %1:_(s64) = G_FCONSTANT double 0x7FF8000000000000
@@ -137,7 +137,7 @@ body:             |
   bb.1:
   liveins:
     ; CHECK-LABEL: name: test_combine_nan_lhs_fmaximum_float
-    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0x7FF8000000000000
+    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float nan
     ; CHECK-NEXT: $w0 = COPY [[C]](s32)
     %0:_(s32) = COPY $w0
     %1:_(s32) = G_FCONSTANT float 0x7FF8000000000000
@@ -150,7 +150,7 @@ body:             |
   bb.1:
   liveins:
     ; CHECK-LABEL: name: test_combine_nan_lhs_fmaximum_double
-    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0x7FF8000000000000
+    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double nan
     ; CHECK-NEXT: $x0 = COPY [[C]](s64)
     %0:_(s64) = COPY $x0
     %1:_(s64) = G_FCONSTANT double 0x7FF8000000000000
diff --git a/llvm/test/Feature/float-special.ll b/llvm/test/Feature/float-special.ll
index 84e07165f8fb94..7229070099d68e 100644
--- a/llvm/test/Feature/float-special.ll
+++ b/llvm/test/Feature/float-special.ll
@@ -3,7 +3,7 @@
 define float @nan(float %a) {
 ; CHECK-LABEL: define float @nan(
 ; CHECK-SAME: float [[A:%.*]]) {
-; CHECK-NEXT:    [[T:%.*]] = fadd float [[A]], 0x7FF8000000000000
+; CHECK-NEXT:    [[T:%.*]] = fadd float [[A]], nan
 ; CHECK-NEXT:    [[T1:%.*]] = fadd float [[T]], 0x7FFA000000000000
 ; CHECK-NEXT:    [[R:%.*]] = fadd float [[T1]], 0x7FF4000000000000
 ; CHECK-NEXT:    ret float [[T1]]
@@ -17,8 +17,8 @@ define float @nan(float %a) {
 define float @inf(float %a) {
 ; CHECK-LABEL: define float @inf(
 ; CHECK-SAME: float [[A:%.*]]) {
-; CHECK-NEXT:    [[T:%.*]] = fadd float [[A]], 0x7FF0000000000000
-; CHECK-NEXT:    [[R:%.*]] = fadd float [[T]], 0xFFF0000000000000
+; CHECK-NEXT:    [[T:%.*]] = fadd float [[A]], pinf
+; CHECK-NEXT:    [[R:%.*]] = fadd float [[T]], ninf
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %t = fadd float %a, pinf
diff --git a/llvm/test/Feature/float.ll b/llvm/test/Feature/float.ll
index b875afe9804747..ab3c7b951080f5 100644
--- a/llvm/test/Feature/float.ll
+++ b/llvm/test/Feature/float.ll
@@ -5,3 +5,7 @@
 @H1     = global half 0x4010000000000000
 @F1     = global float 0x4010000000000000
 @D1     = global double 0x4010000000000000
+
+ at NAN    = global float nan
+ at INF    = global float pinf
+ at NINF   = global float ninf
diff --git a/llvm/test/Transforms/Attributor/nofpclass-canonicalize.ll b/llvm/test/Transforms/Attributor/nofpclass-canonicalize.ll
index 35f8456828ca5a..17513ef838b517 100644
--- a/llvm/test/Transforms/Attributor/nofpclass-canonicalize.ll
+++ b/llvm/test/Transforms/Attributor/nofpclass-canonicalize.ll
@@ -166,7 +166,7 @@ define float @ret_canonicalize_ieee_constant_neg_normal() "denormal-fp-math"="ie
 define float @ret_canonicalize_ieee_constant_pos_inf() "denormal-fp-math"="ieee,ieee" {
 ; CHECK-LABEL: define noundef nofpclass(nan ninf zero sub norm) float @ret_canonicalize_ieee_constant_pos_inf
 ; CHECK-SAME: () #[[ATTR9]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan ninf zero sub norm) float @llvm.canonicalize.f32(float noundef 0x7FF0000000000000) #[[ATTR12]]
+; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan ninf zero sub norm) float @llvm.canonicalize.f32(float noundef pinf) #[[ATTR12]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.canonicalize.f32(float 0x7FF0000000000000)
@@ -176,7 +176,7 @@ define float @ret_canonicalize_ieee_constant_pos_inf() "denormal-fp-math"="ieee,
 define float @ret_canonicalize_ieee_constant_neg_inf() "denormal-fp-math"="ieee,ieee" {
 ; CHECK-LABEL: define noundef nofpclass(nan pinf zero sub norm) float @ret_canonicalize_ieee_constant_neg_inf
 ; CHECK-SAME: () #[[ATTR9]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan pinf zero sub norm) float @llvm.canonicalize.f32(float noundef 0xFFF0000000000000) #[[ATTR12]]
+; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan pinf zero sub norm) float @llvm.canonicalize.f32(float noundef ninf) #[[ATTR12]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.canonicalize.f32(float 0xFFF0000000000000)
@@ -186,7 +186,7 @@ define float @ret_canonicalize_ieee_constant_neg_inf() "denormal-fp-math"="ieee,
 define float @ret_canonicalize_ieee_constant_qnan() "denormal-fp-math"="ieee,ieee" {
 ; CHECK-LABEL: define noundef nofpclass(snan inf zero sub norm) float @ret_canonicalize_ieee_constant_qnan
 ; CHECK-SAME: () #[[ATTR9]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(snan inf zero sub norm) float @llvm.canonicalize.f32(float noundef 0x7FF8000000000000) #[[ATTR12]]
+; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(snan inf zero sub norm) float @llvm.canonicalize.f32(float noundef nan) #[[ATTR12]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.canonicalize.f32(float 0x7FF8000000000000)
@@ -266,7 +266,7 @@ define float @ret_canonicalize_daz_constant_neg_normal() "denormal-fp-math"="pre
 define float @ret_canonicalize_daz_constant_pos_inf() "denormal-fp-math"="preserve-sign,preserve-sign" {
 ; CHECK-LABEL: define noundef nofpclass(nan ninf sub norm) float @ret_canonicalize_daz_constant_pos_inf
 ; CHECK-SAME: () #[[ATTR10]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan ninf sub norm) float @llvm.canonicalize.f32(float noundef 0x7FF0000000000000) #[[ATTR12]]
+; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan ninf sub norm) float @llvm.canonicalize.f32(float noundef pinf) #[[ATTR12]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.canonicalize.f32(float 0x7FF0000000000000)
@@ -276,7 +276,7 @@ define float @ret_canonicalize_daz_constant_pos_inf() "denormal-fp-math"="preser
 define float @ret_canonicalize_daz_constant_neg_inf() "denormal-fp-math"="preserve-sign,preserve-sign" {
 ; CHECK-LABEL: define noundef nofpclass(nan pinf sub norm) float @ret_canonicalize_daz_constant_neg_inf
 ; CHECK-SAME: () #[[ATTR10]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan pinf sub norm) float @llvm.canonicalize.f32(float noundef 0xFFF0000000000000) #[[ATTR12]]
+; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan pinf sub norm) float @llvm.canonicalize.f32(float noundef ninf) #[[ATTR12]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.canonicalize.f32(float 0xFFF0000000000000)
@@ -286,7 +286,7 @@ define float @ret_canonicalize_daz_constant_neg_inf() "denormal-fp-math"="preser
 define float @ret_canonicalize_daz_constant_qnan() "denormal-fp-math"="preserve-sign,preserve-sign" {
 ; CHECK-LABEL: define noundef nofpclass(snan inf sub norm) float @ret_canonicalize_daz_constant_qnan
 ; CHECK-SAME: () #[[ATTR10]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(snan inf sub norm) float @llvm.canonicalize.f32(float noundef 0x7FF8000000000000) #[[ATTR12]]
+; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(snan inf sub norm) float @llvm.canonicalize.f32(float noundef nan) #[[ATTR12]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.canonicalize.f32(float 0x7FF8000000000000)
@@ -366,7 +366,7 @@ define float @ret_canonicalize_dapz_constant_neg_normal() "denormal-fp-math"="po
 define float @ret_canonicalize_dapz_constant_pos_inf() "denormal-fp-math"="positive-zero,positive-zero" {
 ; CHECK-LABEL: define noundef nofpclass(nan ninf nzero sub norm) float @ret_canonicalize_dapz_constant_pos_inf
 ; CHECK-SAME: () #[[ATTR11]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan ninf nzero sub norm) float @llvm.canonicalize.f32(float noundef 0x7FF0000000000000) #[[ATTR12]]
+; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan ninf nzero sub norm) float @llvm.canonicalize.f32(float noundef pinf) #[[ATTR12]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.canonicalize.f32(float 0x7FF0000000000000)
@@ -376,7 +376,7 @@ define float @ret_canonicalize_dapz_constant_pos_inf() "denormal-fp-math"="posit
 define float @ret_canonicalize_dapz_constant_neg_inf() "denormal-fp-math"="positive-zero,positive-zero" {
 ; CHECK-LABEL: define noundef nofpclass(nan pinf nzero sub norm) float @ret_canonicalize_dapz_constant_neg_inf
 ; CHECK-SAME: () #[[ATTR11]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan pinf nzero sub norm) float @llvm.canonicalize.f32(float noundef 0xFFF0000000000000) #[[ATTR12]]
+; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan pinf nzero sub norm) float @llvm.canonicalize.f32(float noundef ninf) #[[ATTR12]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.canonicalize.f32(float 0xFFF0000000000000)
@@ -386,7 +386,7 @@ define float @ret_canonicalize_dapz_constant_neg_inf() "denormal-fp-math"="posit
 define float @ret_canonicalize_dapz_constant_qnan() "denormal-fp-math"="positive-zero,positive-zero" {
 ; CHECK-LABEL: define noundef nofpclass(snan inf nzero sub norm) float @ret_canonicalize_dapz_constant_qnan
 ; CHECK-SAME: () #[[ATTR11]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(snan inf nzero sub norm) float @llvm.canonicalize.f32(float noundef 0x7FF8000000000000) #[[ATTR12]]
+; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(snan inf nzero sub norm) float @llvm.canonicalize.f32(float noundef nan) #[[ATTR12]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.canonicalize.f32(float 0x7FF8000000000000)
@@ -466,7 +466,7 @@ define float @ret_canonicalize_dynamic_constant_neg_normal() "denormal-fp-math"=
 define float @ret_canonicalize_dynamic_constant_pos_inf() "denormal-fp-math"="dynamic,dynamic" {
 ; CHECK-LABEL: define noundef nofpclass(nan ninf sub norm) float @ret_canonicalize_dynamic_constant_pos_inf
 ; CHECK-SAME: () #[[ATTR2]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan ninf sub norm) float @llvm.canonicalize.f32(float noundef 0x7FF0000000000000) #[[ATTR12]]
+; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan ninf sub norm) float @llvm.canonicalize.f32(float noundef pinf) #[[ATTR12]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.canonicalize.f32(float 0x7FF0000000000000)
@@ -476,7 +476,7 @@ define float @ret_canonicalize_dynamic_constant_pos_inf() "denormal-fp-math"="dy
 define float @ret_canonicalize_dynamic_constant_neg_inf() "denormal-fp-math"="dynamic,dynamic" {
 ; CHECK-LABEL: define noundef nofpclass(nan pinf sub norm) float @ret_canonicalize_dynamic_constant_neg_inf
 ; CHECK-SAME: () #[[ATTR2]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan pinf sub norm) float @llvm.canonicalize.f32(float noundef 0xFFF0000000000000) #[[ATTR12]]
+; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(nan pinf sub norm) float @llvm.canonicalize.f32(float noundef ninf) #[[ATTR12]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.canonicalize.f32(float 0xFFF0000000000000)
@@ -486,7 +486,7 @@ define float @ret_canonicalize_dynamic_constant_neg_inf() "denormal-fp-math"="dy
 define float @ret_canonicalize_dynamic_constant_qnan() "denormal-fp-math"="dynamic,dynamic" {
 ; CHECK-LABEL: define noundef nofpclass(snan inf sub norm) float @ret_canonicalize_dynamic_constant_qnan
 ; CHECK-SAME: () #[[ATTR2]] {
-; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(snan inf sub norm) float @llvm.canonicalize.f32(float noundef 0x7FF8000000000000) #[[ATTR12]]
+; CHECK-NEXT:    [[CALL:%.*]] = call noundef nofpclass(snan inf sub norm) float @llvm.canonicalize.f32(float noundef nan) #[[ATTR12]]
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
   %call = call float @llvm.canonicalize.f32(float 0x7FF8000000000000)
diff --git a/llvm/test/Transforms/Attributor/nofpclass-implied-by-fcmp.ll b/llvm/test/Transforms/Attributor/nofpclass-implied-by-fcmp.ll
index e8cb4756c2101a..3ebab546bdacc8 100644
--- a/llvm/test/Transforms/Attributor/nofpclass-implied-by-fcmp.ll
+++ b/llvm/test/Transforms/Attributor/nofpclass-implied-by-fcmp.ll
@@ -2430,7 +2430,7 @@ define float @assume_oeq_smallest_normal_known_pos(float nofpclass(ninf nsub nno
 define float @assume_ole_pinf(float %arg) {
 ; CHECK-LABEL: define float @assume_ole_pinf(
 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
-; CHECK-NEXT:    [[FCMP:%.*]] = fcmp ole float [[ARG]], 0x7FF0000000000000
+; CHECK-NEXT:    [[FCMP:%.*]] = fcmp ole float [[ARG]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
 ; CHECK-NEXT:    ret float [[ARG]]
 ;
@@ -2442,7 +2442,7 @@ define float @assume_ole_pinf(float %arg) {
 define float @assume_ole_ninf(float %arg) {
 ; CHECK-LABEL: define float @assume_ole_ninf(
 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
-; CHECK-NEXT:    [[FCMP:%.*]] = fcmp ole float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[FCMP:%.*]] = fcmp ole float [[ARG]], ninf
 ; CHECK-NEXT:    call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
 ; CHECK-NEXT:    ret float [[ARG]]
 ;
@@ -2454,7 +2454,7 @@ define float @assume_ole_ninf(float %arg) {
 define float @assume_ugt_pinf(float %arg) {
 ; CHECK-LABEL: define float @assume_ugt_pinf(
 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
-; CHECK-NEXT:    [[FCMP:%.*]] = fcmp ugt float [[ARG]], 0x7FF0000000000000
+; CHECK-NEXT:    [[FCMP:%.*]] = fcmp ugt float [[ARG]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
 ; CHECK-NEXT:    ret float [[ARG]]
 ;
@@ -2466,7 +2466,7 @@ define float @assume_ugt_pinf(float %arg) {
 define float @assume_ugt_ninf(float %arg) {
 ; CHECK-LABEL: define float @assume_ugt_ninf(
 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
-; CHECK-NEXT:    [[FCMP:%.*]] = fcmp ugt float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[FCMP:%.*]] = fcmp ugt float [[ARG]], ninf
 ; CHECK-NEXT:    call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
 ; CHECK-NEXT:    ret float [[ARG]]
 ;
@@ -2479,7 +2479,7 @@ define float @assume_fabs_ole_pinf(float %arg) {
 ; CHECK-LABEL: define float @assume_fabs_ole_pinf(
 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
 ; CHECK-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
-; CHECK-NEXT:    [[FCMP:%.*]] = fcmp ole float [[FABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[FCMP:%.*]] = fcmp ole float [[FABS]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
 ; CHECK-NEXT:    ret float [[ARG]]
 ;
@@ -2505,7 +2505,7 @@ define float @assume_fabs_ugt_pinf(float %arg) {
 ; CHECK-LABEL: define float @assume_fabs_ugt_pinf(
 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
 ; CHECK-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
-; CHECK-NEXT:    [[FCMP:%.*]] = fcmp ugt float [[FABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[FCMP:%.*]] = fcmp ugt float [[FABS]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
 ; CHECK-NEXT:    ret float [[ARG]]
 ;
diff --git a/llvm/test/Transforms/Attributor/nofpclass-nan-fmul.ll b/llvm/test/Transforms/Attributor/nofpclass-nan-fmul.ll
index fbf6c2e0981fb1..9c08e628e6d9e3 100644
--- a/llvm/test/Transforms/Attributor/nofpclass-nan-fmul.ll
+++ b/llvm/test/Transforms/Attributor/nofpclass-nan-fmul.ll
@@ -197,7 +197,7 @@ define float @ret_fmul_square_nnan_nzero(float nofpclass(nan zero) %arg) #0 {
 define float @ret_fmul_ieee_inf(float %arg) {
 ; CHECK-LABEL: define float @ret_fmul_ieee_inf
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR4:[0-9]+]] {
-; CHECK-NEXT:    [[FMUL:%.*]] = fmul float [[ARG]], 0x7FF0000000000000
+; CHECK-NEXT:    [[FMUL:%.*]] = fmul float [[ARG]], pinf
 ; CHECK-NEXT:    ret float [[FMUL]]
 ;
   %fmul = fmul float %arg, 0x7FF0000000000000
diff --git a/llvm/test/Transforms/Attributor/nofpclass-select.ll b/llvm/test/Transforms/Attributor/nofpclass-select.ll
index 3a8847590ce798..6cff144f6925d6 100644
--- a/llvm/test/Transforms/Attributor/nofpclass-select.ll
+++ b/llvm/test/Transforms/Attributor/nofpclass-select.ll
@@ -92,7 +92,7 @@ define float @ret_select_clamp_onlynans(float %arg) {
 ; CHECK-LABEL: define nofpclass(inf zero sub norm) float @ret_select_clamp_onlynans
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
 ; CHECK-NEXT:    [[NOT_NAN:%.*]] = fcmp ord float [[ARG]], 0.000000e+00
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[NOT_NAN]], float 0x7FF8000000000000, float [[ARG]]
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[NOT_NAN]], float nan, float [[ARG]]
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
   %not.nan = fcmp ord float %arg, 0.0
@@ -104,7 +104,7 @@ define float @clamp_nonfinite_to_normal_olt(float %arg) {
 ; CHECK-LABEL: define nofpclass(nan inf) float @clamp_nonfinite_to_normal_olt
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
 ; CHECK-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR2]]
-; CHECK-NEXT:    [[IS_FINITE:%.*]] = fcmp olt float [[FABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[IS_FINITE:%.*]] = fcmp olt float [[FABS]], pinf
 ; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_FINITE]], float [[ARG]], float 1.024000e+03
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
@@ -118,7 +118,7 @@ define float @clamp_eq_inf_to_pnormal(float %arg) {
 ; CHECK-LABEL: define nofpclass(inf) float @clamp_eq_inf_to_pnormal
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
 ; CHECK-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR2]]
-; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[FABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[FABS]], pinf
 ; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_INF]], float 1.024000e+03, float [[ARG]]
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
@@ -131,7 +131,7 @@ define float @clamp_eq_inf_to_pnormal(float %arg) {
 define float @clamp_eq_pinf_to_pnormal(float %arg) {
 ; CHECK-LABEL: define nofpclass(pinf) float @clamp_eq_pinf_to_pnormal
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[ARG]], 0x7FF0000000000000
+; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[ARG]], pinf
 ; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_INF]], float 1.024000e+03, float [[ARG]]
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
@@ -143,7 +143,7 @@ define float @clamp_eq_pinf_to_pnormal(float %arg) {
 define float @clamp_eq_ninf_to_negnormal(float %arg) {
 ; CHECK-LABEL: define nofpclass(ninf) float @clamp_eq_ninf_to_negnormal
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
-; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[ARG]], ninf
 ; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_INF]], float -1.024000e+03, float [[ARG]]
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
@@ -156,8 +156,8 @@ define float @clamp_eq_inf_to_nan(float %arg) {
 ; CHECK-LABEL: define nofpclass(inf) float @clamp_eq_inf_to_nan
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
 ; CHECK-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR2]]
-; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[FABS]], 0x7FF0000000000000
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_INF]], float 0x7FF8000000000000, float [[ARG]]
+; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[FABS]], pinf
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_INF]], float nan, float [[ARG]]
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
   %fabs = call float @llvm.fabs.f32(float %arg)
@@ -182,7 +182,7 @@ define float @isfinite_select_fabs_val_0(float %arg) {
 ; CHECK-LABEL: define nofpclass(nan inf nzero nsub nnorm) float @isfinite_select_fabs_val_0
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
 ; CHECK-NEXT:    [[FABS:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.fabs.f32(float [[ARG]]) #[[ATTR2]]
-; CHECK-NEXT:    [[IS_FINITE:%.*]] = fcmp olt float [[FABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[IS_FINITE:%.*]] = fcmp olt float [[FABS]], pinf
 ; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_FINITE]], float [[FABS]], float 1.024000e+03
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
@@ -268,7 +268,7 @@ define float @clamp_inf_to_fabs(float %arg) {
 ; CHECK-LABEL: define float @clamp_inf_to_fabs
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
 ; CHECK-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR2]]
-; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[FABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[FABS]], pinf
 ; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_INF]], float [[FABS]], float [[ARG]]
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
@@ -282,7 +282,7 @@ define float @not_clamp_inf_to_fabs(float %arg) {
 ; CHECK-LABEL: define float @not_clamp_inf_to_fabs
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
 ; CHECK-NEXT:    [[FABS:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.fabs.f32(float [[ARG]]) #[[ATTR2]]
-; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[FABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[FABS]], pinf
 ; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_INF]], float [[ARG]], float [[FABS]]
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
@@ -296,7 +296,7 @@ define float @clamp_zero_to_inf(float %arg) {
 ; CHECK-LABEL: define nofpclass(zero) float @clamp_zero_to_inf
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
 ; CHECK-NEXT:    [[IS_ZERO:%.*]] = fcmp oeq float [[ARG]], 0.000000e+00
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_ZERO]], float 0x7FF0000000000000, float [[ARG]]
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_ZERO]], float pinf, float [[ARG]]
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
   %is.zero = fcmp oeq float %arg, 0.0
@@ -308,7 +308,7 @@ define float @clamp_zero_to_only_inf(float %arg) {
 ; CHECK-LABEL: define nofpclass(nan ninf sub norm) float @clamp_zero_to_only_inf
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
 ; CHECK-NEXT:    [[IS_ZERO:%.*]] = fcmp oeq float [[ARG]], 0.000000e+00
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_ZERO]], float [[ARG]], float 0x7FF0000000000000
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_ZERO]], float [[ARG]], float pinf
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
   %is.zero = fcmp oeq float %arg, 0.0
@@ -320,7 +320,7 @@ define float @clamp_is_class_subnormal_or_inf_to_nan(float %arg) {
 ; CHECK-LABEL: define nofpclass(inf sub) float @clamp_is_class_subnormal_or_inf_to_nan
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
 ; CHECK-NEXT:    [[IS_SUBNORMAL_OR_INF:%.*]] = call i1 @llvm.is.fpclass.f32(float [[ARG]], i32 noundef 660) #[[ATTR2]]
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_SUBNORMAL_OR_INF]], float 0x7FF8000000000000, float [[ARG]]
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[IS_SUBNORMAL_OR_INF]], float nan, float [[ARG]]
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
   %is.subnormal.or.inf = call i1 @llvm.is.fpclass.f32(float %arg, i32 660)
@@ -332,7 +332,7 @@ define float @clamp_is_class_subnormal_or_inf_to_nan_swap(float %arg) {
 ; CHECK-LABEL: define nofpclass(inf sub) float @clamp_is_class_subnormal_or_inf_to_nan_swap
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR1]] {
 ; CHECK-NEXT:    [[NOT_IS_SUBNORMAL_OR_INF:%.*]] = call i1 @llvm.is.fpclass.f32(float [[ARG]], i32 noundef 363) #[[ATTR2]]
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[NOT_IS_SUBNORMAL_OR_INF]], float [[ARG]], float 0x7FF8000000000000
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[NOT_IS_SUBNORMAL_OR_INF]], float [[ARG]], float nan
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
   %not.is.subnormal.or.inf = call i1 @llvm.is.fpclass.f32(float %arg, i32 363)
diff --git a/llvm/test/Transforms/Attributor/nofpclass.ll b/llvm/test/Transforms/Attributor/nofpclass.ll
index 781ba636c3ab3c..341828a3e0efea 100644
--- a/llvm/test/Transforms/Attributor/nofpclass.ll
+++ b/llvm/test/Transforms/Attributor/nofpclass.ll
@@ -78,7 +78,7 @@ define double @returned_snan() {
 define double @returned_qnan() {
 ; CHECK-LABEL: define noundef nofpclass(snan inf zero sub norm) double @returned_qnan() {
 ; CHECK-NEXT:    call void @unknown()
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   call void @unknown()
   ret double 0x7FF8000000000000
@@ -135,7 +135,7 @@ define <3 x double> @returned_poison_constant_vector_elt() {
 define <2 x double> @returned_qnan_zero_vector() {
 ; CHECK-LABEL: define noundef nofpclass(snan inf nzero sub norm) <2 x double> @returned_qnan_zero_vector() {
 ; CHECK-NEXT:    call void @unknown()
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0.000000e+00>
+; CHECK-NEXT:    ret <2 x double> <double nan, double 0.000000e+00>
 ;
   call void @unknown()
   ret <2 x double> <double 0x7FF8000000000000, double 0.0>
@@ -533,7 +533,7 @@ define half @fcmp_assume_not_inf_after_call(half %arg) {
 ; CHECK-SAME: (half returned [[ARG:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    call void @extern.use.f16(half [[ARG]])
-; CHECK-NEXT:    [[NOT_INF:%.*]] = fcmp oeq half [[ARG]], 0xH7C00
+; CHECK-NEXT:    [[NOT_INF:%.*]] = fcmp oeq half [[ARG]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 noundef [[NOT_INF]])
 ; CHECK-NEXT:    ret half [[ARG]]
 ;
@@ -552,7 +552,7 @@ define half @fcmp_assume2_callsite_arg_return(half %arg) {
 ; CHECK-NEXT:    [[FABS:%.*]] = call nofpclass(ninf nzero nsub nnorm) half @llvm.fabs.f16(half [[ARG]]) #[[ATTR20]]
 ; CHECK-NEXT:    [[NOT_SUBNORMAL_OR_ZERO:%.*]] = fcmp oge half [[FABS]], 0xH0400
 ; CHECK-NEXT:    call void @llvm.assume(i1 noundef [[NOT_SUBNORMAL_OR_ZERO]]) #[[ATTR18]]
-; CHECK-NEXT:    [[NOT_INF:%.*]] = fcmp one half [[ARG]], 0xH7C00
+; CHECK-NEXT:    [[NOT_INF:%.*]] = fcmp one half [[ARG]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 noundef [[NOT_INF]]) #[[ATTR18]]
 ; CHECK-NEXT:    call void @extern.use.f16(half [[ARG]])
 ; CHECK-NEXT:    ret half [[ARG]]
@@ -1525,7 +1525,7 @@ define <4 x float> @insertelement_constant_chain() {
 ; CHECK-NEXT:    [[INS_0:%.*]] = insertelement <4 x float> poison, float 1.000000e+00, i32 0
 ; CHECK-NEXT:    [[INS_1:%.*]] = insertelement <4 x float> [[INS_0]], float 0.000000e+00, i32 1
 ; CHECK-NEXT:    [[INS_2:%.*]] = insertelement <4 x float> [[INS_1]], float -9.000000e+00, i32 2
-; CHECK-NEXT:    [[INS_3:%.*]] = insertelement <4 x float> [[INS_2]], float 0x7FF0000000000000, i32 3
+; CHECK-NEXT:    [[INS_3:%.*]] = insertelement <4 x float> [[INS_2]], float pinf, i32 3
 ; CHECK-NEXT:    ret <4 x float> [[INS_3]]
 ;
   %ins.0 = insertelement <4 x float> poison, float 1.0, i32 0
@@ -1561,7 +1561,7 @@ define <vscale x 4 x float> @insertelement_scalable_constant_chain() {
 ; CHECK-NEXT:    [[INS_0:%.*]] = insertelement <vscale x 4 x float> poison, float 1.000000e+00, i32 0
 ; CHECK-NEXT:    [[INS_1:%.*]] = insertelement <vscale x 4 x float> [[INS_0]], float 0.000000e+00, i32 1
 ; CHECK-NEXT:    [[INS_2:%.*]] = insertelement <vscale x 4 x float> [[INS_1]], float -9.000000e+00, i32 2
-; CHECK-NEXT:    [[INS_3:%.*]] = insertelement <vscale x 4 x float> [[INS_2]], float 0x7FF0000000000000, i32 3
+; CHECK-NEXT:    [[INS_3:%.*]] = insertelement <vscale x 4 x float> [[INS_2]], float pinf, i32 3
 ; CHECK-NEXT:    ret <vscale x 4 x float> [[INS_3]]
 ;
   %ins.0 = insertelement <vscale x 4 x float> poison, float 1.0, i32 0
@@ -1625,7 +1625,7 @@ define <4 x float> @insertelement_index_oob_chain() {
 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
 ; CHECK-LABEL: define nofpclass(nan ninf nzero sub norm) <4 x float> @insertelement_index_oob_chain
 ; CHECK-SAME: () #[[ATTR3]] {
-; CHECK-NEXT:    [[INSERT:%.*]] = insertelement <4 x float> zeroinitializer, float 0x7FF0000000000000, i32 4
+; CHECK-NEXT:    [[INSERT:%.*]] = insertelement <4 x float> zeroinitializer, float pinf, i32 4
 ; CHECK-NEXT:    ret <4 x float> [[INSERT]]
 ;
   %insert = insertelement <4 x float> zeroinitializer, float 0x7FF0000000000000, i32 4
@@ -1816,7 +1816,7 @@ define float @shufflevector_constantdatavector_demanded0() {
 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
 ; CHECK-LABEL: define nofpclass(nan inf zero sub nnorm) float @shufflevector_constantdatavector_demanded0
 ; CHECK-SAME: () #[[ATTR3]] {
-; CHECK-NEXT:    [[SHUFFLE:%.*]] = shufflevector <3 x float> <float 1.000000e+00, float 0x7FF8000000000000, float 0.000000e+00>, <3 x float> poison, <2 x i32> <i32 0, i32 2>
+; CHECK-NEXT:    [[SHUFFLE:%.*]] = shufflevector <3 x float> <float 1.000000e+00, float nan, float 0.000000e+00>, <3 x float> poison, <2 x i32> <i32 0, i32 2>
 ; CHECK-NEXT:    [[EXTRACT:%.*]] = extractelement <2 x float> [[SHUFFLE]], i32 0
 ; CHECK-NEXT:    ret float [[EXTRACT]]
 ;
@@ -1829,7 +1829,7 @@ define float @shufflevector_constantdatavector_demanded1() {
 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
 ; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) float @shufflevector_constantdatavector_demanded1
 ; CHECK-SAME: () #[[ATTR3]] {
-; CHECK-NEXT:    [[SHUFFLE:%.*]] = shufflevector <3 x float> <float 1.000000e+00, float 0x7FF8000000000000, float 0.000000e+00>, <3 x float> poison, <2 x i32> <i32 0, i32 2>
+; CHECK-NEXT:    [[SHUFFLE:%.*]] = shufflevector <3 x float> <float 1.000000e+00, float nan, float 0.000000e+00>, <3 x float> poison, <2 x i32> <i32 0, i32 2>
 ; CHECK-NEXT:    [[EXTRACT:%.*]] = extractelement <2 x float> [[SHUFFLE]], i32 1
 ; CHECK-NEXT:    ret float [[EXTRACT]]
 ;
@@ -2685,6 +2685,20 @@ define <vscale x 4 x float> @scalable_splat_zero() {
 ; See https://github.com/llvm/llvm-project/issues/78507
 
 define double @call_abs(double noundef %__x) {
+; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; TUNIT-LABEL: define noundef nofpclass(ninf nzero nsub nnorm) double @call_abs
+; TUNIT-SAME: (double noundef [[__X:%.*]]) #[[ATTR3]] {
+; TUNIT-NEXT:  entry:
+; TUNIT-NEXT:    [[ABS:%.*]] = tail call noundef nofpclass(ninf nzero nsub nnorm) double @llvm.fabs.f64(double noundef [[__X]]) #[[ATTR22]]
+; TUNIT-NEXT:    ret double [[ABS]]
+;
+; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; CGSCC-LABEL: define noundef nofpclass(ninf nzero nsub nnorm) double @call_abs
+; CGSCC-SAME: (double noundef [[__X:%.*]]) #[[ATTR3]] {
+; CGSCC-NEXT:  entry:
+; CGSCC-NEXT:    [[ABS:%.*]] = tail call noundef nofpclass(ninf nzero nsub nnorm) double @llvm.fabs.f64(double noundef [[__X]]) #[[ATTR19]]
+; CGSCC-NEXT:    ret double [[ABS]]
+;
 entry:
   %abs = tail call double @llvm.fabs.f64(double %__x)
   ret double %abs
diff --git a/llvm/test/Transforms/DCE/calls-errno.ll b/llvm/test/Transforms/DCE/calls-errno.ll
index 6b73c6ede19409..cef5832732310b 100644
--- a/llvm/test/Transforms/DCE/calls-errno.ll
+++ b/llvm/test/Transforms/DCE/calls-errno.ll
@@ -49,9 +49,9 @@ define void @T() {
 ; CHECK-NEXT:    [[LOG1:%.*]] = call double @log(double 0.000000e+00)
 ; CHECK-NEXT:    [[LOG2:%.*]] = call double @log(double -1.000000e+00)
 ; CHECK-NEXT:    [[EXP2:%.*]] = call double @exp(double 1.000000e+03)
-; CHECK-NEXT:    [[COS2:%.*]] = call double @cos(double 0x7FF0000000000000)
-; CHECK-NEXT:    [[COS3:%.*]] = call double @cos(double 0.000000e+00) [[ATTR2:#.*]]
-; CHECK-NEXT:    [[FMOD2:%.*]] = call double @fmod(double 0x7FF0000000000000, double 1.000000e+00)
+; CHECK-NEXT:    [[COS2:%.*]] = call double @cos(double pinf)
+; CHECK-NEXT:    [[COS3:%.*]] = call double @cos(double 0.000000e+00) #[[ATTR2:[0-9]+]]
+; CHECK-NEXT:    [[FMOD2:%.*]] = call double @fmod(double pinf, double 1.000000e+00)
 ; CHECK-NEXT:    ret void
 ;
 entry:
@@ -99,7 +99,7 @@ entry:
 define void @Tstrict() strictfp {
 ; CHECK-LABEL: @Tstrict(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[COS4:%.*]] = call double @cos(double 1.000000e+00) [[ATTR1:#.*]]
+; CHECK-NEXT:    [[COS4:%.*]] = call double @cos(double 1.000000e+00) #[[ATTR1:[0-9]+]]
 ; CHECK-NEXT:    ret void
 ;
 entry:
diff --git a/llvm/test/Transforms/EarlyCSE/atan.ll b/llvm/test/Transforms/EarlyCSE/atan.ll
index 2b7206c0a6aab6..74a88b2ae940b4 100644
--- a/llvm/test/Transforms/EarlyCSE/atan.ll
+++ b/llvm/test/Transforms/EarlyCSE/atan.ll
@@ -14,20 +14,20 @@ define float @callatan0() {
 ; TODO: constant should be folded
 define float @callatanInf() {
 ; CHECK-LABEL: @callatanInf(
-; CHECK-NEXT:    [[CALL:%.*]] = call float @atanf(float 0x7FF0000000000000)
+; CHECK-NEXT:    [[CALL:%.*]] = call float @atanf(float pinf)
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
-  %call = call float @atanf(float 0x7FF0000000000000)
+  %call = call float @atanf(float pinf)
   ret float %call
 }
 
 ; TODO: constant should be folded
 define float @callatanNaN() {
 ; CHECK-LABEL: @callatanNaN(
-; CHECK-NEXT:    [[CALL:%.*]] = call float @atanf(float 0x7FF8000000000000)
+; CHECK-NEXT:    [[CALL:%.*]] = call float @atanf(float nan)
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
-  %call = call float @atanf(float 0x7FF8000000000000)
+  %call = call float @atanf(float nan)
   ret float %call
 }
 
@@ -136,9 +136,9 @@ define float @callatan2_flush_to_zero() {
 
 define float @callatan2_NaN() {
 ; CHECK-LABEL: @callatan2_NaN(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
-  %call = call float @atan2f(float 0x7FF8000000000000, float 0x7FF8000000000000)
+  %call = call float @atan2f(float nan, float nan)
   ret float %call
 }
 
@@ -146,7 +146,7 @@ define float @callatan2_Inf() {
 ; CHECK-LABEL: @callatan2_Inf(
 ; CHECK-NEXT:    ret float 0x3FE921FB60000000
 ;
-  %call = call float @atan2f(float 0x7FF0000000000000, float 0x7FF0000000000000)
+  %call = call float @atan2f(float pinf, float pinf)
   ret float %call
 }
 
diff --git a/llvm/test/Transforms/GVNHoist/hoist-call.ll b/llvm/test/Transforms/GVNHoist/hoist-call.ll
index 7c1fe26a827ccf..3f362a0b2ac244 100644
--- a/llvm/test/Transforms/GVNHoist/hoist-call.ll
+++ b/llvm/test/Transforms/GVNHoist/hoist-call.ll
@@ -8,7 +8,7 @@ define void @fun(float %__b) minsize {
 ; CHECK-NEXT:    br label [[IF_THEN:%.*]]
 ; CHECK:       if.then:
 ; CHECK-NEXT:    [[TMP0:%.*]] = call float @llvm.fabs.f32(float [[__B:%.*]])
-; CHECK-NEXT:    [[CMPINF7:%.*]] = fcmp oeq float [[TMP0]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMPINF7:%.*]] = fcmp oeq float [[TMP0]], pinf
 ; CHECK-NEXT:    br i1 undef, label [[IF_THEN8:%.*]], label [[LOR_LHS_FALSE:%.*]]
 ; CHECK:       lor.lhs.false:
 ; CHECK-NEXT:    unreachable
@@ -41,7 +41,7 @@ define i32 @foo(i32 %x) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[X:%.*]], 1
 ; CHECK-NEXT:    [[TMP0:%.*]] = callbr { i32, i32 } asm sideeffect "somestuff", "=r,=r,!i"()
-; CHECK-NEXT:    to label [[ASM_FALLTHROUGH:%.*]] [label %err.split]
+; CHECK-NEXT:            to label [[ASM_FALLTHROUGH:%.*]] [label %err.split]
 ; CHECK:       asm.fallthrough:
 ; CHECK-NEXT:    [[ASMRESULT:%.*]] = extractvalue { i32, i32 } [[TMP0]], 0
 ; CHECK-NEXT:    ret i32 [[ADD]]
@@ -69,7 +69,7 @@ define i32 @foo2() {
 ; CHECK-LABEL: @foo2(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = callbr { i32, i32 } asm sideeffect "somestuff", "=r,=r,!i"()
-; CHECK-NEXT:    to label [[ASM_FALLTHROUGH:%.*]] [label %err.split]
+; CHECK-NEXT:            to label [[ASM_FALLTHROUGH:%.*]] [label %err.split]
 ; CHECK:       asm.fallthrough:
 ; CHECK-NEXT:    [[ASMRESULT:%.*]] = extractvalue { i32, i32 } [[TMP0]], 0
 ; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[ASMRESULT]], 1
@@ -100,7 +100,7 @@ define i32 @foo3() {
 ; CHECK-LABEL: @foo3(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    callbr void asm "", "=*m,!i"(ptr elementtype(i32) @x)
-; CHECK-NEXT:    to label [[ASM_FALLTHROUGH:%.*]] [label %err.split]
+; CHECK-NEXT:            to label [[ASM_FALLTHROUGH:%.*]] [label %err.split]
 ; CHECK:       asm.fallthrough:
 ; CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr @x, align 4
 ; CHECK-NEXT:    ret i32 [[TMP0]]
@@ -129,7 +129,7 @@ define i32 @foo4() {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr @y, align 4
 ; CHECK-NEXT:    callbr void asm "", "=*m,!i"(ptr elementtype(i32) @x) #[[ATTR2:[0-9]+]]
-; CHECK-NEXT:    to label [[A:%.*]] [label %b]
+; CHECK-NEXT:            to label [[A:%.*]] [label %b]
 ; CHECK:       a:
 ; CHECK-NEXT:    ret i32 [[TMP0]]
 ; CHECK:       b:
@@ -154,7 +154,7 @@ define i32 @foo5() {
 ; CHECK-LABEL: @foo5(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    callbr void asm "", "=*m,!i"(ptr elementtype(i32) @x) #[[ATTR2]]
-; CHECK-NEXT:    to label [[A:%.*]] [label %b]
+; CHECK-NEXT:            to label [[A:%.*]] [label %b]
 ; CHECK:       a:
 ; CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr @x, align 4
 ; CHECK-NEXT:    ret i32 [[TMP0]]
@@ -182,7 +182,7 @@ define i32 @foo6() {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr @x, align 4
 ; CHECK-NEXT:    callbr void asm "", "=*m,!i"(ptr elementtype(i32) @x) #[[ATTR3:[0-9]+]]
-; CHECK-NEXT:    to label [[A:%.*]] [label %b]
+; CHECK-NEXT:            to label [[A:%.*]] [label %b]
 ; CHECK:       a:
 ; CHECK-NEXT:    ret i32 [[TMP0]]
 ; CHECK:       b:
diff --git a/llvm/test/Transforms/Inline/simplify-instruction-computeKnownFPClass-context.ll b/llvm/test/Transforms/Inline/simplify-instruction-computeKnownFPClass-context.ll
index fe6884c926be47..4fa41ccd2e945a 100644
--- a/llvm/test/Transforms/Inline/simplify-instruction-computeKnownFPClass-context.ll
+++ b/llvm/test/Transforms/Inline/simplify-instruction-computeKnownFPClass-context.ll
@@ -169,7 +169,7 @@ define i1 @simplify_fcmp_ord_ldexp_caller(double nofpclass(zero inf) %i0) {
 ; CHECK-LABEL: define i1 @simplify_fcmp_ord_ldexp_caller
 ; CHECK-SAME: (double nofpclass(inf zero) [[I0:%.*]]) {
 ; CHECK-NEXT:    [[LDEXP_I:%.*]] = call double @llvm.ldexp.f64.i32(double [[I0]], i32 42)
-; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp one double [[LDEXP_I]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp one double [[LDEXP_I]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP_I]]
 ;
   %call = call i1 @simplify_fcmp_ord_ldexp_callee(double %i0)
@@ -189,7 +189,7 @@ define i1 @simplify_fcmp_ord_frexp_caller(double nofpclass(zero inf) %i0) {
 ; CHECK-SAME: (double nofpclass(inf zero) [[I0:%.*]]) {
 ; CHECK-NEXT:    [[FREXP_I:%.*]] = call { double, i32 } @llvm.frexp.f64.i32(double [[I0]])
 ; CHECK-NEXT:    [[FREXP_0_I:%.*]] = extractvalue { double, i32 } [[FREXP_I]], 0
-; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp one double [[FREXP_0_I]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp one double [[FREXP_0_I]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP_I]]
 ;
   %call = call i1 @simplify_fcmp_ord_frexp_callee(double %i0)
diff --git a/llvm/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll b/llvm/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll
index 27005f38f29f11..a8a7c20d41caf1 100644
--- a/llvm/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll
+++ b/llvm/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll
@@ -9,7 +9,7 @@ define i32 @main() {
 ; CHECK-LABEL: @main(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[U:%.*]] = alloca [[STRUCT__1ANON:%.*]], align 8
-; CHECK-NEXT:    store double 0x7FF0000000000000, ptr [[U]], align 8
+; CHECK-NEXT:    store double pinf, ptr [[U]], align 8
 ; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[U]], i64 4
 ; CHECK-NEXT:    [[TMP6:%.*]] = load i32, ptr [[TMP5]], align 4
 ; CHECK-NEXT:    [[TMP0:%.*]] = and i32 [[TMP6]], 2146435072
diff --git a/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll b/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll
index 373b431cc3f0d6..d183bac5df02ea 100644
--- a/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll
+++ b/llvm/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -passes=simplifycfg,instcombine -simplifycfg-require-and-preserve-domtree=1 -S | grep 0x7FF8000000000000 | count 12
+; RUN: opt < %s -passes=simplifycfg,instcombine -simplifycfg-require-and-preserve-domtree=1 -S | grep nan | count 12
 ; RUN: opt < %s -passes=simplifycfg,instcombine -simplifycfg-require-and-preserve-domtree=1 -S | grep "0\.0" | count 3
 ; RUN: opt < %s -passes=simplifycfg,instcombine -simplifycfg-require-and-preserve-domtree=1 -S | grep "3\.5" | count 1
 ;
@@ -13,8 +13,8 @@ entry:
 	%y = alloca float		; <ptr> [#uses=2]
 	%x = alloca float		; <ptr> [#uses=2]
 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
-	store float 0x7FF0000000000000, ptr %x, align 4
-	store float 0x7FF8000000000000, ptr %y, align 4
+	store float pinf, ptr %x, align 4
+	store float nan, ptr %y, align 4
 	%0 = load float, ptr %y, align 4		; <float> [#uses=1]
 	%1 = fpext float %0 to double		; <double> [#uses=1]
 	%2 = load float, ptr %x, align 4		; <float> [#uses=1]
@@ -34,7 +34,7 @@ entry:
 	%y = alloca float		; <ptr> [#uses=2]
 	%x = alloca float		; <ptr> [#uses=2]
 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
-	store float 0x7FF0000000000000, ptr %x, align 4
+	store float pinf, ptr %x, align 4
 	store float 0.000000e+00, ptr %y, align 4
 	%0 = load float, ptr %y, align 4		; <float> [#uses=1]
 	%1 = fpext float %0 to double		; <double> [#uses=1]
@@ -53,7 +53,7 @@ entry:
 	%y = alloca float		; <ptr> [#uses=2]
 	%x = alloca float		; <ptr> [#uses=2]
 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
-	store float 0x7FF0000000000000, ptr %x, align 4
+	store float pinf, ptr %x, align 4
 	store float 3.500000e+00, ptr %y, align 4
 	%0 = load float, ptr %y, align 4		; <float> [#uses=1]
 	%1 = fpext float %0 to double		; <double> [#uses=1]
@@ -72,8 +72,8 @@ entry:
 	%y = alloca float		; <ptr> [#uses=2]
 	%x = alloca float		; <ptr> [#uses=2]
 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
-	store float 0x7FF0000000000000, ptr %x, align 4
-	store float 0x7FF0000000000000, ptr %y, align 4
+	store float pinf, ptr %x, align 4
+	store float pinf, ptr %y, align 4
 	%0 = load float, ptr %y, align 4		; <float> [#uses=1]
 	%1 = fpext float %0 to double		; <double> [#uses=1]
 	%2 = load float, ptr %x, align 4		; <float> [#uses=1]
@@ -91,8 +91,8 @@ entry:
 	%y = alloca float		; <ptr> [#uses=2]
 	%x = alloca float		; <ptr> [#uses=2]
 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
-	store float 0x7FF8000000000000, ptr %x, align 4
-	store float 0x7FF0000000000000, ptr %y, align 4
+	store float nan, ptr %x, align 4
+	store float pinf, ptr %y, align 4
 	%0 = load float, ptr %y, align 4		; <float> [#uses=1]
 	%1 = fpext float %0 to double		; <double> [#uses=1]
 	%2 = load float, ptr %x, align 4		; <float> [#uses=1]
@@ -110,7 +110,7 @@ entry:
 	%y = alloca float		; <ptr> [#uses=2]
 	%x = alloca float		; <ptr> [#uses=2]
 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
-	store float 0x7FF8000000000000, ptr %x, align 4
+	store float nan, ptr %x, align 4
 	store float 0.000000e+00, ptr %y, align 4
 	%0 = load float, ptr %y, align 4		; <float> [#uses=1]
 	%1 = fpext float %0 to double		; <double> [#uses=1]
@@ -129,7 +129,7 @@ entry:
 	%y = alloca float		; <ptr> [#uses=2]
 	%x = alloca float		; <ptr> [#uses=2]
 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
-	store float 0x7FF8000000000000, ptr %x, align 4
+	store float nan, ptr %x, align 4
 	store float 3.500000e+00, ptr %y, align 4
 	%0 = load float, ptr %y, align 4		; <float> [#uses=1]
 	%1 = fpext float %0 to double		; <double> [#uses=1]
@@ -148,8 +148,8 @@ entry:
 	%y = alloca float		; <ptr> [#uses=2]
 	%x = alloca float		; <ptr> [#uses=2]
 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
-	store float 0x7FF8000000000000, ptr %x, align 4
-	store float 0x7FF8000000000000, ptr %y, align 4
+	store float nan, ptr %x, align 4
+	store float nan, ptr %y, align 4
 	%0 = load float, ptr %y, align 4		; <float> [#uses=1]
 	%1 = fpext float %0 to double		; <double> [#uses=1]
 	%2 = load float, ptr %x, align 4		; <float> [#uses=1]
@@ -168,7 +168,7 @@ entry:
 	%x = alloca float		; <ptr> [#uses=2]
 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
 	store float 0.000000e+00, ptr %x, align 4
-	store float 0x7FF8000000000000, ptr %y, align 4
+	store float nan, ptr %y, align 4
 	%0 = load float, ptr %y, align 4		; <float> [#uses=1]
 	%1 = fpext float %0 to double		; <double> [#uses=1]
 	%2 = load float, ptr %x, align 4		; <float> [#uses=1]
@@ -187,7 +187,7 @@ entry:
 	%x = alloca float		; <ptr> [#uses=2]
 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
 	store float 0.000000e+00, ptr %x, align 4
-	store float 0x7FF0000000000000, ptr %y, align 4
+	store float pinf, ptr %y, align 4
 	%0 = load float, ptr %y, align 4		; <float> [#uses=1]
 	%1 = fpext float %0 to double		; <double> [#uses=1]
 	%2 = load float, ptr %x, align 4		; <float> [#uses=1]
@@ -244,7 +244,7 @@ entry:
 	%x = alloca float		; <ptr> [#uses=2]
 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
 	store float 3.500000e+00, ptr %x, align 4
-	store float 0x7FF8000000000000, ptr %y, align 4
+	store float nan, ptr %y, align 4
 	%0 = load float, ptr %y, align 4		; <float> [#uses=1]
 	%1 = fpext float %0 to double		; <double> [#uses=1]
 	%2 = load float, ptr %x, align 4		; <float> [#uses=1]
@@ -263,7 +263,7 @@ entry:
 	%x = alloca float		; <ptr> [#uses=2]
 	%"alloca point" = bitcast i32 0 to i32		; <i32> [#uses=0]
 	store float 3.500000e+00, ptr %x, align 4
-	store float 0x7FF0000000000000, ptr %y, align 4
+	store float pinf, ptr %y, align 4
 	%0 = load float, ptr %y, align 4		; <float> [#uses=1]
 	%1 = fpext float %0 to double		; <double> [#uses=1]
 	%2 = load float, ptr %x, align 4		; <float> [#uses=1]
diff --git a/llvm/test/Transforms/InstCombine/and-fcmp.ll b/llvm/test/Transforms/InstCombine/and-fcmp.ll
index c163802fcc935c..f93d87bc27b935 100644
--- a/llvm/test/Transforms/InstCombine/and-fcmp.ll
+++ b/llvm/test/Transforms/InstCombine/and-fcmp.ll
@@ -4631,7 +4631,7 @@ define i1 @intersect_fmf_4(double %a, double %b) {
 define i1 @clang_builtin_isnormal_inf_check(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4644,7 +4644,7 @@ define i1 @clang_builtin_isnormal_inf_check(half %x) {
 define <2 x i1> @clang_builtin_isnormal_inf_check_vector(<2 x half> %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_vector(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call <2 x half> @llvm.fabs.v2f16(<2 x half> [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq <2 x half> [[FABS_X]], <half 0xH7C00, half 0xH7C00>
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq <2 x half> [[FABS_X]], <half pinf, half pinf>
 ; CHECK-NEXT:    ret <2 x i1> [[AND]]
 ;
   %fabs.x = call <2 x half> @llvm.fabs.v2f16(<2 x half> %x)
@@ -4657,7 +4657,7 @@ define <2 x i1> @clang_builtin_isnormal_inf_check_vector(<2 x half> %x) {
 define i1 @clang_builtin_isnormal_inf_check_commute(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_commute(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4670,7 +4670,7 @@ define i1 @clang_builtin_isnormal_inf_check_commute(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_commute_nsz_rhs(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_commute_nsz_rhs(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4683,7 +4683,7 @@ define i1 @clang_builtin_isnormal_inf_check_commute_nsz_rhs(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_commute_nsz_lhs(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_commute_nsz_lhs(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4695,7 +4695,7 @@ define i1 @clang_builtin_isnormal_inf_check_commute_nsz_lhs(half %x) {
 
 define i1 @clang_builtin_isnormal_inf_check_commute_nofabs_ueq(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_commute_nofabs_ueq(
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %ord = fcmp ord half %x, 0.0
@@ -4707,7 +4707,7 @@ define i1 @clang_builtin_isnormal_inf_check_commute_nofabs_ueq(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_commute_nsz(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_commute_nsz(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp nsz oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp nsz oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4733,7 +4733,7 @@ define i1 @clang_builtin_isnormal_inf_check_ugt(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_ult(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_ult(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp one half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp one half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4760,7 +4760,7 @@ define i1 @clang_builtin_isnormal_inf_check_ule(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_ueq(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_ueq(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4774,7 +4774,7 @@ define i1 @clang_builtin_isnormal_inf_check_ueq(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_une(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_une(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp one half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp one half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4812,7 +4812,7 @@ define i1 @clang_builtin_isnormal_inf_check_ord(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_oge(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_oge(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4825,7 +4825,7 @@ define i1 @clang_builtin_isnormal_inf_check_oge(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_olt(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_olt(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp one half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp one half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4850,7 +4850,7 @@ define i1 @clang_builtin_isnormal_inf_check_ole(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_oeq(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_oeq(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4863,7 +4863,7 @@ define i1 @clang_builtin_isnormal_inf_check_oeq(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_unnececcary_fabs(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_unnececcary_fabs(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4888,7 +4888,7 @@ define i1 @clang_builtin_isnormal_inf_check_not_ord(half %x) {
 
 define i1 @clang_builtin_isnormal_inf_check_missing_fabs(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_missing_fabs(
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4929,7 +4929,7 @@ define i1 @clang_builtin_isnormal_inf_check_not_inf(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_nsz_lhs(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_nsz_lhs(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4942,7 +4942,7 @@ define i1 @clang_builtin_isnormal_inf_check_nsz_lhs(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_nsz_rhs(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_nsz_rhs(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4955,7 +4955,7 @@ define i1 @clang_builtin_isnormal_inf_check_nsz_rhs(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_nsz(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_nsz(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp nsz oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp nsz oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -4967,7 +4967,7 @@ define i1 @clang_builtin_isnormal_inf_check_nsz(half %x) {
 
 define i1 @clang_builtin_isnormal_inf_check_fneg(half %x) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_fneg(
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fneg.x = fneg half %x
@@ -4980,7 +4980,7 @@ define i1 @clang_builtin_isnormal_inf_check_fneg(half %x) {
 define i1 @clang_builtin_isnormal_inf_check_copysign(half %x, half %y) {
 ; CHECK-LABEL: @clang_builtin_isnormal_inf_check_copysign(
 ; CHECK-NEXT:    [[COPYSIGN_X:%.*]] = call half @llvm.copysign.f16(half [[X:%.*]], half [[Y:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[COPYSIGN_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[COPYSIGN_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %copysign.x = call half @llvm.copysign.f16(half %x, half %y)
@@ -4993,7 +4993,7 @@ define i1 @clang_builtin_isnormal_inf_check_copysign(half %x, half %y) {
 define i1 @isnormal_logical_select_0(half %x) {
 ; CHECK-LABEL: @isnormal_logical_select_0(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -5006,7 +5006,7 @@ define i1 @isnormal_logical_select_0(half %x) {
 define i1 @isnormal_logical_select_1(half %x) {
 ; CHECK-LABEL: @isnormal_logical_select_1(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -5019,7 +5019,7 @@ define i1 @isnormal_logical_select_1(half %x) {
 define i1 @isnormal_logical_select_0_fmf0(half %x) {
 ; CHECK-LABEL: @isnormal_logical_select_0_fmf0(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp reassoc nsz arcp oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp reassoc nsz arcp oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
@@ -5032,7 +5032,7 @@ define i1 @isnormal_logical_select_0_fmf0(half %x) {
 define i1 @isnormal_logical_select_0_fmf1(half %x) {
 ; CHECK-LABEL: @isnormal_logical_select_0_fmf1(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS_X]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs.x = call half @llvm.fabs.f16(half %x)
diff --git a/llvm/test/Transforms/InstCombine/atomicrmw.ll b/llvm/test/Transforms/InstCombine/atomicrmw.ll
index 763b234698cc5f..579e49daba309c 100644
--- a/llvm/test/Transforms/InstCombine/atomicrmw.ll
+++ b/llvm/test/Transforms/InstCombine/atomicrmw.ll
@@ -363,7 +363,7 @@ define i32 @undef_operand_used(ptr %addr) {
 
 define double @sat_fmax_inf(ptr %addr) {
 ; CHECK-LABEL: @sat_fmax_inf(
-; CHECK-NEXT:    [[RES:%.*]] = atomicrmw xchg ptr [[ADDR:%.*]], double 0x7FF0000000000000 monotonic, align 8
+; CHECK-NEXT:    [[RES:%.*]] = atomicrmw xchg ptr [[ADDR:%.*]], double pinf monotonic, align 8
 ; CHECK-NEXT:    ret double [[RES]]
 ;
   %res = atomicrmw fmax ptr %addr, double 0x7FF0000000000000 monotonic
@@ -381,7 +381,7 @@ define double @no_sat_fmax_inf(ptr %addr) {
 
 define double @sat_fmin_inf(ptr %addr) {
 ; CHECK-LABEL: @sat_fmin_inf(
-; CHECK-NEXT:    [[RES:%.*]] = atomicrmw xchg ptr [[ADDR:%.*]], double 0xFFF0000000000000 monotonic, align 8
+; CHECK-NEXT:    [[RES:%.*]] = atomicrmw xchg ptr [[ADDR:%.*]], double ninf monotonic, align 8
 ; CHECK-NEXT:    ret double [[RES]]
 ;
   %res = atomicrmw fmin ptr %addr, double 0xFFF0000000000000 monotonic
@@ -754,7 +754,7 @@ define i32 @undef_operand_used_preserve_md(ptr %addr) {
 
 define double @sat_fmax_inf_preserve_md(ptr %addr) {
 ; CHECK-LABEL: @sat_fmax_inf_preserve_md(
-; CHECK-NEXT:    [[RES:%.*]] = atomicrmw xchg ptr [[ADDR:%.*]], double 0x7FF0000000000000 syncscope("agent") monotonic, align 8, !mmra [[META0]], !amdgpu.no.fine.grained.host.memory [[META1]], !amdgpu.no.remote.memory.access [[META1]]
+; CHECK-NEXT:    [[RES:%.*]] = atomicrmw xchg ptr [[ADDR:%.*]], double pinf syncscope("agent") monotonic, align 8, !mmra [[META0]], !amdgpu.no.fine.grained.host.memory [[META1]], !amdgpu.no.remote.memory.access [[META1]]
 ; CHECK-NEXT:    ret double [[RES]]
 ;
   %res = atomicrmw fmax ptr %addr, double 0x7FF0000000000000 syncscope("agent") monotonic, !amdgpu.no.fine.grained.host.memory !0, !amdgpu.no.remote.memory.access !0, !mmra !1
@@ -772,7 +772,7 @@ define double @no_sat_fmax_inf_preserve_md(ptr %addr) {
 
 define double @sat_fmin_inf_preserve_md(ptr %addr) {
 ; CHECK-LABEL: @sat_fmin_inf_preserve_md(
-; CHECK-NEXT:    [[RES:%.*]] = atomicrmw xchg ptr [[ADDR:%.*]], double 0xFFF0000000000000 syncscope("agent") monotonic, align 8, !mmra [[META0]], !amdgpu.no.fine.grained.host.memory [[META1]], !amdgpu.no.remote.memory.access [[META1]]
+; CHECK-NEXT:    [[RES:%.*]] = atomicrmw xchg ptr [[ADDR:%.*]], double ninf syncscope("agent") monotonic, align 8, !mmra [[META0]], !amdgpu.no.fine.grained.host.memory [[META1]], !amdgpu.no.remote.memory.access [[META1]]
 ; CHECK-NEXT:    ret double [[RES]]
 ;
   %res = atomicrmw fmin ptr %addr, double 0xFFF0000000000000 syncscope("agent") monotonic, !amdgpu.no.fine.grained.host.memory !0, !amdgpu.no.remote.memory.access !0, !mmra !1
diff --git a/llvm/test/Transforms/InstCombine/binop-select.ll b/llvm/test/Transforms/InstCombine/binop-select.ll
index 6cd4132eadd77b..cd941df207dbfa 100644
--- a/llvm/test/Transforms/InstCombine/binop-select.ll
+++ b/llvm/test/Transforms/InstCombine/binop-select.ll
@@ -335,7 +335,7 @@ define i32 @sub_sel_op1_use(i1 %b) {
 
 define float @fadd_sel_op0(i1 %b, float %x) {
 ; CHECK-LABEL: @fadd_sel_op0(
-; CHECK-NEXT:    [[R:%.*]] = select nnan i1 [[B:%.*]], float 0xFFF0000000000000, float 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = select nnan i1 [[B:%.*]], float ninf, float pinf
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %s = select i1 %b, float 0xFFF0000000000000, float 0x7FF0000000000000
@@ -345,7 +345,7 @@ define float @fadd_sel_op0(i1 %b, float %x) {
 
 define float @fadd_sel_op0_use(i1 %b, float %x) {
 ; CHECK-LABEL: @fadd_sel_op0_use(
-; CHECK-NEXT:    [[S:%.*]] = select i1 [[B:%.*]], float 0xFFF0000000000000, float 0x7FF0000000000000
+; CHECK-NEXT:    [[S:%.*]] = select i1 [[B:%.*]], float ninf, float pinf
 ; CHECK-NEXT:    call void @use_f32(float [[S]])
 ; CHECK-NEXT:    [[R:%.*]] = fadd nnan float [[S]], [[X:%.*]]
 ; CHECK-NEXT:    ret float [[R]]
diff --git a/llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll b/llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll
index 297dc647e7c67f..45d4b3891718a1 100644
--- a/llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll
+++ b/llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll
@@ -4,7 +4,7 @@
 define i1 @olt_pinf(half %x) {
 ; CHECK-LABEL: define i1 @olt_pinf(
 ; CHECK-SAME: half [[X:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp one half [[X]], 0xH7C00
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp one half [[X]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp = fcmp olt half %x, 0xH7c00
@@ -33,7 +33,7 @@ define i1 @ogt_pinf(half %x) {
 define i1 @oge_pinf(half %x) {
 ; CHECK-LABEL: define i1 @oge_pinf(
 ; CHECK-SAME: half [[X:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq half [[X]], 0xH7C00
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq half [[X]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp = fcmp oge half %x, 0xH7c00
@@ -43,7 +43,7 @@ define i1 @oge_pinf(half %x) {
 define i1 @ult_pinf(half %x) {
 ; CHECK-LABEL: define i1 @ult_pinf(
 ; CHECK-SAME: half [[X:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une half [[X]], 0xH7C00
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une half [[X]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp = fcmp ult half %x, 0xH7c00
@@ -72,7 +72,7 @@ define i1 @ugt_pinf(half %x) {
 define i1 @uge_pinf(half %x) {
 ; CHECK-LABEL: define i1 @uge_pinf(
 ; CHECK-SAME: half [[X:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp ueq half [[X]], 0xH7C00
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp ueq half [[X]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp = fcmp uge half %x, 0xH7c00
@@ -91,7 +91,7 @@ define i1 @olt_ninf(half %x) {
 define i1 @ole_ninf(half %x) {
 ; CHECK-LABEL: define i1 @ole_ninf(
 ; CHECK-SAME: half [[X:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq half [[X]], 0xHFC00
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq half [[X]], ninf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp = fcmp ole half %x, 0xHfc00
@@ -101,7 +101,7 @@ define i1 @ole_ninf(half %x) {
 define i1 @ogt_ninf(half %x) {
 ; CHECK-LABEL: define i1 @ogt_ninf(
 ; CHECK-SAME: half [[X:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp one half [[X]], 0xHFC00
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp one half [[X]], ninf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp = fcmp ogt half %x, 0xHfc00
@@ -131,7 +131,7 @@ define i1 @ult_ninf(half %x) {
 define i1 @ule_ninf(half %x) {
 ; CHECK-LABEL: define i1 @ule_ninf(
 ; CHECK-SAME: half [[X:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp ueq half [[X]], 0xHFC00
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp ueq half [[X]], ninf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp = fcmp ule half %x, 0xHfc00
@@ -141,7 +141,7 @@ define i1 @ule_ninf(half %x) {
 define i1 @ugt_ninf(half %x) {
 ; CHECK-LABEL: define i1 @ugt_ninf(
 ; CHECK-SAME: half [[X:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une half [[X]], 0xHFC00
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une half [[X]], ninf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp = fcmp ugt half %x, 0xHfc00
@@ -160,7 +160,7 @@ define i1 @uge_ninf(half %x) {
 define i1 @olt_pinf_fmf(half %x) {
 ; CHECK-LABEL: define i1 @olt_pinf_fmf(
 ; CHECK-SAME: half [[X:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp nsz one half [[X]], 0xH7C00
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp nsz one half [[X]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp = fcmp nsz olt half %x, 0xH7c00
@@ -170,7 +170,7 @@ define i1 @olt_pinf_fmf(half %x) {
 define i1 @oge_pinf_fmf(half %x) {
 ; CHECK-LABEL: define i1 @oge_pinf_fmf(
 ; CHECK-SAME: half [[X:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp nnan oeq half [[X]], 0xH7C00
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp nnan oeq half [[X]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp = fcmp nnan oge half %x, 0xH7c00
@@ -180,7 +180,7 @@ define i1 @oge_pinf_fmf(half %x) {
 define <2 x i1> @olt_pinf_vec(<2 x half> %x) {
 ; CHECK-LABEL: define <2 x i1> @olt_pinf_vec(
 ; CHECK-SAME: <2 x half> [[X:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp one <2 x half> [[X]], <half 0xH7C00, half 0xH7C00>
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp one <2 x half> [[X]], <half pinf, half pinf>
 ; CHECK-NEXT:    ret <2 x i1> [[CMP]]
 ;
   %cmp = fcmp olt <2 x half> %x, <half 0xH7c00, half 0xH7c00>
diff --git a/llvm/test/Transforms/InstCombine/cast-int-fcmp-eq-0.ll b/llvm/test/Transforms/InstCombine/cast-int-fcmp-eq-0.ll
index 68a386ec004237..631f4a620cc580 100644
--- a/llvm/test/Transforms/InstCombine/cast-int-fcmp-eq-0.ll
+++ b/llvm/test/Transforms/InstCombine/cast-int-fcmp-eq-0.ll
@@ -502,7 +502,7 @@ define i1 @i32_cast_cmp_oeq_int_inf_sitofp(i32 %i) {
 define i1 @i128_cast_cmp_oeq_int_inf_uitofp(i128 %i) {
 ; CHECK-LABEL: @i128_cast_cmp_oeq_int_inf_uitofp(
 ; CHECK-NEXT:    [[F:%.*]] = uitofp i128 [[I:%.*]] to float
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[F]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[F]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %f = uitofp i128 %i to float
diff --git a/llvm/test/Transforms/InstCombine/combine-is.fpclass-and-fcmp.ll b/llvm/test/Transforms/InstCombine/combine-is.fpclass-and-fcmp.ll
index ed8bfd5d669d9e..6e3912e4f0058a 100644
--- a/llvm/test/Transforms/InstCombine/combine-is.fpclass-and-fcmp.ll
+++ b/llvm/test/Transforms/InstCombine/combine-is.fpclass-and-fcmp.ll
@@ -36,7 +36,7 @@ define <2 x i1> @fcmp_oeq_inf_or_class_normal_vector(<2 x half> %x) {
 
 define i1 @fcmp_oeq_inf_multi_use_or_class_normal(half %x, ptr %ptr) {
 ; CHECK-LABEL: @fcmp_oeq_inf_multi_use_or_class_normal(
-; CHECK-NEXT:    [[OEQ_INF:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[OEQ_INF:%.*]] = fcmp oeq half [[X:%.*]], pinf
 ; CHECK-NEXT:    store i1 [[OEQ_INF]], ptr [[PTR:%.*]], align 1
 ; CHECK-NEXT:    [[CLASS:%.*]] = call i1 @llvm.is.fpclass.f16(half [[X]], i32 264)
 ; CHECK-NEXT:    [[OR:%.*]] = or i1 [[OEQ_INF]], [[CLASS]]
@@ -51,7 +51,7 @@ define i1 @fcmp_oeq_inf_multi_use_or_class_normal(half %x, ptr %ptr) {
 
 define i1 @fcmp_oeq_inf_or_class_normal_multi_use(half %x, ptr %ptr) {
 ; CHECK-LABEL: @fcmp_oeq_inf_or_class_normal_multi_use(
-; CHECK-NEXT:    [[OEQ_INF:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[OEQ_INF:%.*]] = fcmp oeq half [[X:%.*]], pinf
 ; CHECK-NEXT:    [[CLASS:%.*]] = call i1 @llvm.is.fpclass.f16(half [[X]], i32 264)
 ; CHECK-NEXT:    store i1 [[CLASS]], ptr [[PTR:%.*]], align 1
 ; CHECK-NEXT:    [[OR:%.*]] = or i1 [[OEQ_INF]], [[CLASS]]
@@ -136,7 +136,7 @@ define i1 @fcmp_isfinite_and_class_subnormal(half %x) {
 define i1 @fcmp_isfinite_or_class_subnormal(half %x) {
 ; CHECK-LABEL: @fcmp_isfinite_or_class_subnormal(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[SUBNORMAL_CLASS:%.*]] = fcmp one half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[SUBNORMAL_CLASS:%.*]] = fcmp one half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[SUBNORMAL_CLASS]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -150,7 +150,7 @@ define i1 @fcmp_isfinite_or_class_subnormal(half %x) {
 define i1 @fcmp_issubnormal_or_class_finite(half %x) {
 ; CHECK-LABEL: @fcmp_issubnormal_or_class_finite(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[OR:%.*]] = fcmp one half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[OR:%.*]] = fcmp one half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[OR]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -164,7 +164,7 @@ define i1 @fcmp_issubnormal_or_class_finite(half %x) {
 define i1 @class_finite_or_fcmp_issubnormal(half %x) {
 ; CHECK-LABEL: @class_finite_or_fcmp_issubnormal(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[OR:%.*]] = fcmp one half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[OR:%.*]] = fcmp one half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[OR]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -203,7 +203,7 @@ define i1 @class_inf_or_fcmp_issubnormal(half %x) {
 define <2 x i1> @class_finite_or_fcmp_issubnormal_vector(<2 x half> %x) {
 ; CHECK-LABEL: @class_finite_or_fcmp_issubnormal_vector(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call <2 x half> @llvm.fabs.v2f16(<2 x half> [[X:%.*]])
-; CHECK-NEXT:    [[OR:%.*]] = fcmp one <2 x half> [[TMP1]], <half 0xH7C00, half 0xH7C00>
+; CHECK-NEXT:    [[OR:%.*]] = fcmp one <2 x half> [[TMP1]], <half pinf, half pinf>
 ; CHECK-NEXT:    ret <2 x i1> [[OR]]
 ;
   %fabs = call <2 x half> @llvm.fabs.v2f16(<2 x half> %x)
diff --git a/llvm/test/Transforms/InstCombine/copysign-fneg-fabs.ll b/llvm/test/Transforms/InstCombine/copysign-fneg-fabs.ll
index a63eeab6a4b1e9..1784f8b2c9b01e 100644
--- a/llvm/test/Transforms/InstCombine/copysign-fneg-fabs.ll
+++ b/llvm/test/Transforms/InstCombine/copysign-fneg-fabs.ll
@@ -311,7 +311,7 @@ entry:
 define half @copysign_negnan(half %a) {
 ; CHECK-LABEL: @copysign_negnan(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[RET:%.*]] = call half @llvm.copysign.f16(half 0xH7E00, half [[A:%.*]])
+; CHECK-NEXT:    [[RET:%.*]] = call half @llvm.copysign.f16(half nan, half [[A:%.*]])
 ; CHECK-NEXT:    ret half [[RET]]
 ;
 entry:
@@ -322,7 +322,7 @@ entry:
 define half @copysign_neginf(half %a) {
 ; CHECK-LABEL: @copysign_neginf(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[RET:%.*]] = call half @llvm.copysign.f16(half 0xH7C00, half [[A:%.*]])
+; CHECK-NEXT:    [[RET:%.*]] = call half @llvm.copysign.f16(half pinf, half [[A:%.*]])
 ; CHECK-NEXT:    ret half [[RET]]
 ;
 entry:
diff --git a/llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll b/llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll
index 12c608cd6c2bb9..84bfc55da6b4bc 100644
--- a/llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll
+++ b/llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll
@@ -189,7 +189,7 @@ define i1 @not_isfinite_and_zero_f16(half %x) {
 define i1 @not_isfinite_or_zero_f16_multi_use_cmp0(half %x, ptr %ptr) {
 ; CHECK-LABEL: @not_isfinite_or_zero_f16_multi_use_cmp0(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], pinf
 ; CHECK-NEXT:    store i1 [[CMPINF]], ptr [[PTR:%.*]], align 1
 ; CHECK-NEXT:    [[CMPZERO:%.*]] = fcmp oeq half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMPZERO]], [[CMPINF]]
@@ -207,7 +207,7 @@ define i1 @not_isfinite_or_zero_f16_multi_use_cmp0(half %x, ptr %ptr) {
 define i1 @not_isfinite_or_zero_f16_multi_use_cmp1(half %x, ptr %ptr) {
 ; CHECK-LABEL: @not_isfinite_or_zero_f16_multi_use_cmp1(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], pinf
 ; CHECK-NEXT:    [[CMPZERO:%.*]] = fcmp oeq half [[X]], 0xH0000
 ; CHECK-NEXT:    store i1 [[CMPZERO]], ptr [[PTR:%.*]], align 1
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMPZERO]], [[CMPINF]]
@@ -251,7 +251,7 @@ define i1 @olt_0_or_fabs_ueq_inf(half %x) {
 define i1 @oeq_0_or_fabs_ult_inf(half %x) {
 ; CHECK-LABEL: @oeq_0_or_fabs_ult_inf(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp une half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp une half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -265,7 +265,7 @@ define i1 @oeq_0_or_fabs_ult_inf(half %x) {
 define i1 @not_isfinite_or_zero_f16_multi_not_0(half %x, ptr %ptr) {
 ; CHECK-LABEL: @not_isfinite_or_zero_f16_multi_not_0(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], pinf
 ; CHECK-NEXT:    [[CMPZERO:%.*]] = fcmp oeq half [[X]], 0xH3C00
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMPZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -281,7 +281,7 @@ define i1 @not_isfinite_or_zero_f16_multi_not_0(half %x, ptr %ptr) {
 define i1 @not_isfinite_or_zero_f16_fabs_wrong_val(half %x, half %y) {
 ; CHECK-LABEL: @not_isfinite_or_zero_f16_fabs_wrong_val(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[Y:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], pinf
 ; CHECK-NEXT:    [[CMPZERO:%.*]] = fcmp oeq half [[X:%.*]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMPZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -297,7 +297,7 @@ define i1 @not_isfinite_or_zero_f16_fabs_wrong_val(half %x, half %y) {
 define i1 @not_isfinite_or_zero_f16_not_fabs(half %x) {
 ; CHECK-LABEL: @not_isfinite_or_zero_f16_not_fabs(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.canonicalize.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], pinf
 ; CHECK-NEXT:    [[CMPZERO:%.*]] = fcmp oeq half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMPZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -420,7 +420,7 @@ define i1 @negated_isfinite_or_zero_f16_swapped_constants(half %x) {
 define i1 @negated_isfinite_or_zero_f16_multi_use_cmp0(half %x, ptr %ptr) {
 ; CHECK-LABEL: @negated_isfinite_or_zero_f16_multi_use_cmp0(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp one half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp one half [[FABS]], pinf
 ; CHECK-NEXT:    store i1 [[CMPINF]], ptr [[PTR:%.*]], align 1
 ; CHECK-NEXT:    [[CMPZERO:%.*]] = fcmp une half [[X]], 0xH0000
 ; CHECK-NEXT:    [[NOT_CLASS:%.*]] = and i1 [[CMPZERO]], [[CMPINF]]
@@ -438,7 +438,7 @@ define i1 @negated_isfinite_or_zero_f16_multi_use_cmp0(half %x, ptr %ptr) {
 define i1 @negated_isfinite_or_zero_f16_multi_use_cmp1(half %x, ptr %ptr) {
 ; CHECK-LABEL: @negated_isfinite_or_zero_f16_multi_use_cmp1(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp one half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp one half [[FABS]], pinf
 ; CHECK-NEXT:    [[CMPZERO:%.*]] = fcmp une half [[X]], 0xH0000
 ; CHECK-NEXT:    store i1 [[CMPZERO]], ptr [[PTR:%.*]], align 1
 ; CHECK-NEXT:    [[NOT_CLASS:%.*]] = and i1 [[CMPZERO]], [[CMPINF]]
@@ -469,7 +469,7 @@ define i1 @negated_isfinite_or_zero_f16_multi_use_cmp0_not_one_inf(half %x) {
 define i1 @negated_isfinite_or_zero_f16_fabs_wrong_value(half %x, half %y) {
 ; CHECK-LABEL: @negated_isfinite_or_zero_f16_fabs_wrong_value(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[Y:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp one half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp one half [[FABS]], pinf
 ; CHECK-NEXT:    [[CMPZERO:%.*]] = fcmp une half [[X:%.*]], 0xH0000
 ; CHECK-NEXT:    [[NOT_CLASS:%.*]] = and i1 [[CMPZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[NOT_CLASS]]
@@ -581,7 +581,7 @@ define i1 @issubnormal_uge_or_inf(half %x) {
 define i1 @issubnormal_or_inf_wrong_val(half %x) {
 ; CHECK-LABEL: @issubnormal_or_inf_wrong_val(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[FABS]], pinf
 ; CHECK-NEXT:    [[CMP_SMALLEST_NORMAL:%.*]] = fcmp olt half [[FABS]], 0xH0401
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_SMALLEST_NORMAL]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -596,7 +596,7 @@ define i1 @issubnormal_or_inf_wrong_val(half %x) {
 define i1 @issubnormal_or_inf_neg_smallest_normal(half %x) {
 ; CHECK-LABEL: @issubnormal_or_inf_neg_smallest_normal(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[FABS]], pinf
 ; CHECK-NEXT:    ret i1 [[CMPINF]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -609,7 +609,7 @@ define i1 @issubnormal_or_inf_neg_smallest_normal(half %x) {
 define i1 @fneg_fabs_olt_neg_smallest_normal_or_inf(half %x) {
 ; CHECK-LABEL: @fneg_fabs_olt_neg_smallest_normal_or_inf(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[FABS]], pinf
 ; CHECK-NEXT:    [[CMP_SMALLEST_NORMAL:%.*]] = fcmp ogt half [[FABS]], 0xH0400
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_SMALLEST_NORMAL]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -625,7 +625,7 @@ define i1 @fneg_fabs_olt_neg_smallest_normal_or_inf(half %x) {
 define i1 @issubnormal_or_finite_olt(half %x) {
 ; CHECK-LABEL: @issubnormal_or_finite_olt(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[OR:%.*]] = fcmp one half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[OR:%.*]] = fcmp one half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[OR]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -691,7 +691,7 @@ define i1 @fcmp_fabs_uge_inf_or_fabs_uge_smallest_norm(half %x) {
 define i1 @is_finite_and_ord(half %x) {
 ; CHECK-LABEL: @is_finite_and_ord(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[FABS]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -727,7 +727,7 @@ define i1 @is_finite_or_ord(half %x) {
 define i1 @is_finite_or_uno(half %x) {
 ; CHECK-LABEL: @is_finite_or_uno(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[OR:%.*]] = fcmp ueq half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[OR:%.*]] = fcmp ueq half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[OR]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -740,7 +740,7 @@ define i1 @is_finite_or_uno(half %x) {
 define i1 @oeq_isinf_or_uno(half %x) {
 ; CHECK-LABEL: @oeq_isinf_or_uno(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp ueq half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp ueq half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -776,7 +776,7 @@ define i1 @oeq_isinf_and_uno(half %x) {
 define i1 @oeq_isinf_and_ord(half %x) {
 ; CHECK-LABEL: @oeq_isinf_and_ord(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -908,7 +908,7 @@ define i1 @isnormalinf_or_posinf(half %x) #0 {
 define i1 @isnormalinf_and_inf(half %x) #0 {
 ; CHECK-LABEL: @isnormalinf_and_inf(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -921,7 +921,7 @@ define i1 @isnormalinf_and_inf(half %x) #0 {
 ; -> pinf
 define i1 @posisnormalinf_and_posinf(half %x) #0 {
 ; CHECK-LABEL: @posisnormalinf_and_posinf(
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -934,7 +934,7 @@ define i1 @posisnormalinf_and_posinf(half %x) #0 {
 ; -> pinf
 define i1 @isnormalinf_and_posinf(half %x) #0 {
 ; CHECK-LABEL: @isnormalinf_and_posinf(
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -977,7 +977,7 @@ define i1 @not_isnormalinf_and_ord(half %x) #0 {
 define i1 @not_isnormalinf_or_inf(half %x) #0 {
 ; CHECK-LABEL: @not_isnormalinf_or_inf(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[OR:%.*]] = fcmp une half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[OR:%.*]] = fcmp une half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[OR]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -1077,7 +1077,7 @@ define i1 @olt_smallest_normal_or_uno(half %x) #0 {
 
 define i1 @olt_smallest_normal_or_finite(half %x) #0 {
 ; CHECK-LABEL: @olt_smallest_normal_or_finite(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp one half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp one half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -1124,7 +1124,7 @@ define i1 @uge_smallest_normal_and_uno(half %x) #0 {
 ; -> true
 define i1 @olt_infinity_or_finite(half %x) #0 {
 ; CHECK-LABEL: @olt_infinity_or_finite(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp one half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp one half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %lt.infinity = fcmp olt half %x, 0xH7C00
@@ -1160,7 +1160,7 @@ define i1 @olt_infinity_or_ord(half %x) #0 {
 ; -> ~posinf
 define i1 @olt_infinity_or_uno(half %x) #0 {
 ; CHECK-LABEL: @olt_infinity_or_uno(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp une half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp une half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %lt.infinity = fcmp olt half %x, 0xH7C00
@@ -1171,7 +1171,7 @@ define i1 @olt_infinity_or_uno(half %x) #0 {
 
 define i1 @olt_infinity_or_subnormal(half %x) #0 {
 ; CHECK-LABEL: @olt_infinity_or_subnormal(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp one half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp one half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %lt.infinity = fcmp olt half %x, 0xH7C00
@@ -1209,7 +1209,7 @@ define i1 @olt_infinity_and_not_subnormal(half %x) #0 {
 ; -> ninf
 define i1 @olt_infinity_and_ueq_inf(half %x) #0 {
 ; CHECK-LABEL: @olt_infinity_and_ueq_inf(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq half [[X:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %lt.infinity = fcmp olt half %x, 0xH7C00
@@ -1245,7 +1245,7 @@ define i1 @olt_smallest_normal_or_ueq_inf(half %x) #0 {
 ; -> ~pinf
 define i1 @olt_smallest_normal_or_une_inf(half %x) #0 {
 ; CHECK-LABEL: @olt_smallest_normal_or_une_inf(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp une half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp une half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %lt.normal = fcmp olt half %x, 0xH0400
@@ -1295,7 +1295,7 @@ define i1 @olt_smallest_normal_and_une_inf_or_one_smallest_normal(half %x) #0 {
 define i1 @oge_fabs_eq_inf_and_ord(half %x) #0 {
 ; CHECK-LABEL: @oge_fabs_eq_inf_and_ord(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp oeq half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -1307,7 +1307,7 @@ define i1 @oge_fabs_eq_inf_and_ord(half %x) #0 {
 
 define i1 @oge_eq_inf_and_ord(half %x) #0 {
 ; CHECK-LABEL: @oge_eq_inf_and_ord(
-; CHECK-NEXT:    [[OGE_FABS_INF:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[OGE_FABS_INF:%.*]] = fcmp oeq half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[OGE_FABS_INF]]
 ;
   %oge.fabs.inf = fcmp oge half %x, 0xH7C00
@@ -1319,7 +1319,7 @@ define i1 @oge_eq_inf_and_ord(half %x) #0 {
 define i1 @oge_fabs_eq_inf_or_uno(half %x) #0 {
 ; CHECK-LABEL: @oge_fabs_eq_inf_or_uno(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[OR:%.*]] = fcmp ueq half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[OR:%.*]] = fcmp ueq half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[OR]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -1331,7 +1331,7 @@ define i1 @oge_fabs_eq_inf_or_uno(half %x) #0 {
 
 define i1 @oge_eq_inf_or_uno(half %x) #0 {
 ; CHECK-LABEL: @oge_eq_inf_or_uno(
-; CHECK-NEXT:    [[OR:%.*]] = fcmp ueq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[OR:%.*]] = fcmp ueq half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[OR]]
 ;
   %oge.fabs.inf = fcmp oge half %x, 0xH7C00
@@ -1343,7 +1343,7 @@ define i1 @oge_eq_inf_or_uno(half %x) #0 {
 define i1 @ult_fabs_eq_inf_and_ord(half %x) #0 {
 ; CHECK-LABEL: @ult_fabs_eq_inf_and_ord(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[AND:%.*]] = fcmp one half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp one half [[FABS]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -1355,7 +1355,7 @@ define i1 @ult_fabs_eq_inf_and_ord(half %x) #0 {
 
 define i1 @ult_eq_inf_and_ord(half %x) #0 {
 ; CHECK-LABEL: @ult_eq_inf_and_ord(
-; CHECK-NEXT:    [[AND:%.*]] = fcmp one half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[AND:%.*]] = fcmp one half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %ult.fabs.inf = fcmp ult half %x, 0xH7C00
@@ -1367,7 +1367,7 @@ define i1 @ult_eq_inf_and_ord(half %x) #0 {
 define i1 @ult_fabs_eq_inf_or_uno(half %x) #0 {
 ; CHECK-LABEL: @ult_fabs_eq_inf_or_uno(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[OR:%.*]] = fcmp une half [[TMP1]], 0xH7C00
+; CHECK-NEXT:    [[OR:%.*]] = fcmp une half [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[OR]]
 ;
   %fabs = call half @llvm.fabs.f16(half %x)
@@ -1379,7 +1379,7 @@ define i1 @ult_fabs_eq_inf_or_uno(half %x) #0 {
 
 define i1 @ult_eq_inf_or_uno(half %x) #0 {
 ; CHECK-LABEL: @ult_eq_inf_or_uno(
-; CHECK-NEXT:    [[ULT_FABS_INF:%.*]] = fcmp une half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[ULT_FABS_INF:%.*]] = fcmp une half [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[ULT_FABS_INF]]
 ;
   %ult.fabs.inf = fcmp ult half %x, 0xH7C00
@@ -1392,7 +1392,7 @@ define i1 @ult_eq_inf_or_uno(half %x) #0 {
 ; Can't do anything with this
 define i1 @oeq_neginfinity_or_oeq_smallest_normal(half %x) #0 {
 ; CHECK-LABEL: @oeq_neginfinity_or_oeq_smallest_normal(
-; CHECK-NEXT:    [[OEQ_NEG_INFINITY:%.*]] = fcmp oeq half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[OEQ_NEG_INFINITY:%.*]] = fcmp oeq half [[X:%.*]], ninf
 ; CHECK-NEXT:    [[CMP_SMALLEST_NORMAL:%.*]] = fcmp oeq half [[X]], 0xH0400
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[OEQ_NEG_INFINITY]], [[CMP_SMALLEST_NORMAL]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -1418,7 +1418,7 @@ define i1 @oeq_neginfinity_or_olt_smallest_normal(half %x) #0 {
 ; -> ninf
 define i1 @oeq_neginfinity_and_olt_smallest_normal(half %x) #0 {
 ; CHECK-LABEL: @oeq_neginfinity_and_olt_smallest_normal(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq half [[X:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %oeq.neg.infinity = fcmp oeq half %x, 0xHFC00
@@ -1465,7 +1465,7 @@ define i1 @oeq_neginfinity_or_ord(half %x) #0 {
 ; -> ninf
 define i1 @oeq_neginfinity_and_ord(half %x) #0 {
 ; CHECK-LABEL: @oeq_neginfinity_and_ord(
-; CHECK-NEXT:    [[OEQ_NEG_INFINITY:%.*]] = fcmp oeq half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[OEQ_NEG_INFINITY:%.*]] = fcmp oeq half [[X:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[OEQ_NEG_INFINITY]]
 ;
   %oeq.neg.infinity = fcmp oeq half %x, 0xHFC00
@@ -1477,7 +1477,7 @@ define i1 @oeq_neginfinity_and_ord(half %x) #0 {
 ; can't do anything with this
 define i1 @une_neginfinity_or_oeq_smallest_normal(half %x) #0 {
 ; CHECK-LABEL: @une_neginfinity_or_oeq_smallest_normal(
-; CHECK-NEXT:    [[UNE_NEG_INFINITY:%.*]] = fcmp une half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[UNE_NEG_INFINITY:%.*]] = fcmp une half [[X:%.*]], ninf
 ; CHECK-NEXT:    [[CMP_SMALLEST_NORMAL:%.*]] = fcmp oeq half [[X]], 0xH0400
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[UNE_NEG_INFINITY]], [[CMP_SMALLEST_NORMAL]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -1502,7 +1502,7 @@ define i1 @une_neginfinity_or_ord(half %x) #0 {
 ; -> ~(nan | ninf)
 define i1 @une_neginfinity_and_ord(half %x) #0 {
 ; CHECK-LABEL: @une_neginfinity_and_ord(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp one half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp one half [[X:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %une.neg.infinity = fcmp une half %x, 0xHFC00
@@ -1538,7 +1538,7 @@ define i1 @one_neginfinity_and_olt_smallest_normal(half %x) #0 {
 ; -> ~ninf
 define i1 @one_neginfinity_or_uno(half %x) #0 {
 ; CHECK-LABEL: @one_neginfinity_or_uno(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp une half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp une half [[X:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %one.neg.infinity = fcmp one half %x, 0xHFC00
@@ -1585,7 +1585,7 @@ define i1 @ueq_neginfinity_or_olt_smallest_normal(half %x) #0 {
 ; -> ninf
 define i1 @ueq_neginfinity_and_olt_smallest_normal(half %x) #0 {
 ; CHECK-LABEL: @ueq_neginfinity_and_olt_smallest_normal(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq half [[X:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %ueq.neg.infinity = fcmp ueq half %x, 0xHFC00
@@ -1597,7 +1597,7 @@ define i1 @ueq_neginfinity_and_olt_smallest_normal(half %x) #0 {
 ; -> nan|ninf
 define i1 @ueq_neginfinity_or_uno(half %x) #0 {
 ; CHECK-LABEL: @ueq_neginfinity_or_uno(
-; CHECK-NEXT:    [[UEQ_NEG_INFINITY:%.*]] = fcmp ueq half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[UEQ_NEG_INFINITY:%.*]] = fcmp ueq half [[X:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[UEQ_NEG_INFINITY]]
 ;
   %ueq.neg.infinity = fcmp ueq half %x, 0xHFC00
@@ -1764,7 +1764,7 @@ define i1 @fabs_ueq_neginfinity_or_fabs_uge_smallest_normal(half %x) #0 {
 define i1 @not_isfinite_or_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @not_isfinite_or_zero_f16_daz(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], pinf
 ; CHECK-NEXT:    [[CMPZERO:%.*]] = fcmp oeq half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMPZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -1779,7 +1779,7 @@ define i1 @not_isfinite_or_zero_f16_daz(half %x) #1 {
 define <2 x i1> @not_isfinite_or_zero_v2f16_daz(<2 x half> %x) #1 {
 ; CHECK-LABEL: @not_isfinite_or_zero_v2f16_daz(
 ; CHECK-NEXT:    [[FABS:%.*]] = call <2 x half> @llvm.fabs.v2f16(<2 x half> [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq <2 x half> [[FABS]], <half 0xH7C00, half 0xH7C00>
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq <2 x half> [[FABS]], <half pinf, half pinf>
 ; CHECK-NEXT:    [[CMPZERO:%.*]] = fcmp oeq <2 x half> [[X]], zeroinitializer
 ; CHECK-NEXT:    [[CLASS:%.*]] = or <2 x i1> [[CMPZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret <2 x i1> [[CLASS]]
@@ -1795,7 +1795,7 @@ define <2 x i1> @not_isfinite_or_zero_v2f16_daz(<2 x half> %x) #1 {
 define i1 @not_isfinite_or_zero_f16_dynamic(half %x) #2 {
 ; CHECK-LABEL: @not_isfinite_or_zero_f16_dynamic(
 ; CHECK-NEXT:    [[FABS:%.*]] = call half @llvm.fabs.f16(half [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[FABS]], pinf
 ; CHECK-NEXT:    [[CMPZERO:%.*]] = fcmp oeq half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMPZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -1810,7 +1810,7 @@ define i1 @not_isfinite_or_zero_f16_dynamic(half %x) #2 {
 define <2 x i1> @not_isfinite_or_zero_v2f16_dynamic(<2 x half> %x) #2 {
 ; CHECK-LABEL: @not_isfinite_or_zero_v2f16_dynamic(
 ; CHECK-NEXT:    [[FABS:%.*]] = call <2 x half> @llvm.fabs.v2f16(<2 x half> [[X:%.*]])
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq <2 x half> [[FABS]], <half 0xH7C00, half 0xH7C00>
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq <2 x half> [[FABS]], <half pinf, half pinf>
 ; CHECK-NEXT:    [[CMPZERO:%.*]] = fcmp oeq <2 x half> [[X]], zeroinitializer
 ; CHECK-NEXT:    [[CLASS:%.*]] = or <2 x i1> [[CMPZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret <2 x i1> [[CLASS]]
@@ -1937,7 +1937,7 @@ define i1 @fcmp_oeq_neginf_or_oge_zero_f16(half %x) {
 
 define i1 @fcmp_ueq_neginf_or_oge_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_ueq_neginf_or_oge_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[X:%.*]], ninf
 ; CHECK-NEXT:    [[CMP_OGE_ZERO:%.*]] = fcmp oge half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_OGE_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -1950,7 +1950,7 @@ define i1 @fcmp_ueq_neginf_or_oge_zero_f16_daz(half %x) #1 {
 
 define i1 @fcmp_oeq_neginf_or_oge_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_oeq_neginf_or_oge_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], ninf
 ; CHECK-NEXT:    [[CMP_OGE_ZERO:%.*]] = fcmp oge half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_OGE_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -1985,7 +1985,7 @@ define i1 @fcmp_ueq_neginf_or_ogt_zero_f16(half %x) {
 
 define i1 @fcmp_ueq_neginf_or_ogt_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_ueq_neginf_or_ogt_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[X:%.*]], ninf
 ; CHECK-NEXT:    [[CMP_OGT_ZERO:%.*]] = fcmp ogt half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_OGT_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -1998,7 +1998,7 @@ define i1 @fcmp_ueq_neginf_or_ogt_zero_f16_daz(half %x) #1 {
 
 define i1 @fcmp_oeq_neginf_or_ogt_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_oeq_neginf_or_ogt_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], ninf
 ; CHECK-NEXT:    [[CMP_OGT_ZERO:%.*]] = fcmp ogt half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_OGT_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -2022,7 +2022,7 @@ define i1 @fcmp_oeq_neginf_or_ugt_zero_f16(half %x) {
 
 define i1 @fcmp_ueq_neginf_or_ugt_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_ueq_neginf_or_ugt_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[X:%.*]], ninf
 ; CHECK-NEXT:    [[CMP_UGT_ZERO:%.*]] = fcmp ugt half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_UGT_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -2035,7 +2035,7 @@ define i1 @fcmp_ueq_neginf_or_ugt_zero_f16_daz(half %x) #1 {
 
 define i1 @fcmp_oeq_neginf_or_ugt_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_oeq_neginf_or_ugt_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], 0xHFC00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], ninf
 ; CHECK-NEXT:    [[CMP_UGT_ZERO:%.*]] = fcmp ugt half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_UGT_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -2070,7 +2070,7 @@ define i1 @fcmp_oeq_posinf_or_ole_zero_f16(half %x) {
 
 define i1 @fcmp_ueq_posinf_or_ole_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_ueq_posinf_or_ole_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[X:%.*]], pinf
 ; CHECK-NEXT:    [[CMP_OLE_ZERO:%.*]] = fcmp ole half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_OLE_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -2083,7 +2083,7 @@ define i1 @fcmp_ueq_posinf_or_ole_zero_f16_daz(half %x) #1 {
 
 define i1 @fcmp_oeq_posinf_or_ole_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_oeq_posinf_or_ole_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], pinf
 ; CHECK-NEXT:    [[CMP_OLE_ZERO:%.*]] = fcmp ole half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_OLE_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -2107,7 +2107,7 @@ define i1 @fcmp_oeq_posinf_or_olt_zero_f16(half %x) {
 
 define i1 @fcmp_oeq_posinf_or_olt_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_oeq_posinf_or_olt_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], pinf
 ; CHECK-NEXT:    [[CMP_OLT_ZERO:%.*]] = fcmp olt half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_OLT_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -2142,7 +2142,7 @@ define i1 @fcmp_oeq_posinf_or_ult_zero_f16(half %x) {
 
 define i1 @fcmp_ueq_posinf_or_ult_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_ueq_posinf_or_ult_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[X:%.*]], pinf
 ; CHECK-NEXT:    [[CMP_ULT_ZERO:%.*]] = fcmp ult half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_ULT_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -2155,7 +2155,7 @@ define i1 @fcmp_ueq_posinf_or_ult_zero_f16_daz(half %x) #1 {
 
 define i1 @fcmp_oeq_posinf_or_ult_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_oeq_posinf_or_ult_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], pinf
 ; CHECK-NEXT:    [[CMP_ULT_ZERO:%.*]] = fcmp ult half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_ULT_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -2179,7 +2179,7 @@ define i1 @fcmp_ueq_posinf_or_ule_zero_f16(half %x) {
 
 define i1 @fcmp_ueq_posinf_or_ule_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_ueq_posinf_or_ule_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp ueq half [[X:%.*]], pinf
 ; CHECK-NEXT:    [[CMP_ULE_ZERO:%.*]] = fcmp ule half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_ULE_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
@@ -2192,7 +2192,7 @@ define i1 @fcmp_ueq_posinf_or_ule_zero_f16_daz(half %x) #1 {
 
 define i1 @fcmp_oeq_posinf_or_ule_zero_f16_daz(half %x) #1 {
 ; CHECK-LABEL: @fcmp_oeq_posinf_or_ule_zero_f16_daz(
-; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], 0xH7C00
+; CHECK-NEXT:    [[CMPINF:%.*]] = fcmp oeq half [[X:%.*]], pinf
 ; CHECK-NEXT:    [[CMP_ULE_ZERO:%.*]] = fcmp ule half [[X]], 0xH0000
 ; CHECK-NEXT:    [[CLASS:%.*]] = or i1 [[CMP_ULE_ZERO]], [[CMPINF]]
 ; CHECK-NEXT:    ret i1 [[CLASS]]
diff --git a/llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll b/llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll
index 10a3ccf3cdb48a..eb17af4591fa89 100644
--- a/llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll
+++ b/llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll
@@ -137,7 +137,7 @@ define i1 @test_and_olt_infinity(float %x) {
 ; CHECK-LABEL: define i1 @test_and_olt_infinity(
 ; CHECK-SAME: float [[X:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; CHECK-NEXT:    [[COND:%.*]] = fcmp one float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[COND:%.*]] = fcmp one float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[COND]]
 ;
   %cmp1 = fcmp olt float %x, 0x7FF0000000000000
diff --git a/llvm/test/Transforms/InstCombine/fdiv.ll b/llvm/test/Transforms/InstCombine/fdiv.ll
index ca11685c98417a..89507bd9da526d 100644
--- a/llvm/test/Transforms/InstCombine/fdiv.ll
+++ b/llvm/test/Transforms/InstCombine/fdiv.ll
@@ -950,7 +950,7 @@ define float @fdiv_zero_f32(float %x) {
 ; https://alive2.llvm.org/ce/z/gLBFKB
 define float @fdiv_nnan_zero_f32(float %x) {
 ; CHECK-LABEL: @fdiv_nnan_zero_f32(
-; CHECK-NEXT:    [[FDIV:%.*]] = call nnan float @llvm.copysign.f32(float 0x7FF0000000000000, float [[X:%.*]])
+; CHECK-NEXT:    [[FDIV:%.*]] = call nnan float @llvm.copysign.f32(float pinf, float [[X:%.*]])
 ; CHECK-NEXT:    ret float [[FDIV]]
 ;
   %fdiv = fdiv nnan float %x, 0.0
@@ -959,7 +959,7 @@ define float @fdiv_nnan_zero_f32(float %x) {
 
 define <2 x float> @fdiv_nnan_zero_v2f32(<2 x float> %x) {
 ; CHECK-LABEL: @fdiv_nnan_zero_v2f32(
-; CHECK-NEXT:    [[FDIV:%.*]] = call nnan <2 x float> @llvm.copysign.v2f32(<2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>, <2 x float> [[X:%.*]])
+; CHECK-NEXT:    [[FDIV:%.*]] = call nnan <2 x float> @llvm.copysign.v2f32(<2 x float> <float pinf, float pinf>, <2 x float> [[X:%.*]])
 ; CHECK-NEXT:    ret <2 x float> [[FDIV]]
 ;
   %fdiv = fdiv nnan <2 x float> %x, zeroinitializer
@@ -968,7 +968,7 @@ define <2 x float> @fdiv_nnan_zero_v2f32(<2 x float> %x) {
 
 define float @fdiv_nnan_zero_f32_fmf(float %x) {
 ; CHECK-LABEL: @fdiv_nnan_zero_f32_fmf(
-; CHECK-NEXT:    [[FDIV:%.*]] = call nnan nsz float @llvm.copysign.f32(float 0x7FF0000000000000, float [[X:%.*]])
+; CHECK-NEXT:    [[FDIV:%.*]] = call nnan nsz float @llvm.copysign.f32(float pinf, float [[X:%.*]])
 ; CHECK-NEXT:    ret float [[FDIV]]
 ;
   %fdiv = fdiv nnan nsz float %x, 0.0
@@ -977,7 +977,7 @@ define float @fdiv_nnan_zero_f32_fmf(float %x) {
 
 define <2 x float> @fdiv_nnan_zero_v2f32_fmf(<2 x float> %x) {
 ; CHECK-LABEL: @fdiv_nnan_zero_v2f32_fmf(
-; CHECK-NEXT:    [[FDIV:%.*]] = call nnan nsz <2 x float> @llvm.copysign.v2f32(<2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>, <2 x float> [[X:%.*]])
+; CHECK-NEXT:    [[FDIV:%.*]] = call nnan nsz <2 x float> @llvm.copysign.v2f32(<2 x float> <float pinf, float pinf>, <2 x float> [[X:%.*]])
 ; CHECK-NEXT:    ret <2 x float> [[FDIV]]
 ;
   %fdiv = fdiv nnan nsz <2 x float> %x, zeroinitializer
@@ -995,7 +995,7 @@ define float @fdiv_nnan_neg_zero_f32(float %x) {
 
 define double @test_positive_zero_nsz(double %X) {
 ; CHECK-LABEL: @test_positive_zero_nsz(
-; CHECK-NEXT:    [[TMP1:%.*]] = call nnan nsz double @llvm.copysign.f64(double 0x7FF0000000000000, double [[X:%.*]])
+; CHECK-NEXT:    [[TMP1:%.*]] = call nnan nsz double @llvm.copysign.f64(double pinf, double [[X:%.*]])
 ; CHECK-NEXT:    ret double [[TMP1]]
 ;
   %1 = fdiv nnan nsz double %X, 0.0
@@ -1004,7 +1004,7 @@ define double @test_positive_zero_nsz(double %X) {
 
 define double @test_negative_zero_nsz(double %X) {
 ; CHECK-LABEL: @test_negative_zero_nsz(
-; CHECK-NEXT:    [[TMP1:%.*]] = call nnan nsz double @llvm.copysign.f64(double 0x7FF0000000000000, double [[X:%.*]])
+; CHECK-NEXT:    [[TMP1:%.*]] = call nnan nsz double @llvm.copysign.f64(double pinf, double [[X:%.*]])
 ; CHECK-NEXT:    ret double [[TMP1]]
 ;
   %1 = fdiv nnan nsz double %X, -0.0
@@ -1013,7 +1013,7 @@ define double @test_negative_zero_nsz(double %X) {
 
 define double @test_positive_zero(double %X) {
 ; CHECK-LABEL: @test_positive_zero(
-; CHECK-NEXT:    [[TMP1:%.*]] = call nnan double @llvm.copysign.f64(double 0x7FF0000000000000, double [[X:%.*]])
+; CHECK-NEXT:    [[TMP1:%.*]] = call nnan double @llvm.copysign.f64(double pinf, double [[X:%.*]])
 ; CHECK-NEXT:    ret double [[TMP1]]
 ;
   %1 = fdiv nnan double %X, 0.0
@@ -1031,7 +1031,7 @@ define double @test_negative_zero(double %X) {
 
 define <2 x double> @test_positive_zero_vector_nsz(<2 x double> %X) {
 ; CHECK-LABEL: @test_positive_zero_vector_nsz(
-; CHECK-NEXT:    [[TMP1:%.*]] = call nnan nsz <2 x double> @llvm.copysign.v2f64(<2 x double> <double 0x7FF0000000000000, double 0x7FF0000000000000>, <2 x double> [[X:%.*]])
+; CHECK-NEXT:    [[TMP1:%.*]] = call nnan nsz <2 x double> @llvm.copysign.v2f64(<2 x double> <double pinf, double pinf>, <2 x double> [[X:%.*]])
 ; CHECK-NEXT:    ret <2 x double> [[TMP1]]
 ;
   %1 = fdiv nnan nsz <2 x double> %X, <double 0.0, double 0.0>
@@ -1040,7 +1040,7 @@ define <2 x double> @test_positive_zero_vector_nsz(<2 x double> %X) {
 
 define <2 x double> @test_negative_zero_vector_nsz(<2 x double> %X) {
 ; CHECK-LABEL: @test_negative_zero_vector_nsz(
-; CHECK-NEXT:    [[TMP1:%.*]] = call nnan nsz <2 x double> @llvm.copysign.v2f64(<2 x double> <double 0x7FF0000000000000, double 0x7FF0000000000000>, <2 x double> [[X:%.*]])
+; CHECK-NEXT:    [[TMP1:%.*]] = call nnan nsz <2 x double> @llvm.copysign.v2f64(<2 x double> <double pinf, double pinf>, <2 x double> [[X:%.*]])
 ; CHECK-NEXT:    ret <2 x double> [[TMP1]]
 ;
   %1 = fdiv nnan nsz <2 x double> %X, <double -0.0, double 0.0>
@@ -1049,7 +1049,7 @@ define <2 x double> @test_negative_zero_vector_nsz(<2 x double> %X) {
 
 define <2 x double> @test_positive_zero_vector(<2 x double> %X) {
 ; CHECK-LABEL: @test_positive_zero_vector(
-; CHECK-NEXT:    [[TMP1:%.*]] = call nnan <2 x double> @llvm.copysign.v2f64(<2 x double> <double 0x7FF0000000000000, double 0x7FF0000000000000>, <2 x double> [[X:%.*]])
+; CHECK-NEXT:    [[TMP1:%.*]] = call nnan <2 x double> @llvm.copysign.v2f64(<2 x double> <double pinf, double pinf>, <2 x double> [[X:%.*]])
 ; CHECK-NEXT:    ret <2 x double> [[TMP1]]
 ;
   %1 = fdiv nnan <2 x double> %X, <double 0.0, double 0.0>
diff --git a/llvm/test/Transforms/InstCombine/fma.ll b/llvm/test/Transforms/InstCombine/fma.ll
index 4590bbb7abaeb8..b3f6882113aecb 100644
--- a/llvm/test/Transforms/InstCombine/fma.ll
+++ b/llvm/test/Transforms/InstCombine/fma.ll
@@ -587,7 +587,7 @@ define <2 x double> @fma_const_fmul_one2(<2 x double> %b) {
 
 define <2 x double> @fma_nan_and_const_0(<2 x double> %b) {
 ; CHECK-LABEL: @fma_nan_and_const_0(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, <2 x double> <double 0.0000000129182, double 0.000009123>, <2 x double> %b)
   ret <2 x double> %res
@@ -595,7 +595,7 @@ define <2 x double> @fma_nan_and_const_0(<2 x double> %b) {
 
 define <2 x double> @fma_nan_and_const_1(<2 x double> %b) {
 ; CHECK-LABEL: @fma_nan_and_const_1(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> <double 0.0000000129182, double 0.000009123>, <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, <2 x double> %b)
   ret <2 x double> %res
@@ -603,7 +603,7 @@ define <2 x double> @fma_nan_and_const_1(<2 x double> %b) {
 
 define <2 x double> @fma_nan_and_const_2(<2 x double> %b) {
 ; CHECK-LABEL: @fma_nan_and_const_2(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> <double 0.0000000129182, double 0.000009123>, <2 x double> %b, <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>)
   ret <2 x double> %res
@@ -611,7 +611,7 @@ define <2 x double> @fma_nan_and_const_2(<2 x double> %b) {
 
 define <2 x double> @fma_undef_0(<2 x double> %b, <2 x double> %c) {
 ; CHECK-LABEL: @fma_undef_0(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> <double undef, double undef>, <2 x double> %b, <2 x double> %c)
   ret <2 x double> %res
@@ -619,7 +619,7 @@ define <2 x double> @fma_undef_0(<2 x double> %b, <2 x double> %c) {
 
 define <2 x double> @fma_undef_1(<2 x double> %b, <2 x double> %c) {
 ; CHECK-LABEL: @fma_undef_1(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> %b, <2 x double> <double undef, double undef>, <2 x double> %c)
   ret <2 x double> %res
@@ -627,7 +627,7 @@ define <2 x double> @fma_undef_1(<2 x double> %b, <2 x double> %c) {
 
 define <2 x double> @fma_undef_2(<2 x double> %b, <2 x double> %c) {
 ; CHECK-LABEL: @fma_undef_2(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> %b, <2 x double> %c, <2 x double> <double undef, double undef>)
   ret <2 x double> %res
@@ -663,14 +663,14 @@ define <2 x double> @fma_partial_undef_2(<2 x double> %b, <2 x double> %c) {
 
 define <2 x double> @fma_nan_0(<2 x double> %b, <2 x double> %c) {
 ; CHECK-LABEL: @fma_nan_0(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, <2 x double> %b, <2 x double> %c)
   ret <2 x double> %res
 }
 define <2 x double> @fma_nan_1(<2 x double> %b, <2 x double> %c) {
 ; CHECK-LABEL: @fma_nan_1(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> %b, <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, <2 x double> %c)
   ret <2 x double> %res
@@ -678,7 +678,7 @@ define <2 x double> @fma_nan_1(<2 x double> %b, <2 x double> %c) {
 
 define <2 x double> @fma_nan_2(<2 x double> %b, <2 x double> %c) {
 ; CHECK-LABEL: @fma_nan_2(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fma.v2f64(<2 x double> %b, <2 x double> %c, <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>)
   ret <2 x double> %res
@@ -695,7 +695,7 @@ define <2 x double> @fmuladd_const_fmul(<2 x double> %b) {
 
 define <2 x double> @fmuladd_nan_and_const_0(<2 x double> %b) {
 ; CHECK-LABEL: @fmuladd_nan_and_const_0(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, <2 x double> <double 0.0000000129182, double 0.000009123>, <2 x double> %b)
   ret <2 x double> %res
@@ -703,7 +703,7 @@ define <2 x double> @fmuladd_nan_and_const_0(<2 x double> %b) {
 
 define <2 x double> @fmuladd_nan_and_const_1(<2 x double> %b) {
 ; CHECK-LABEL: @fmuladd_nan_and_const_1(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> <double 0.0000000129182, double 0.000009123>, <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, <2 x double> %b)
   ret <2 x double> %res
@@ -711,7 +711,7 @@ define <2 x double> @fmuladd_nan_and_const_1(<2 x double> %b) {
 
 define <2 x double> @fmuladd_nan_and_const_2(<2 x double> %b) {
 ; CHECK-LABEL: @fmuladd_nan_and_const_2(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> <double 0.0000000129182, double 0.000009123>, <2 x double> %b, <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>)
   ret <2 x double> %res
@@ -719,7 +719,7 @@ define <2 x double> @fmuladd_nan_and_const_2(<2 x double> %b) {
 
 define <2 x double> @fmuladd_nan_0(<2 x double> %b, <2 x double> %c) {
 ; CHECK-LABEL: @fmuladd_nan_0(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, <2 x double> %b, <2 x double> %c)
   ret <2 x double> %res
@@ -727,7 +727,7 @@ define <2 x double> @fmuladd_nan_0(<2 x double> %b, <2 x double> %c) {
 
 define <2 x double> @fmuladd_nan_1(<2 x double> %b, <2 x double> %c) {
 ; CHECK-LABEL: @fmuladd_nan_1(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> %b, <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, <2 x double> %c)
   ret <2 x double> %res
@@ -735,7 +735,7 @@ define <2 x double> @fmuladd_nan_1(<2 x double> %b, <2 x double> %c) {
 
 define <2 x double> @fmuladd_undef_0(<2 x double> %b, <2 x double> %c) {
 ; CHECK-LABEL: @fmuladd_undef_0(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> <double undef, double undef>, <2 x double> %b, <2 x double> %c)
   ret <2 x double> %res
@@ -743,7 +743,7 @@ define <2 x double> @fmuladd_undef_0(<2 x double> %b, <2 x double> %c) {
 
 define <2 x double> @fmuladd_undef_1(<2 x double> %b, <2 x double> %c) {
 ; CHECK-LABEL: @fmuladd_undef_1(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> %b, <2 x double> <double undef, double undef>, <2 x double> %c)
   ret <2 x double> %res
@@ -751,7 +751,7 @@ define <2 x double> @fmuladd_undef_1(<2 x double> %b, <2 x double> %c) {
 
 define <2 x double> @fmuladd_undef_2(<2 x double> %b, <2 x double> %c) {
 ; CHECK-LABEL: @fmuladd_undef_2(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double nan, double nan>
 ;
   %res = call nnan nsz <2 x double> @llvm.fmuladd.v2f64(<2 x double> %b, <2 x double> %c, <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>)
   ret <2 x double> %res
diff --git a/llvm/test/Transforms/InstCombine/fneg.ll b/llvm/test/Transforms/InstCombine/fneg.ll
index 3c4088832feaaa..89e86426d11873 100644
--- a/llvm/test/Transforms/InstCombine/fneg.ll
+++ b/llvm/test/Transforms/InstCombine/fneg.ll
@@ -91,7 +91,7 @@ define float @fmul_fneg_extra_use(float %x) {
 
 define <4 x double> @fmul_fsub_vec(<4 x double> %x) {
 ; CHECK-LABEL: @fmul_fsub_vec(
-; CHECK-NEXT:    [[R:%.*]] = fmul <4 x double> [[X:%.*]], <double -4.200000e+01, double 0xFFF8000000000000, double 0xFFF0000000000000, double poison>
+; CHECK-NEXT:    [[R:%.*]] = fmul <4 x double> [[X:%.*]], <double -4.200000e+01, double 0xFFF8000000000000, double ninf, double poison>
 ; CHECK-NEXT:    ret <4 x double> [[R]]
 ;
   %m = fmul <4 x double> %x, <double 42.0, double 0x7FF8000000000000, double 0x7FF0000000000000, double poison>
@@ -101,7 +101,7 @@ define <4 x double> @fmul_fsub_vec(<4 x double> %x) {
 
 define <4 x double> @fmul_fneg_vec(<4 x double> %x) {
 ; CHECK-LABEL: @fmul_fneg_vec(
-; CHECK-NEXT:    [[R:%.*]] = fmul <4 x double> [[X:%.*]], <double -4.200000e+01, double 0xFFF8000000000000, double 0xFFF0000000000000, double poison>
+; CHECK-NEXT:    [[R:%.*]] = fmul <4 x double> [[X:%.*]], <double -4.200000e+01, double 0xFFF8000000000000, double ninf, double poison>
 ; CHECK-NEXT:    ret <4 x double> [[R]]
 ;
   %m = fmul <4 x double> %x, <double 42.0, double 0x7FF8000000000000, double 0x7FF0000000000000, double poison>
@@ -185,7 +185,7 @@ define float @fdiv_op1_constant_fneg_extra_use(float %x) {
 
 define <4 x double> @fdiv_op1_constant_fsub_vec(<4 x double> %x) {
 ; CHECK-LABEL: @fdiv_op1_constant_fsub_vec(
-; CHECK-NEXT:    [[R:%.*]] = fdiv <4 x double> [[X:%.*]], <double 4.200000e+01, double 0x7FF800000ABCD000, double 0x7FF0000000000000, double poison>
+; CHECK-NEXT:    [[R:%.*]] = fdiv <4 x double> [[X:%.*]], <double 4.200000e+01, double 0x7FF800000ABCD000, double pinf, double poison>
 ; CHECK-NEXT:    ret <4 x double> [[R]]
 ;
   %d = fdiv <4 x double> %x, <double -42.0, double 0xFFF800000ABCD000, double 0xFFF0000000000000, double poison>
@@ -195,7 +195,7 @@ define <4 x double> @fdiv_op1_constant_fsub_vec(<4 x double> %x) {
 
 define <4 x double> @fdiv_op1_constant_fneg_vec(<4 x double> %x) {
 ; CHECK-LABEL: @fdiv_op1_constant_fneg_vec(
-; CHECK-NEXT:    [[R:%.*]] = fdiv <4 x double> [[X:%.*]], <double 4.200000e+01, double 0x7FF800000ABCD000, double 0x7FF0000000000000, double poison>
+; CHECK-NEXT:    [[R:%.*]] = fdiv <4 x double> [[X:%.*]], <double 4.200000e+01, double 0x7FF800000ABCD000, double pinf, double poison>
 ; CHECK-NEXT:    ret <4 x double> [[R]]
 ;
   %d = fdiv <4 x double> %x, <double -42.0, double 0xFFF800000ABCD000, double 0xFFF0000000000000, double poison>
@@ -339,7 +339,7 @@ define float @fdiv_op0_constant_fneg_extra_use(float %x) {
 
 define <4 x double> @fdiv_op0_constant_fsub_vec(<4 x double> %x) {
 ; CHECK-LABEL: @fdiv_op0_constant_fsub_vec(
-; CHECK-NEXT:    [[R:%.*]] = fdiv <4 x double> <double 4.200000e+01, double 0xFFF8000000000000, double 0x7FF0000000000000, double poison>, [[X:%.*]]
+; CHECK-NEXT:    [[R:%.*]] = fdiv <4 x double> <double 4.200000e+01, double 0xFFF8000000000000, double pinf, double poison>, [[X:%.*]]
 ; CHECK-NEXT:    ret <4 x double> [[R]]
 ;
   %d = fdiv <4 x double> <double -42.0, double 0x7FF8000000000000, double 0xFFF0000000000000, double poison>, %x
@@ -349,7 +349,7 @@ define <4 x double> @fdiv_op0_constant_fsub_vec(<4 x double> %x) {
 
 define <4 x double> @fdiv_op0_constant_fneg_vec(<4 x double> %x) {
 ; CHECK-LABEL: @fdiv_op0_constant_fneg_vec(
-; CHECK-NEXT:    [[R:%.*]] = fdiv <4 x double> <double 4.200000e+01, double 0xFFF8000000000000, double 0x7FF0000000000000, double poison>, [[X:%.*]]
+; CHECK-NEXT:    [[R:%.*]] = fdiv <4 x double> <double 4.200000e+01, double 0xFFF8000000000000, double pinf, double poison>, [[X:%.*]]
 ; CHECK-NEXT:    ret <4 x double> [[R]]
 ;
   %d = fdiv <4 x double> <double -42.0, double 0x7FF8000000000000, double 0xFFF0000000000000, double poison>, %x
diff --git a/llvm/test/Transforms/InstCombine/fold-calls.ll b/llvm/test/Transforms/InstCombine/fold-calls.ll
index 5817fa74506348..bcb8fc89ee1d24 100644
--- a/llvm/test/Transforms/InstCombine/fold-calls.ll
+++ b/llvm/test/Transforms/InstCombine/fold-calls.ll
@@ -2,9 +2,9 @@
 
 ; This shouldn't fold, because sin(inf) is invalid.
 ; CHECK-LABEL: @foo(
-; CHECK:   %t = call double @sin(double 0x7FF0000000000000)
+; CHECK:   %t = call double @sin(double pinf)
 define double @foo() {
-  %t = call double @sin(double 0x7FF0000000000000)
+  %t = call double @sin(double pinf)
   ret double %t
 }
 
diff --git a/llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll b/llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll
index dedd12f8cc7a3d..1c42813e9921da 100644
--- a/llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll
+++ b/llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll
@@ -377,7 +377,7 @@ define float @fmul_by_neg0_if_0_oeq_zero_f32(float %x) {
 define float @fmul_by_neginf_if_0_oeq_zero_f32(float %x) {
 ; CHECK-LABEL: @fmul_by_neginf_if_0_oeq_zero_f32(
 ; CHECK-NEXT:    [[X_IS_ZERO:%.*]] = fcmp oeq float [[X:%.*]], 0.000000e+00
-; CHECK-NEXT:    [[SCALED_X:%.*]] = fmul float [[X]], 0xFFF0000000000000
+; CHECK-NEXT:    [[SCALED_X:%.*]] = fmul float [[X]], ninf
 ; CHECK-NEXT:    [[SCALED_IF_DENORMAL:%.*]] = select i1 [[X_IS_ZERO]], float [[SCALED_X]], float [[X]]
 ; CHECK-NEXT:    ret float [[SCALED_IF_DENORMAL]]
 ;
@@ -390,7 +390,7 @@ define float @fmul_by_neginf_if_0_oeq_zero_f32(float %x) {
 define float @fmul_by_posinf_if_0_oeq_zero_f32(float %x) {
 ; CHECK-LABEL: @fmul_by_posinf_if_0_oeq_zero_f32(
 ; CHECK-NEXT:    [[X_IS_ZERO:%.*]] = fcmp oeq float [[X:%.*]], 0.000000e+00
-; CHECK-NEXT:    [[SCALED_X:%.*]] = fmul float [[X]], 0x7FF0000000000000
+; CHECK-NEXT:    [[SCALED_X:%.*]] = fmul float [[X]], pinf
 ; CHECK-NEXT:    [[SCALED_IF_DENORMAL:%.*]] = select i1 [[X_IS_ZERO]], float [[SCALED_X]], float [[X]]
 ; CHECK-NEXT:    ret float [[SCALED_IF_DENORMAL]]
 ;
@@ -403,7 +403,7 @@ define float @fmul_by_posinf_if_0_oeq_zero_f32(float %x) {
 define float @fmul_by_qnan_if_0_oeq_zero_f32(float %x) {
 ; CHECK-LABEL: @fmul_by_qnan_if_0_oeq_zero_f32(
 ; CHECK-NEXT:    [[X_IS_ZERO:%.*]] = fcmp oeq float [[X:%.*]], 0.000000e+00
-; CHECK-NEXT:    [[SCALED_IF_DENORMAL:%.*]] = select i1 [[X_IS_ZERO]], float 0x7FF8000000000000, float [[X]]
+; CHECK-NEXT:    [[SCALED_IF_DENORMAL:%.*]] = select i1 [[X_IS_ZERO]], float nan, float [[X]]
 ; CHECK-NEXT:    ret float [[SCALED_IF_DENORMAL]]
 ;
   %x.is.zero = fcmp oeq float %x, 0.0
@@ -659,7 +659,7 @@ define float @fmul_by_var_if_0_oeq_zero_f32_fmul_known_never_nan_inf_neg(float %
 define float @fmul_by_var_if_0_oeq_zero_f32_assume_finite_fmul_nsz(float %x, float %y) {
 ; CHECK-LABEL: @fmul_by_var_if_0_oeq_zero_f32_assume_finite_fmul_nsz(
 ; CHECK-NEXT:    [[FABS_Y:%.*]] = call float @llvm.fabs.f32(float [[Y:%.*]])
-; CHECK-NEXT:    [[IS_FINITE:%.*]] = fcmp one float [[FABS_Y]], 0x7FF0000000000000
+; CHECK-NEXT:    [[IS_FINITE:%.*]] = fcmp one float [[FABS_Y]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[IS_FINITE]])
 ; CHECK-NEXT:    ret float [[X:%.*]]
 ;
@@ -676,7 +676,7 @@ define float @fmul_by_var_if_0_oeq_zero_f32_assume_finite_fmul_nsz(float %x, flo
 define float @fmul_by_var_if_not_one_0_zero_f32_assume_finite_fmul_nsz(float %x, float %y) {
 ; CHECK-LABEL: @fmul_by_var_if_not_one_0_zero_f32_assume_finite_fmul_nsz(
 ; CHECK-NEXT:    [[FABS_Y:%.*]] = call float @llvm.fabs.f32(float [[Y:%.*]])
-; CHECK-NEXT:    [[IS_FINITE:%.*]] = fcmp one float [[FABS_Y]], 0x7FF0000000000000
+; CHECK-NEXT:    [[IS_FINITE:%.*]] = fcmp one float [[FABS_Y]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[IS_FINITE]])
 ; CHECK-NEXT:    ret float [[X:%.*]]
 ;
diff --git a/llvm/test/Transforms/InstCombine/fpclass-check-idioms.ll b/llvm/test/Transforms/InstCombine/fpclass-check-idioms.ll
index 4034759df06048..558a1fe093e40b 100644
--- a/llvm/test/Transforms/InstCombine/fpclass-check-idioms.ll
+++ b/llvm/test/Transforms/InstCombine/fpclass-check-idioms.ll
@@ -5,7 +5,7 @@ define i1 @f32_fcnan_fcinf(float %a) {
 ; CHECK-LABEL: define i1 @f32_fcnan_fcinf(
 ; CHECK-SAME: float [[A:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[A]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp ueq float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp ueq float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %i32 = bitcast float %a to i32
@@ -30,7 +30,7 @@ define i1 @f32_not_fcnan_fcinf(float %a) {
 ; CHECK-LABEL: define i1 @f32_not_fcnan_fcinf(
 ; CHECK-SAME: float [[A:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[A]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp one float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp one float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %i32 = bitcast float %a to i32
@@ -55,7 +55,7 @@ define i1 @f64_fcnan_fcinf(double %a) {
 ; CHECK-LABEL: define i1 @f64_fcnan_fcinf(
 ; CHECK-SAME: double [[A:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call double @llvm.fabs.f64(double [[A]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp ueq double [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp ueq double [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %i64 = bitcast double %a to i64
@@ -80,7 +80,7 @@ define i1 @f32_fcinf(float %a) {
 ; CHECK-LABEL: define i1 @f32_fcinf(
 ; CHECK-SAME: float [[A:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[A]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %i32 = bitcast float %a to i32
@@ -104,7 +104,7 @@ define i1 @f32_fcinf_strictfp(float %a) strictfp {
 define i1 @f32_fcposinf(float %a) {
 ; CHECK-LABEL: define i1 @f32_fcposinf(
 ; CHECK-SAME: float [[A:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[A]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[A]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %i32 = bitcast float %a to i32
@@ -126,7 +126,7 @@ define i1 @f32_fcposinf_strictfp(float %a) strictfp {
 define i1 @f32_fcneginf(float %a) {
 ; CHECK-LABEL: define i1 @f32_fcneginf(
 ; CHECK-SAME: float [[A:%.*]]) {
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[A]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[A]], ninf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %i32 = bitcast float %a to i32
@@ -253,7 +253,7 @@ define <2 x i1> @f32_fcnan_fcinf_vec(<2 x float> %a) {
 ; CHECK-LABEL: define <2 x i1> @f32_fcnan_fcinf_vec(
 ; CHECK-SAME: <2 x float> [[A:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[A]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp ueq <2 x float> [[TMP1]], <float 0x7FF0000000000000, float 0x7FF0000000000000>
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp ueq <2 x float> [[TMP1]], <float pinf, float pinf>
 ; CHECK-NEXT:    ret <2 x i1> [[CMP]]
 ;
   %i32 = bitcast <2 x float> %a to <2 x i32>
@@ -278,7 +278,7 @@ define <2 x i1> @f32_fcinf_vec(<2 x float> %a) {
 ; CHECK-LABEL: define <2 x i1> @f32_fcinf_vec(
 ; CHECK-SAME: <2 x float> [[A:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[A]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq <2 x float> [[TMP1]], <float 0x7FF0000000000000, float 0x7FF0000000000000>
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq <2 x float> [[TMP1]], <float pinf, float pinf>
 ; CHECK-NEXT:    ret <2 x i1> [[CMP]]
 ;
   %i32 = bitcast <2 x float> %a to <2 x i32>
@@ -389,7 +389,7 @@ define i1 @f32_fcnan_fcinf_wrong_pred(float %a) {
 ; CHECK-LABEL: define i1 @f32_fcnan_fcinf_wrong_pred(
 ; CHECK-SAME: float [[A:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[A]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp one float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp one float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %i32 = bitcast float %a to i32
@@ -748,7 +748,7 @@ define i1 @isnan_idiom_wrong_pred2(double %x) {
 ; CHECK-LABEL: define i1 @isnan_idiom_wrong_pred2(
 ; CHECK-SAME: double [[X:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call double @llvm.fabs.f64(double [[X]])
-; CHECK-NEXT:    [[RET:%.*]] = fcmp oeq double [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[RET:%.*]] = fcmp oeq double [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[RET]]
 ;
   %bits = bitcast double %x to i64
diff --git a/llvm/test/Transforms/InstCombine/fpclass-from-dom-cond.ll b/llvm/test/Transforms/InstCombine/fpclass-from-dom-cond.ll
index d6706d76056eea..cb30fd29bc9313 100644
--- a/llvm/test/Transforms/InstCombine/fpclass-from-dom-cond.ll
+++ b/llvm/test/Transforms/InstCombine/fpclass-from-dom-cond.ll
@@ -53,7 +53,7 @@ define i1 @test3(float %x) {
 ; CHECK-NEXT:    [[CMP:%.*]] = fcmp ogt float [[X]], 3.000000e+00
 ; CHECK-NEXT:    br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
 ; CHECK:       if.then:
-; CHECK-NEXT:    [[RET:%.*]] = fcmp oeq float [[X]], 0x7FF0000000000000
+; CHECK-NEXT:    [[RET:%.*]] = fcmp oeq float [[X]], pinf
 ; CHECK-NEXT:    ret i1 [[RET]]
 ; CHECK:       if.else:
 ; CHECK-NEXT:    ret i1 false
@@ -134,7 +134,7 @@ define i1 @test6(double %x) {
 ; CHECK-NEXT:    [[CMP:%.*]] = fcmp ogt double [[X]], 0.000000e+00
 ; CHECK-NEXT:    br i1 [[CMP]], label [[LAND_RHS:%.*]], label [[LAND_END:%.*]]
 ; CHECK:       land.rhs:
-; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp oeq double [[X]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp oeq double [[X]], pinf
 ; CHECK-NEXT:    br label [[LAND_END]]
 ; CHECK:       land.end:
 ; CHECK-NEXT:    [[RET:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[CMP_I]], [[LAND_RHS]] ]
@@ -182,7 +182,7 @@ define i1 @test8(float %x) {
 ; CHECK-LABEL: define i1 @test8(
 ; CHECK-SAME: float [[X:%.*]]) {
 ; CHECK-NEXT:    [[ABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; CHECK-NEXT:    [[COND:%.*]] = fcmp oeq float [[ABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[COND:%.*]] = fcmp oeq float [[ABS]], pinf
 ; CHECK-NEXT:    br i1 [[COND]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
 ; CHECK:       if.then:
 ; CHECK-NEXT:    ret i1 true
@@ -248,7 +248,7 @@ define i1 @test11_and(float %x, i1 %cond2) {
 ; CHECK-NEXT:    [[AND:%.*]] = and i1 [[COND]], [[COND2]]
 ; CHECK-NEXT:    br i1 [[AND]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
 ; CHECK:       if.then:
-; CHECK-NEXT:    [[RET1:%.*]] = fcmp oeq float [[X]], 0x7FF0000000000000
+; CHECK-NEXT:    [[RET1:%.*]] = fcmp oeq float [[X]], pinf
 ; CHECK-NEXT:    ret i1 [[RET1]]
 ; CHECK:       if.else:
 ; CHECK-NEXT:    ret i1 false
diff --git a/llvm/test/Transforms/InstCombine/intrinsic-select.ll b/llvm/test/Transforms/InstCombine/intrinsic-select.ll
index f110d7765830ef..ec72ebb8620cf2 100644
--- a/llvm/test/Transforms/InstCombine/intrinsic-select.ll
+++ b/llvm/test/Transforms/InstCombine/intrinsic-select.ll
@@ -284,8 +284,8 @@ entry:
 define double @test_fabs_select1(double %a) {
 ; CHECK-LABEL: @test_fabs_select1(
 ; CHECK-NEXT:    [[COND:%.*]] = fcmp uno double [[A:%.*]], 0.000000e+00
-; CHECK-NEXT:    [[SEL1:%.*]] = select i1 [[COND]], double 0x7FF8000000000000, double [[A]]
-; CHECK-NEXT:    ret double [[SEL1]]
+; CHECK-NEXT:    [[SEL2:%.*]] = select i1 [[COND]], double nan, double [[A]]
+; CHECK-NEXT:    ret double [[SEL2]]
 ;
   %cond = fcmp uno double %a, 0.000000e+00
   %sel1 = select i1 %cond, double 0x7FF8000000000000, double %a
@@ -297,7 +297,7 @@ define double @test_fabs_select1(double %a) {
 define <2 x double> @test_fabs_select1_vec(<2 x double> %a) {
 ; CHECK-LABEL: @test_fabs_select1_vec(
 ; CHECK-NEXT:    [[COND:%.*]] = fcmp uno <2 x double> [[A:%.*]], zeroinitializer
-; CHECK-NEXT:    [[SEL2:%.*]] = select <2 x i1> [[COND]], <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, <2 x double> [[A]]
+; CHECK-NEXT:    [[SEL2:%.*]] = select <2 x i1> [[COND]], <2 x double> <double nan, double nan>, <2 x double> [[A]]
 ; CHECK-NEXT:    ret <2 x double> [[SEL2]]
 ;
   %cond = fcmp uno <2 x double> %a, zeroinitializer
@@ -310,7 +310,7 @@ define <2 x double> @test_fabs_select1_vec(<2 x double> %a) {
 define double @test_fabs_select2(double %a) {
 ; CHECK-LABEL: @test_fabs_select2(
 ; CHECK-NEXT:    [[ABS1:%.*]] = call double @llvm.fabs.f64(double [[A:%.*]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq double [[ABS1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq double [[ABS1]], pinf
 ; CHECK-NEXT:    [[ABS2:%.*]] = select i1 [[CMP]], double 0.000000e+00, double [[ABS1]]
 ; CHECK-NEXT:    ret double [[ABS2]]
 ;
@@ -325,8 +325,8 @@ define double @test_fabs_select2(double %a) {
 
 define double @test_fabs_select_fmf1(i1 %cond, double %a) {
 ; CHECK-LABEL: @test_fabs_select_fmf1(
-; CHECK-NEXT:    [[A:%.*]] = call double @llvm.fabs.f64(double [[A1:%.*]])
-; CHECK-NEXT:    [[FABS:%.*]] = select nnan ninf i1 [[COND:%.*]], double 0.000000e+00, double [[A]]
+; CHECK-NEXT:    [[TMP1:%.*]] = call double @llvm.fabs.f64(double [[A:%.*]])
+; CHECK-NEXT:    [[FABS:%.*]] = select nnan ninf i1 [[COND:%.*]], double 0.000000e+00, double [[TMP1]]
 ; CHECK-NEXT:    ret double [[FABS]]
 ;
   %sel1 = select nnan ninf nsz i1 %cond, double 0.0, double %a
@@ -337,8 +337,8 @@ define double @test_fabs_select_fmf1(i1 %cond, double %a) {
 define double @test_fabs_select_fmf2(i1 %cond, double %a) {
 ; CHECK-LABEL: @test_fabs_select_fmf2(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call double @llvm.fabs.f64(double [[A:%.*]])
-; CHECK-NEXT:    [[SEL1:%.*]] = select nnan ninf nsz i1 [[COND:%.*]], double 0.000000e+00, double [[TMP1]]
-; CHECK-NEXT:    ret double [[SEL1]]
+; CHECK-NEXT:    [[FABS:%.*]] = select nnan ninf nsz i1 [[COND:%.*]], double 0.000000e+00, double [[TMP1]]
+; CHECK-NEXT:    ret double [[FABS]]
 ;
   %sel1 = select i1 %cond, double 0.0, double %a
   %fabs = call nnan ninf nsz double @llvm.fabs.f64(double %sel1)
diff --git a/llvm/test/Transforms/InstCombine/is_fpclass.ll b/llvm/test/Transforms/InstCombine/is_fpclass.ll
index ad0bcd1b0c437c..86e45e1a85ac81 100644
--- a/llvm/test/Transforms/InstCombine/is_fpclass.ll
+++ b/llvm/test/Transforms/InstCombine/is_fpclass.ll
@@ -486,7 +486,7 @@ define <2 x i1> @test_class_is_p0_n0_psub_nsub_v2f32_dynamic(<2 x float> %x) "de
 
 define i1 @test_class_is_pinf_f32(float %x) {
 ; CHECK-LABEL: @test_class_is_pinf_f32(
-; CHECK-NEXT:    [[VAL:%.*]] = fcmp oeq float [[X:%.*]], 0x7FF0000000000000
+; CHECK-NEXT:    [[VAL:%.*]] = fcmp oeq float [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[VAL]]
 ;
   %val = call i1 @llvm.is.fpclass.f32(float %x, i32 512) ; fcPosInf
@@ -495,7 +495,7 @@ define i1 @test_class_is_pinf_f32(float %x) {
 
 define i1 @test_class_is_pinf_or_nan_f32(float %x) {
 ; CHECK-LABEL: @test_class_is_pinf_or_nan_f32(
-; CHECK-NEXT:    [[VAL:%.*]] = fcmp ueq float [[X:%.*]], 0x7FF0000000000000
+; CHECK-NEXT:    [[VAL:%.*]] = fcmp ueq float [[X:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[VAL]]
 ;
   %val = call i1 @llvm.is.fpclass.f32(float %x, i32 515) ; fcPosInf|fcNan
@@ -504,7 +504,7 @@ define i1 @test_class_is_pinf_or_nan_f32(float %x) {
 
 define <2 x i1> @test_class_is_pinf_v2f32(<2 x float> %x) {
 ; CHECK-LABEL: @test_class_is_pinf_v2f32(
-; CHECK-NEXT:    [[VAL:%.*]] = fcmp oeq <2 x float> [[X:%.*]], <float 0x7FF0000000000000, float 0x7FF0000000000000>
+; CHECK-NEXT:    [[VAL:%.*]] = fcmp oeq <2 x float> [[X:%.*]], <float pinf, float pinf>
 ; CHECK-NEXT:    ret <2 x i1> [[VAL]]
 ;
   %val = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %x, i32 512) ; fcPosInf
@@ -513,7 +513,7 @@ define <2 x i1> @test_class_is_pinf_v2f32(<2 x float> %x) {
 
 define i1 @test_class_is_ninf_f32(float %x) {
 ; CHECK-LABEL: @test_class_is_ninf_f32(
-; CHECK-NEXT:    [[VAL:%.*]] = fcmp oeq float [[X:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[VAL:%.*]] = fcmp oeq float [[X:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[VAL]]
 ;
   %val = call i1 @llvm.is.fpclass.f32(float %x, i32 4) ; fcNegInf
@@ -522,7 +522,7 @@ define i1 @test_class_is_ninf_f32(float %x) {
 
 define i1 @test_class_is_ninf_or_nan_f32(float %x) {
 ; CHECK-LABEL: @test_class_is_ninf_or_nan_f32(
-; CHECK-NEXT:    [[VAL:%.*]] = fcmp ueq float [[X:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[VAL:%.*]] = fcmp ueq float [[X:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[VAL]]
 ;
   %val = call i1 @llvm.is.fpclass.f32(float %x, i32 7) ; fcNegInf|fcNan
@@ -531,7 +531,7 @@ define i1 @test_class_is_ninf_or_nan_f32(float %x) {
 
 define <2 x i1> @test_class_is_ninf_v2f32(<2 x float> %x) {
 ; CHECK-LABEL: @test_class_is_ninf_v2f32(
-; CHECK-NEXT:    [[VAL:%.*]] = fcmp oeq <2 x float> [[X:%.*]], <float 0xFFF0000000000000, float 0xFFF0000000000000>
+; CHECK-NEXT:    [[VAL:%.*]] = fcmp oeq <2 x float> [[X:%.*]], <float ninf, float ninf>
 ; CHECK-NEXT:    ret <2 x i1> [[VAL]]
 ;
   %val = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %x, i32 4) ; fcNegInf
@@ -541,7 +541,7 @@ define <2 x i1> @test_class_is_ninf_v2f32(<2 x float> %x) {
 define i1 @test_class_is_inf_f32(float %x) {
 ; CHECK-LABEL: @test_class_is_inf_f32(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
-; CHECK-NEXT:    [[VAL:%.*]] = fcmp oeq float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[VAL:%.*]] = fcmp oeq float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[VAL]]
 ;
   %val = call i1 @llvm.is.fpclass.f32(float %x, i32 516) ; fcInf
@@ -551,7 +551,7 @@ define i1 @test_class_is_inf_f32(float %x) {
 define <2 x i1> @test_class_is_inf_v2f32(<2 x float> %x) {
 ; CHECK-LABEL: @test_class_is_inf_v2f32(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[X:%.*]])
-; CHECK-NEXT:    [[VAL:%.*]] = fcmp oeq <2 x float> [[TMP1]], <float 0x7FF0000000000000, float 0x7FF0000000000000>
+; CHECK-NEXT:    [[VAL:%.*]] = fcmp oeq <2 x float> [[TMP1]], <float pinf, float pinf>
 ; CHECK-NEXT:    ret <2 x i1> [[VAL]]
 ;
   %val = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %x, i32 516) ; fcInf
@@ -561,7 +561,7 @@ define <2 x i1> @test_class_is_inf_v2f32(<2 x float> %x) {
 define i1 @test_class_is_inf_or_nan_f32(float %x) {
 ; CHECK-LABEL: @test_class_is_inf_or_nan_f32(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
-; CHECK-NEXT:    [[VAL:%.*]] = fcmp ueq float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[VAL:%.*]] = fcmp ueq float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[VAL]]
 ;
   %val = call i1 @llvm.is.fpclass.f32(float %x, i32 519) ; fcInf|fcNan
@@ -953,7 +953,7 @@ define i1 @test_class_not_is_nan_multi_use(float %x, ptr %ptr) {
 define i1 @test_class_not_is_inf_nan(float %x) {
 ; CHECK-LABEL: @test_class_not_is_inf_nan(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp one float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp one float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %class = call i1 @llvm.is.fpclass.f32(float %x, i32 519)
@@ -1019,7 +1019,7 @@ define i1 @test_fold_or_class_f32_0(float %a) {
 
 define i1 @test_fold_or3_class_f32_0(float %a) {
 ; CHECK-LABEL: @test_fold_or3_class_f32_0(
-; CHECK-NEXT:    [[OR_1:%.*]] = fcmp ueq float [[A:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[OR_1:%.*]] = fcmp ueq float [[A:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[OR_1]]
 ;
   %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 1)
@@ -1069,7 +1069,7 @@ define i1 @test_fold_or_class_f32_1(float %a) {
 
 define i1 @test_no_fold_or_class_f32_multi_use0(float %a, ptr %ptr) {
 ; CHECK-LABEL: @test_no_fold_or_class_f32_multi_use0(
-; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp oeq float [[A:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp oeq float [[A:%.*]], ninf
 ; CHECK-NEXT:    store i1 [[CLASS0]], ptr [[PTR:%.*]], align 1
 ; CHECK-NEXT:    [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 8)
 ; CHECK-NEXT:    [[OR:%.*]] = or i1 [[CLASS0]], [[CLASS1]]
@@ -1084,7 +1084,7 @@ define i1 @test_no_fold_or_class_f32_multi_use0(float %a, ptr %ptr) {
 
 define i1 @test_no_fold_or_class_f32_multi_use1(float %a, ptr %ptr) {
 ; CHECK-LABEL: @test_no_fold_or_class_f32_multi_use1(
-; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp oeq float [[A:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp oeq float [[A:%.*]], ninf
 ; CHECK-NEXT:    [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 8)
 ; CHECK-NEXT:    store i1 [[CLASS1]], ptr [[PTR:%.*]], align 1
 ; CHECK-NEXT:    [[OR:%.*]] = or i1 [[CLASS0]], [[CLASS1]]
@@ -1099,7 +1099,7 @@ define i1 @test_no_fold_or_class_f32_multi_use1(float %a, ptr %ptr) {
 
 define i1 @test_fold_or_class_f32_2(float %a) {
 ; CHECK-LABEL: @test_fold_or_class_f32_2(
-; CHECK-NEXT:    [[OR:%.*]] = fcmp ueq float [[A:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[OR:%.*]] = fcmp ueq float [[A:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[OR]]
 ;
   %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 7)
@@ -1110,7 +1110,7 @@ define i1 @test_fold_or_class_f32_2(float %a) {
 
 define i1 @test_no_fold_or_class_f32_0(float %a, float %b) {
 ; CHECK-LABEL: @test_no_fold_or_class_f32_0(
-; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp oeq float [[A:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp oeq float [[A:%.*]], ninf
 ; CHECK-NEXT:    [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[B:%.*]], i32 8)
 ; CHECK-NEXT:    [[OR:%.*]] = or i1 [[CLASS0]], [[CLASS1]]
 ; CHECK-NEXT:    ret i1 [[OR]]
@@ -1254,7 +1254,7 @@ define i1 @test_no_fold_and_class_f32_multi_use1(float %a, ptr %ptr) {
 
 define i1 @test_fold_and_class_f32_2(float %a) {
 ; CHECK-LABEL: @test_fold_and_class_f32_2(
-; CHECK-NEXT:    [[AND:%.*]] = fcmp ueq float [[A:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[AND:%.*]] = fcmp ueq float [[A:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[AND]]
 ;
   %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 7)
@@ -1287,7 +1287,7 @@ define i1 @test_fold_and_class_f32_4(float %a) {
 
 define i1 @test_no_fold_and_class_f32_0(float %a, float %b) {
 ; CHECK-LABEL: @test_no_fold_and_class_f32_0(
-; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp ueq float [[A:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp ueq float [[A:%.*]], ninf
 ; CHECK-NEXT:    [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[B:%.*]], i32 15)
 ; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CLASS0]], [[CLASS1]]
 ; CHECK-NEXT:    ret i1 [[AND]]
@@ -1300,7 +1300,7 @@ define i1 @test_no_fold_and_class_f32_0(float %a, float %b) {
 
 define <2 x i1> @test_fold_and_class_v2f32(<2 x float> %a) {
 ; CHECK-LABEL: @test_fold_and_class_v2f32(
-; CHECK-NEXT:    [[CLASS1:%.*]] = fcmp ueq <2 x float> [[A:%.*]], <float 0xFFF0000000000000, float 0xFFF0000000000000>
+; CHECK-NEXT:    [[CLASS1:%.*]] = fcmp ueq <2 x float> [[A:%.*]], <float ninf, float ninf>
 ; CHECK-NEXT:    ret <2 x i1> [[CLASS1]]
 ;
   %class0 = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> %a, i32 7)
@@ -1326,7 +1326,7 @@ define i1 @test_fold_xor_class_f32_0(float %a) {
 
 define i1 @test_fold_xor3_class_f32_0(float %a) {
 ; CHECK-LABEL: @test_fold_xor3_class_f32_0(
-; CHECK-NEXT:    [[XOR_1:%.*]] = fcmp ueq float [[A:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[XOR_1:%.*]] = fcmp ueq float [[A:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[XOR_1]]
 ;
   %class0 = call i1 @llvm.is.fpclass.f32(float %a, i32 1)
@@ -1376,7 +1376,7 @@ define i1 @test_fold_xor_class_f32_1(float %a) {
 
 define i1 @test_no_fold_xor_class_f32_multi_use0(float %a, ptr %ptr) {
 ; CHECK-LABEL: @test_no_fold_xor_class_f32_multi_use0(
-; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp oeq float [[A:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp oeq float [[A:%.*]], ninf
 ; CHECK-NEXT:    store i1 [[CLASS0]], ptr [[PTR:%.*]], align 1
 ; CHECK-NEXT:    [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 8)
 ; CHECK-NEXT:    [[XOR:%.*]] = xor i1 [[CLASS0]], [[CLASS1]]
@@ -1391,7 +1391,7 @@ define i1 @test_no_fold_xor_class_f32_multi_use0(float %a, ptr %ptr) {
 
 define i1 @test_no_fold_xor_class_f32_multi_use1(float %a, ptr %ptr) {
 ; CHECK-LABEL: @test_no_fold_xor_class_f32_multi_use1(
-; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp oeq float [[A:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp oeq float [[A:%.*]], ninf
 ; CHECK-NEXT:    [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[A]], i32 8)
 ; CHECK-NEXT:    store i1 [[CLASS1]], ptr [[PTR:%.*]], align 1
 ; CHECK-NEXT:    [[XOR:%.*]] = xor i1 [[CLASS0]], [[CLASS1]]
@@ -1416,7 +1416,7 @@ define i1 @test_fold_xor_class_f32_2(float %a) {
 
 define i1 @test_no_fold_xor_class_f32_0(float %a, float %b) {
 ; CHECK-LABEL: @test_no_fold_xor_class_f32_0(
-; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp oeq float [[A:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CLASS0:%.*]] = fcmp oeq float [[A:%.*]], ninf
 ; CHECK-NEXT:    [[CLASS1:%.*]] = call i1 @llvm.is.fpclass.f32(float [[B:%.*]], i32 8)
 ; CHECK-NEXT:    [[XOR:%.*]] = xor i1 [[CLASS0]], [[CLASS1]]
 ; CHECK-NEXT:    ret i1 [[XOR]]
@@ -1487,7 +1487,7 @@ define i1 @test_class_fneg_qnan(float %arg) {
 ; -> posinf
 define i1 @test_class_fneg_neginf(float %arg) {
 ; CHECK-LABEL: @test_class_fneg_neginf(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq float [[ARG:%.*]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq float [[ARG:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %fneg = fneg float %arg
@@ -1564,7 +1564,7 @@ define i1 @test_class_fneg_posnormal(float %arg) {
 ; -> neginf
 define i1 @test_class_fneg_posinf(float %arg) {
 ; CHECK-LABEL: @test_class_fneg_posinf(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq float [[ARG:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq float [[ARG:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %fneg = fneg float %arg
@@ -1898,7 +1898,7 @@ define i1 @test_class_fabs_posnormal(float %arg) {
 define i1 @test_class_fabs_posinf(float %arg) {
 ; CHECK-LABEL: @test_class_fabs_posinf(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[ARG:%.*]])
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %fabs = call float @llvm.fabs.f32(float %arg)
@@ -2156,7 +2156,7 @@ define i1 @test_class_fneg_fabs_qnan(float %arg) {
 define i1 @test_class_fneg_fabs_neginf(float %arg) {
 ; CHECK-LABEL: @test_class_fneg_fabs_neginf(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[ARG:%.*]])
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %fabs = call float @llvm.fabs.f32(float %arg)
@@ -2530,7 +2530,7 @@ define i1 @test_class_is_normal_or_zero_nozero_src(float nofpclass(zero) %arg) {
 define i1 @test_class_is_inf_or_nan_nozero_src(float nofpclass(zero) %arg) {
 ; CHECK-LABEL: @test_class_is_inf_or_nan_nozero_src(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[ARG:%.*]])
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp ueq float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp ueq float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %class = call i1 @llvm.is.fpclass.f32(float %arg, i32 519)
@@ -2540,7 +2540,7 @@ define i1 @test_class_is_inf_or_nan_nozero_src(float nofpclass(zero) %arg) {
 define i1 @test_class_is_inf_or_nan_noinf_src(float nofpclass(inf) %arg) {
 ; CHECK-LABEL: @test_class_is_inf_or_nan_noinf_src(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[ARG:%.*]])
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp ueq float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp ueq float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %class = call i1 @llvm.is.fpclass.f32(float %arg, i32 519)
@@ -2550,7 +2550,7 @@ define i1 @test_class_is_inf_or_nan_noinf_src(float nofpclass(inf) %arg) {
 define i1 @test_class_is_inf_or_nan_nonan_src(float nofpclass(nan) %arg) {
 ; CHECK-LABEL: @test_class_is_inf_or_nan_nonan_src(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[ARG:%.*]])
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp ueq float [[TMP1]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp ueq float [[TMP1]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %class = call i1 @llvm.is.fpclass.f32(float %arg, i32 519)
@@ -2568,7 +2568,7 @@ define i1 @test_class_is_normal_or_subnormal_noinf_src(float nofpclass(inf) %arg
 
 define i1 @test_class_is_neginf_or_nopinf_src(float nofpclass(pinf) %arg) {
 ; CHECK-LABEL: @test_class_is_neginf_or_nopinf_src(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq float [[ARG:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq float [[ARG:%.*]], ninf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %class = call i1 @llvm.is.fpclass.f32(float %arg, i32 4)
@@ -2593,7 +2593,7 @@ define i1 @test_class_is_neginf_noinf_src(float nofpclass(inf) %arg) {
 
 define i1 @test_class_is_posinf_noninf_src(float nofpclass(ninf) %arg) {
 ; CHECK-LABEL: @test_class_is_posinf_noninf_src(
-; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq float [[ARG:%.*]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CLASS:%.*]] = fcmp oeq float [[ARG:%.*]], pinf
 ; CHECK-NEXT:    ret i1 [[CLASS]]
 ;
   %class = call i1 @llvm.is.fpclass.f32(float %arg, i32 512)
@@ -2740,7 +2740,7 @@ define i1 @test_class_is_nan_assume_uno(float %x) {
 
 define i1 @test_class_is_nan_assume_not_eq_pinf(float %x) {
 ; CHECK-LABEL: @test_class_is_nan_assume_not_eq_pinf(
-; CHECK-NEXT:    [[ORD:%.*]] = fcmp oeq float [[X:%.*]], 0x7FF0000000000000
+; CHECK-NEXT:    [[ORD:%.*]] = fcmp oeq float [[X:%.*]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[ORD]])
 ; CHECK-NEXT:    ret i1 false
 ;
diff --git a/llvm/test/Transforms/InstCombine/known-bits.ll b/llvm/test/Transforms/InstCombine/known-bits.ll
index c7445a6ce2fe24..ddfc3157a6e150 100644
--- a/llvm/test/Transforms/InstCombine/known-bits.ll
+++ b/llvm/test/Transforms/InstCombine/known-bits.ll
@@ -1509,7 +1509,7 @@ define i32 @test_inf_zero_only(float nofpclass(nan norm sub) %x) {
 ; Make sure that the signbit is cleared.
 define i32 @test_ninf_only(double %x) {
 ; CHECK-LABEL: @test_ninf_only(
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq double [[X:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq double [[X:%.*]], ninf
 ; CHECK-NEXT:    br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
 ; CHECK:       if.then:
 ; CHECK-NEXT:    ret i32 0
@@ -1614,7 +1614,7 @@ if.else:
 define i1 @test_simplify_icmp2(double %x) {
 ; CHECK-LABEL: @test_simplify_icmp2(
 ; CHECK-NEXT:    [[ABS:%.*]] = tail call double @llvm.fabs.f64(double [[X:%.*]])
-; CHECK-NEXT:    [[COND:%.*]] = fcmp oeq double [[ABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[COND:%.*]] = fcmp oeq double [[ABS]], pinf
 ; CHECK-NEXT:    br i1 [[COND]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
 ; CHECK:       if.then:
 ; CHECK-NEXT:    [[CAST:%.*]] = bitcast double [[X]] to i64
diff --git a/llvm/test/Transforms/InstCombine/maximum.ll b/llvm/test/Transforms/InstCombine/maximum.ll
index 7455d3b7b924cc..858fbb40d3ce7a 100644
--- a/llvm/test/Transforms/InstCombine/maximum.ll
+++ b/llvm/test/Transforms/InstCombine/maximum.ll
@@ -26,7 +26,7 @@ define float @constant_fold_maximum_f32_inv() {
 
 define float @constant_fold_maximum_f32_nan0() {
 ; CHECK-LABEL: @constant_fold_maximum_f32_nan0(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %x = call float @llvm.maximum.f32(float 0x7FF8000000000000, float 2.0)
   ret float %x
@@ -34,7 +34,7 @@ define float @constant_fold_maximum_f32_nan0() {
 
 define float @constant_fold_maximum_f32_nan1() {
 ; CHECK-LABEL: @constant_fold_maximum_f32_nan1(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %x = call float @llvm.maximum.f32(float 2.0, float 0x7FF8000000000000)
   ret float %x
@@ -42,7 +42,7 @@ define float @constant_fold_maximum_f32_nan1() {
 
 define float @constant_fold_maximum_f32_nan_nan() {
 ; CHECK-LABEL: @constant_fold_maximum_f32_nan_nan(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %x = call float @llvm.maximum.f32(float 0x7FF8000000000000, float 0x7FF8000000000000)
   ret float %x
@@ -98,7 +98,7 @@ define double @constant_fold_maximum_f64() {
 
 define double @constant_fold_maximum_f64_nan0() {
 ; CHECK-LABEL: @constant_fold_maximum_f64_nan0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %x = call double @llvm.maximum.f64(double 0x7FF8000000000000, double 2.0)
   ret double %x
@@ -106,7 +106,7 @@ define double @constant_fold_maximum_f64_nan0() {
 
 define double @constant_fold_maximum_f64_nan1() {
 ; CHECK-LABEL: @constant_fold_maximum_f64_nan1(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %x = call double @llvm.maximum.f64(double 2.0, double 0x7FF8000000000000)
   ret double %x
@@ -114,7 +114,7 @@ define double @constant_fold_maximum_f64_nan1() {
 
 define double @constant_fold_maximum_f64_nan_nan() {
 ; CHECK-LABEL: @constant_fold_maximum_f64_nan_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %x = call double @llvm.maximum.f64(double 0x7FF8000000000000, double 0x7FF8000000000000)
   ret double %x
@@ -131,7 +131,7 @@ define float @canonicalize_constant_maximum_f32(float %x) {
 
 define float @maximum_f32_nan_val(float %x) {
 ; CHECK-LABEL: @maximum_f32_nan_val(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %y = call float @llvm.maximum.f32(float 0x7FF8000000000000, float %x)
   ret float %y
@@ -139,7 +139,7 @@ define float @maximum_f32_nan_val(float %x) {
 
 define float @maximum_f32_val_nan(float %x) {
 ; CHECK-LABEL: @maximum_f32_val_nan(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %y = call float @llvm.maximum.f32(float %x, float 0x7FF8000000000000)
   ret float %y
diff --git a/llvm/test/Transforms/InstCombine/maxnum.ll b/llvm/test/Transforms/InstCombine/maxnum.ll
index f26a5300febd85..b000dbfb434366 100644
--- a/llvm/test/Transforms/InstCombine/maxnum.ll
+++ b/llvm/test/Transforms/InstCombine/maxnum.ll
@@ -42,7 +42,7 @@ define float @constant_fold_maxnum_f32_nan1() {
 
 define float @constant_fold_maxnum_f32_nan_nan() {
 ; CHECK-LABEL: @constant_fold_maxnum_f32_nan_nan(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %x = call float @llvm.maxnum.f32(float 0x7FF8000000000000, float 0x7FF8000000000000)
   ret float %x
@@ -114,7 +114,7 @@ define double @constant_fold_maxnum_f64_nan1() {
 
 define double @constant_fold_maxnum_f64_nan_nan() {
 ; CHECK-LABEL: @constant_fold_maxnum_f64_nan_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %x = call double @llvm.maxnum.f64(double 0x7FF8000000000000, double 0x7FF8000000000000)
   ret double %x
diff --git a/llvm/test/Transforms/InstCombine/minimum.ll b/llvm/test/Transforms/InstCombine/minimum.ll
index eb6eadf96e1323..c927207ac1c8d4 100644
--- a/llvm/test/Transforms/InstCombine/minimum.ll
+++ b/llvm/test/Transforms/InstCombine/minimum.ll
@@ -28,7 +28,7 @@ define float @constant_fold_minimum_f32_inv() {
 
 define float @constant_fold_minimum_f32_nan0() {
 ; CHECK-LABEL: @constant_fold_minimum_f32_nan0(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %x = call float @llvm.minimum.f32(float 0x7FF8000000000000, float 2.0)
   ret float %x
@@ -36,7 +36,7 @@ define float @constant_fold_minimum_f32_nan0() {
 
 define float @constant_fold_minimum_f32_nan1() {
 ; CHECK-LABEL: @constant_fold_minimum_f32_nan1(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %x = call float @llvm.minimum.f32(float 2.0, float 0x7FF8000000000000)
   ret float %x
@@ -44,7 +44,7 @@ define float @constant_fold_minimum_f32_nan1() {
 
 define float @constant_fold_minimum_f32_nan_nan() {
 ; CHECK-LABEL: @constant_fold_minimum_f32_nan_nan(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %x = call float @llvm.minimum.f32(float 0x7FF8000000000000, float 0x7FF8000000000000)
   ret float %x
@@ -100,7 +100,7 @@ define double @constant_fold_minimum_f64() {
 
 define double @constant_fold_minimum_f64_nan0() {
 ; CHECK-LABEL: @constant_fold_minimum_f64_nan0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %x = call double @llvm.minimum.f64(double 0x7FF8000000000000, double 2.0)
   ret double %x
@@ -108,7 +108,7 @@ define double @constant_fold_minimum_f64_nan0() {
 
 define double @constant_fold_minimum_f64_nan1() {
 ; CHECK-LABEL: @constant_fold_minimum_f64_nan1(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %x = call double @llvm.minimum.f64(double 2.0, double 0x7FF8000000000000)
   ret double %x
@@ -116,7 +116,7 @@ define double @constant_fold_minimum_f64_nan1() {
 
 define double @constant_fold_minimum_f64_nan_nan() {
 ; CHECK-LABEL: @constant_fold_minimum_f64_nan_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %x = call double @llvm.minimum.f64(double 0x7FF8000000000000, double 0x7FF8000000000000)
   ret double %x
@@ -133,7 +133,7 @@ define float @canonicalize_constant_minimum_f32(float %x) {
 
 define float @minimum_f32_nan_val(float %x) {
 ; CHECK-LABEL: @minimum_f32_nan_val(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %y = call float @llvm.minimum.f32(float 0x7FF8000000000000, float %x)
   ret float %y
@@ -141,7 +141,7 @@ define float @minimum_f32_nan_val(float %x) {
 
 define float @minimum_f32_val_nan(float %x) {
 ; CHECK-LABEL: @minimum_f32_val_nan(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %y = call float @llvm.minimum.f32(float %x, float 0x7FF8000000000000)
   ret float %y
diff --git a/llvm/test/Transforms/InstCombine/minnum.ll b/llvm/test/Transforms/InstCombine/minnum.ll
index cc6171b9d8e6cb..749a9694cecb1b 100644
--- a/llvm/test/Transforms/InstCombine/minnum.ll
+++ b/llvm/test/Transforms/InstCombine/minnum.ll
@@ -44,7 +44,7 @@ define float @constant_fold_minnum_f32_nan1() {
 
 define float @constant_fold_minnum_f32_nan_nan() {
 ; CHECK-LABEL: @constant_fold_minnum_f32_nan_nan(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %x = call float @llvm.minnum.f32(float 0x7FF8000000000000, float 0x7FF8000000000000)
   ret float %x
@@ -116,7 +116,7 @@ define double @constant_fold_minnum_f64_nan1() {
 
 define double @constant_fold_minnum_f64_nan_nan() {
 ; CHECK-LABEL: @constant_fold_minnum_f64_nan_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %x = call double @llvm.minnum.f64(double 0x7FF8000000000000, double 0x7FF8000000000000)
   ret double %x
diff --git a/llvm/test/Transforms/InstCombine/nan.ll b/llvm/test/Transforms/InstCombine/nan.ll
index 09ebfc715babeb..cf07dcf6a3a812 100644
--- a/llvm/test/Transforms/InstCombine/nan.ll
+++ b/llvm/test/Transforms/InstCombine/nan.ll
@@ -7,7 +7,7 @@
 
 define double @nan_empty() {
 ; CHECK-LABEL: define double @nan_empty() {
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %res = call double @nan(ptr @empty)
   ret double %res
@@ -31,7 +31,7 @@ define double @nan_hex() {
 
 define float @nanf_empty() {
 ; CHECK-LABEL: define float @nanf_empty() {
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %res = call float @nanf(ptr @empty)
   ret float %res
diff --git a/llvm/test/Transforms/InstCombine/nanl-fp128.ll b/llvm/test/Transforms/InstCombine/nanl-fp128.ll
index 21ba0fb14ca209..d8358e7bc7c2cc 100644
--- a/llvm/test/Transforms/InstCombine/nanl-fp128.ll
+++ b/llvm/test/Transforms/InstCombine/nanl-fp128.ll
@@ -7,7 +7,7 @@
 
 define fp128 @nanl_empty() {
 ; CHECK-LABEL: define fp128 @nanl_empty() {
-; CHECK-NEXT:    ret fp128 0xL00000000000000007FFF800000000000
+; CHECK-NEXT:    ret fp128 nan
 ;
   %res = call fp128 @nanl(ptr @empty)
   ret fp128 %res
diff --git a/llvm/test/Transforms/InstCombine/nanl-fp80.ll b/llvm/test/Transforms/InstCombine/nanl-fp80.ll
index 7868af3696a560..b145228a5d59a8 100644
--- a/llvm/test/Transforms/InstCombine/nanl-fp80.ll
+++ b/llvm/test/Transforms/InstCombine/nanl-fp80.ll
@@ -7,7 +7,7 @@
 
 define x86_fp80 @nanl_empty() {
 ; CHECK-LABEL: define x86_fp80 @nanl_empty() {
-; CHECK-NEXT:    ret x86_fp80 0xK7FFFC000000000000000
+; CHECK-NEXT:    ret x86_fp80 nan
 ;
   %res = call x86_fp80 @nanl(ptr @empty)
   ret x86_fp80 %res
diff --git a/llvm/test/Transforms/InstCombine/nanl-ppc-fp128.ll b/llvm/test/Transforms/InstCombine/nanl-ppc-fp128.ll
index 7f60a379c48854..25f38e4e3ce667 100644
--- a/llvm/test/Transforms/InstCombine/nanl-ppc-fp128.ll
+++ b/llvm/test/Transforms/InstCombine/nanl-ppc-fp128.ll
@@ -7,7 +7,7 @@
 
 define ppc_fp128 @nanl_empty() {
 ; CHECK-LABEL: define ppc_fp128 @nanl_empty() {
-; CHECK-NEXT:    ret ppc_fp128 0xM7FF80000000000000000000000000000
+; CHECK-NEXT:    ret ppc_fp128 nan
 ;
   %res = call ppc_fp128 @nanl(ptr @empty)
   ret ppc_fp128 %res
diff --git a/llvm/test/Transforms/InstCombine/pow-1.ll b/llvm/test/Transforms/InstCombine/pow-1.ll
index 44802f9caa6ea5..668cbf810d5407 100644
--- a/llvm/test/Transforms/InstCombine/pow-1.ll
+++ b/llvm/test/Transforms/InstCombine/pow-1.ll
@@ -699,7 +699,7 @@ define float @powf_libcall_half_assume_ninf_noerrno(float %x) {
 ; ANY-LABEL: define float @powf_libcall_half_assume_ninf_noerrno(
 ; ANY-SAME: float [[X:%.*]]) {
 ; ANY-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; ANY-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
+; ANY-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[FABS]], pinf
 ; ANY-NEXT:    call void @llvm.assume(i1 [[NOT_INF]])
 ; ANY-NEXT:    [[SQRT:%.*]] = call float @llvm.sqrt.f32(float [[X]])
 ; ANY-NEXT:    [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRT]])
@@ -708,7 +708,7 @@ define float @powf_libcall_half_assume_ninf_noerrno(float %x) {
 ; VC32-LABEL: define float @powf_libcall_half_assume_ninf_noerrno(
 ; VC32-SAME: float [[X:%.*]]) {
 ; VC32-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; VC32-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
+; VC32-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[FABS]], pinf
 ; VC32-NEXT:    call void @llvm.assume(i1 [[NOT_INF]])
 ; VC32-NEXT:    [[RETVAL:%.*]] = call float @powf(float [[X]], float 5.000000e-01) #[[ATTR2]]
 ; VC32-NEXT:    ret float [[RETVAL]]
@@ -716,7 +716,7 @@ define float @powf_libcall_half_assume_ninf_noerrno(float %x) {
 ; VC51-LABEL: define float @powf_libcall_half_assume_ninf_noerrno(
 ; VC51-SAME: float [[X:%.*]]) {
 ; VC51-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; VC51-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
+; VC51-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[FABS]], pinf
 ; VC51-NEXT:    call void @llvm.assume(i1 [[NOT_INF]])
 ; VC51-NEXT:    [[RETVAL:%.*]] = call float @powf(float [[X]], float 5.000000e-01) #[[ATTR2]]
 ; VC51-NEXT:    ret float [[RETVAL]]
@@ -724,7 +724,7 @@ define float @powf_libcall_half_assume_ninf_noerrno(float %x) {
 ; VC64-LABEL: define float @powf_libcall_half_assume_ninf_noerrno(
 ; VC64-SAME: float [[X:%.*]]) {
 ; VC64-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; VC64-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
+; VC64-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[FABS]], pinf
 ; VC64-NEXT:    call void @llvm.assume(i1 [[NOT_INF]])
 ; VC64-NEXT:    [[SQRT:%.*]] = call float @llvm.sqrt.f32(float [[X]])
 ; VC64-NEXT:    [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRT]])
@@ -733,7 +733,7 @@ define float @powf_libcall_half_assume_ninf_noerrno(float %x) {
 ; VC83-LABEL: define float @powf_libcall_half_assume_ninf_noerrno(
 ; VC83-SAME: float [[X:%.*]]) {
 ; VC83-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; VC83-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
+; VC83-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[FABS]], pinf
 ; VC83-NEXT:    call void @llvm.assume(i1 [[NOT_INF]])
 ; VC83-NEXT:    [[SQRT:%.*]] = call float @llvm.sqrt.f32(float [[X]])
 ; VC83-NEXT:    [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRT]])
@@ -742,7 +742,7 @@ define float @powf_libcall_half_assume_ninf_noerrno(float %x) {
 ; NOLIB-LABEL: define float @powf_libcall_half_assume_ninf_noerrno(
 ; NOLIB-SAME: float [[X:%.*]]) {
 ; NOLIB-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; NOLIB-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
+; NOLIB-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[FABS]], pinf
 ; NOLIB-NEXT:    call void @llvm.assume(i1 [[NOT_INF]])
 ; NOLIB-NEXT:    [[RETVAL:%.*]] = call float @powf(float [[X]], float 5.000000e-01) #[[ATTR2]]
 ; NOLIB-NEXT:    ret float [[RETVAL]]
@@ -867,8 +867,8 @@ define double @pow_libcall_half_no_FMF_noerrno(double %x) {
 ; LIB-SAME: double [[X:%.*]]) {
 ; LIB-NEXT:    [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X]])
 ; LIB-NEXT:    [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]])
-; LIB-NEXT:    [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000
-; LIB-NEXT:    [[RETVAL:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]]
+; LIB-NEXT:    [[ISINF:%.*]] = fcmp oeq double [[X]], ninf
+; LIB-NEXT:    [[RETVAL:%.*]] = select i1 [[ISINF]], double pinf, double [[ABS]]
 ; LIB-NEXT:    ret double [[RETVAL]]
 ;
 ; NOLIB-LABEL: define double @pow_libcall_half_no_FMF_noerrno(
@@ -885,7 +885,7 @@ define double @pow_libcall_half_no_FMF_noerrno(double %x) {
 define float @test_simplify9(float %x) {
 ; CHECK-LABEL: define float @test_simplify9(
 ; CHECK-SAME: float [[X:%.*]]) {
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %retval = call float @llvm.pow.f32(float 0xFFF0000000000000, float 0.5)
   ret float %retval
@@ -894,7 +894,7 @@ define float @test_simplify9(float %x) {
 define double @test_simplify10(double %x) {
 ; CHECK-LABEL: define double @test_simplify10(
 ; CHECK-SAME: double [[X:%.*]]) {
-; CHECK-NEXT:    ret double 0x7FF0000000000000
+; CHECK-NEXT:    ret double pinf
 ;
   %retval = call double @llvm.pow.f64(double 0xFFF0000000000000, double 0.5)
   ret double %retval
@@ -1333,8 +1333,8 @@ define double @pow_intrinsic_half_no_FMF(double %x) {
 ; CHECK-SAME: double [[X:%.*]]) {
 ; CHECK-NEXT:    [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X]])
 ; CHECK-NEXT:    [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]])
-; CHECK-NEXT:    [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000
-; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]]
+; CHECK-NEXT:    [[ISINF:%.*]] = fcmp oeq double [[X]], ninf
+; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[ISINF]], double pinf, double [[ABS]]
 ; CHECK-NEXT:    ret double [[RETVAL]]
 ;
   %retval = call double @llvm.pow.f64(double %x, double 0.5)
diff --git a/llvm/test/Transforms/InstCombine/pow-3.ll b/llvm/test/Transforms/InstCombine/pow-3.ll
index 20d8afbe755d7c..3cdde7d5dc8e5f 100644
--- a/llvm/test/Transforms/InstCombine/pow-3.ll
+++ b/llvm/test/Transforms/InstCombine/pow-3.ll
@@ -17,8 +17,8 @@ define double @sqrt_intrinsic(double %x) {
 ; CHECK-LABEL: @sqrt_intrinsic(
 ; CHECK-NEXT:    [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]])
 ; CHECK-NEXT:    [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]])
-; CHECK-NEXT:    [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000
-; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]]
+; CHECK-NEXT:    [[ISINF:%.*]] = fcmp oeq double [[X]], ninf
+; CHECK-NEXT:    [[RETVAL:%.*]] = select i1 [[ISINF]], double pinf, double [[ABS]]
 ; CHECK-NEXT:    ret double [[RETVAL]]
 ;
   %retval = call double @llvm.pow.f64(double %x, double 0.5)
diff --git a/llvm/test/Transforms/InstCombine/pow-exp.ll b/llvm/test/Transforms/InstCombine/pow-exp.ll
index 9d91ad2402eb1d..39b66b0fb5deb5 100644
--- a/llvm/test/Transforms/InstCombine/pow-exp.ll
+++ b/llvm/test/Transforms/InstCombine/pow-exp.ll
@@ -346,19 +346,19 @@ define double @pow_zero_base2(double %e) {
 
 define double @pow_inf_base(double %e) {
 ; CHECK-LABEL: @pow_inf_base(
-; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn double @pow(double 0x7FF0000000000000, double [[E:%.*]])
+; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn double @pow(double pinf, double [[E:%.*]])
 ; CHECK-NEXT:    ret double [[CALL]]
 ;
-  %call = tail call afn nnan ninf double @pow(double 0x7FF0000000000000, double %e)
+  %call = tail call afn nnan ninf double @pow(double pinf, double %e)
   ret double %call
 }
 
 define double @pow_nan_base(double %e) {
 ; CHECK-LABEL: @pow_nan_base(
-; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn double @pow(double 0x7FF8000000000000, double [[E:%.*]])
+; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn double @pow(double nan, double [[E:%.*]])
 ; CHECK-NEXT:    ret double [[CALL]]
 ;
-  %call = tail call afn nnan ninf double @pow(double 0x7FF8000000000000, double %e)
+  %call = tail call afn nnan ninf double @pow(double nan, double %e)
   ret double %call
 }
 
@@ -431,19 +431,19 @@ define float @powf_zero_base2(float %e) {
 
 define float @powf_inf_base(float %e) {
 ; CHECK-LABEL: @powf_inf_base(
-; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @powf(float 0x7FF0000000000000, float [[E:%.*]])
+; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @powf(float pinf, float [[E:%.*]])
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
-  %call = tail call afn nnan ninf float @powf(float 0x7FF0000000000000, float %e)
+  %call = tail call afn nnan ninf float @powf(float pinf, float %e)
   ret float %call
 }
 
 define float @powf_nan_base(float %e) {
 ; CHECK-LABEL: @powf_nan_base(
-; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @powf(float 0x7FF8000000000000, float [[E:%.*]])
+; CHECK-NEXT:    [[CALL:%.*]] = tail call nnan ninf afn float @powf(float nan, float [[E:%.*]])
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
-  %call = tail call afn nnan ninf float @powf(float 0x7FF8000000000000, float %e)
+  %call = tail call afn nnan ninf float @powf(float nan, float %e)
   ret float %call
 }
 
diff --git a/llvm/test/Transforms/InstCombine/pow-sqrt.ll b/llvm/test/Transforms/InstCombine/pow-sqrt.ll
index 9272c1c33a953c..c20abe0fc98490 100644
--- a/llvm/test/Transforms/InstCombine/pow-sqrt.ll
+++ b/llvm/test/Transforms/InstCombine/pow-sqrt.ll
@@ -20,8 +20,8 @@ define double @pow_intrinsic_half_no_FMF(double %x) {
 ; CHECK-LABEL: @pow_intrinsic_half_no_FMF(
 ; CHECK-NEXT:    [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]])
 ; CHECK-NEXT:    [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]])
-; CHECK-NEXT:    [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000
-; CHECK-NEXT:    [[POW:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]]
+; CHECK-NEXT:    [[ISINF:%.*]] = fcmp oeq double [[X]], ninf
+; CHECK-NEXT:    [[POW:%.*]] = select i1 [[ISINF]], double pinf, double [[ABS]]
 ; CHECK-NEXT:    ret double [[POW]]
 ;
   %pow = call double @llvm.pow.f64(double %x, double 5.0e-01)
@@ -51,8 +51,8 @@ define <2 x double> @pow_intrinsic_half_approx(<2 x double> %x) {
 ; CHECK-LABEL: @pow_intrinsic_half_approx(
 ; CHECK-NEXT:    [[SQRT:%.*]] = call afn <2 x double> @llvm.sqrt.v2f64(<2 x double> [[X:%.*]])
 ; CHECK-NEXT:    [[ABS:%.*]] = call afn <2 x double> @llvm.fabs.v2f64(<2 x double> [[SQRT]])
-; CHECK-NEXT:    [[ISINF:%.*]] = fcmp afn oeq <2 x double> [[X]], <double 0xFFF0000000000000, double 0xFFF0000000000000>
-; CHECK-NEXT:    [[POW:%.*]] = select afn <2 x i1> [[ISINF]], <2 x double> <double 0x7FF0000000000000, double 0x7FF0000000000000>, <2 x double> [[ABS]]
+; CHECK-NEXT:    [[ISINF:%.*]] = fcmp afn oeq <2 x double> [[X]], <double ninf, double ninf>
+; CHECK-NEXT:    [[POW:%.*]] = select afn <2 x i1> [[ISINF]], <2 x double> <double pinf, double pinf>, <2 x double> [[ABS]]
 ; CHECK-NEXT:    ret <2 x double> [[POW]]
 ;
   %pow = call afn <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double 5.0e-01, double 5.0e-01>)
@@ -116,8 +116,8 @@ define double @pow_libcall_half_nsz(double %x) {
 define double @pow_intrinsic_half_nsz(double %x) {
 ; CHECK-LABEL: @pow_intrinsic_half_nsz(
 ; CHECK-NEXT:    [[SQRT:%.*]] = call nsz double @llvm.sqrt.f64(double [[X:%.*]])
-; CHECK-NEXT:    [[ISINF:%.*]] = fcmp nsz oeq double [[X]], 0xFFF0000000000000
-; CHECK-NEXT:    [[POW:%.*]] = select nsz i1 [[ISINF]], double 0x7FF0000000000000, double [[SQRT]]
+; CHECK-NEXT:    [[ISINF:%.*]] = fcmp nsz oeq double [[X]], ninf
+; CHECK-NEXT:    [[POW:%.*]] = select nsz i1 [[ISINF]], double pinf, double [[SQRT]]
 ; CHECK-NEXT:    ret double [[POW]]
 ;
   %pow = call nsz double @llvm.pow.f64(double %x, double 5.0e-01)
@@ -221,7 +221,7 @@ define <2 x double> @pow_intrinsic_neghalf_reassoc(<2 x double> %x) {
 ; CHECK-LABEL: @pow_intrinsic_neghalf_reassoc(
 ; CHECK-NEXT:    [[SQRT:%.*]] = call reassoc <2 x double> @llvm.sqrt.v2f64(<2 x double> [[X:%.*]])
 ; CHECK-NEXT:    [[ABS:%.*]] = call reassoc <2 x double> @llvm.fabs.v2f64(<2 x double> [[SQRT]])
-; CHECK-NEXT:    [[ISINF:%.*]] = fcmp reassoc oeq <2 x double> [[X]], <double 0xFFF0000000000000, double 0xFFF0000000000000>
+; CHECK-NEXT:    [[ISINF:%.*]] = fcmp reassoc oeq <2 x double> [[X]], <double ninf, double ninf>
 ; CHECK-NEXT:    [[TMP1:%.*]] = fdiv reassoc <2 x double> <double 1.000000e+00, double 1.000000e+00>, [[ABS]]
 ; CHECK-NEXT:    [[RECIPROCAL:%.*]] = select <2 x i1> [[ISINF]], <2 x double> zeroinitializer, <2 x double> [[TMP1]]
 ; CHECK-NEXT:    ret <2 x double> [[RECIPROCAL]]
@@ -238,7 +238,7 @@ define <2 x double> @pow_intrinsic_neghalf_afn(<2 x double> %x) {
 ; CHECK-LABEL: @pow_intrinsic_neghalf_afn(
 ; CHECK-NEXT:    [[SQRT:%.*]] = call afn <2 x double> @llvm.sqrt.v2f64(<2 x double> [[X:%.*]])
 ; CHECK-NEXT:    [[ABS:%.*]] = call afn <2 x double> @llvm.fabs.v2f64(<2 x double> [[SQRT]])
-; CHECK-NEXT:    [[ISINF:%.*]] = fcmp afn oeq <2 x double> [[X]], <double 0xFFF0000000000000, double 0xFFF0000000000000>
+; CHECK-NEXT:    [[ISINF:%.*]] = fcmp afn oeq <2 x double> [[X]], <double ninf, double ninf>
 ; CHECK-NEXT:    [[TMP1:%.*]] = fdiv afn <2 x double> <double 1.000000e+00, double 1.000000e+00>, [[ABS]]
 ; CHECK-NEXT:    [[RECIPROCAL:%.*]] = select <2 x i1> [[ISINF]], <2 x double> zeroinitializer, <2 x double> [[TMP1]]
 ; CHECK-NEXT:    ret <2 x double> [[RECIPROCAL]]
@@ -285,7 +285,7 @@ define double @pow_libcall_neghalf_nsz(double %x) {
 define double @pow_intrinsic_neghalf_nsz(double %x) {
 ; CHECK-LABEL: @pow_intrinsic_neghalf_nsz(
 ; CHECK-NEXT:    [[SQRT:%.*]] = call nsz afn double @llvm.sqrt.f64(double [[X:%.*]])
-; CHECK-NEXT:    [[ISINF:%.*]] = fcmp nsz afn oeq double [[X]], 0xFFF0000000000000
+; CHECK-NEXT:    [[ISINF:%.*]] = fcmp nsz afn oeq double [[X]], ninf
 ; CHECK-NEXT:    [[TMP1:%.*]] = fdiv nsz afn double 1.000000e+00, [[SQRT]]
 ; CHECK-NEXT:    [[RECIPROCAL:%.*]] = select i1 [[ISINF]], double 0.000000e+00, double [[TMP1]]
 ; CHECK-NEXT:    ret double [[RECIPROCAL]]
diff --git a/llvm/test/Transforms/InstCombine/remquo.ll b/llvm/test/Transforms/InstCombine/remquo.ll
index b2499ea13179e5..76aa012d00f9ed 100644
--- a/llvm/test/Transforms/InstCombine/remquo.ll
+++ b/llvm/test/Transforms/InstCombine/remquo.ll
@@ -55,7 +55,7 @@ define float @remquo_f32_inf_x(ptr %quo) {
 ; CHECK-LABEL: define float @remquo_f32_inf_x(
 ; CHECK-SAME: ptr [[QUO:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
-; CHECK-NEXT:    [[CALL:%.*]] = call float @remquof(float 0x7FF0000000000000, float 1.000000e+00, ptr [[QUO]])
+; CHECK-NEXT:    [[CALL:%.*]] = call float @remquof(float pinf, float 1.000000e+00, ptr [[QUO]])
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
 entry:
@@ -91,7 +91,7 @@ define float @remquo_f32_nan_x(ptr %quo) {
 ; CHECK-LABEL: define float @remquo_f32_nan_x(
 ; CHECK-SAME: ptr [[QUO:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
-; CHECK-NEXT:    [[CALL:%.*]] = call float @remquof(float 0x7FF8000000000000, float 1.000000e+00, ptr [[QUO]])
+; CHECK-NEXT:    [[CALL:%.*]] = call float @remquof(float nan, float 1.000000e+00, ptr [[QUO]])
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
 entry:
@@ -103,7 +103,7 @@ define float @remquo_f32_nan_y(ptr %quo) {
 ; CHECK-LABEL: define float @remquo_f32_nan_y(
 ; CHECK-SAME: ptr [[QUO:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
-; CHECK-NEXT:    [[CALL:%.*]] = call float @remquof(float 1.000000e+00, float 0x7FF8000000000000, ptr [[QUO]])
+; CHECK-NEXT:    [[CALL:%.*]] = call float @remquof(float 1.000000e+00, float nan, ptr [[QUO]])
 ; CHECK-NEXT:    ret float [[CALL]]
 ;
 entry:
diff --git a/llvm/test/Transforms/InstCombine/shufflevec-constant-inseltpoison.ll b/llvm/test/Transforms/InstCombine/shufflevec-constant-inseltpoison.ll
index 967d370092d01b..a2bb36b42c796b 100644
--- a/llvm/test/Transforms/InstCombine/shufflevec-constant-inseltpoison.ll
+++ b/llvm/test/Transforms/InstCombine/shufflevec-constant-inseltpoison.ll
@@ -6,7 +6,7 @@ target triple = "i386-apple-darwin9"
 
 define <4 x float> @__inff4() nounwind readnone {
 ; CHECK-LABEL: @__inff4(
-; CHECK-NEXT:    ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0x7FF0000000000000, float 0x7FF0000000000000>
+; CHECK-NEXT:    ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float pinf, float pinf>
 ;
   %tmp14 = extractelement <1 x double> bitcast (<2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000> to <1 x double>), i32 0
   %tmp4 = bitcast double %tmp14 to i64
diff --git a/llvm/test/Transforms/InstCombine/shufflevec-constant.ll b/llvm/test/Transforms/InstCombine/shufflevec-constant.ll
index 7d33473aecca50..00abb3bed08b18 100644
--- a/llvm/test/Transforms/InstCombine/shufflevec-constant.ll
+++ b/llvm/test/Transforms/InstCombine/shufflevec-constant.ll
@@ -6,7 +6,7 @@ target triple = "i386-apple-darwin9"
 
 define <4 x float> @__inff4() nounwind readnone {
 ; CHECK-LABEL: @__inff4(
-; CHECK-NEXT:    ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0x7FF0000000000000, float 0x7FF0000000000000>
+; CHECK-NEXT:    ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float pinf, float pinf>
 ;
   %tmp14 = extractelement <1 x double> bitcast (<2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000> to <1 x double>), i32 0
   %tmp4 = bitcast double %tmp14 to i64
diff --git a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass.ll b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass.ll
index e4fb7764ba9e53..7f3239d207c6cb 100644
--- a/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass.ll
+++ b/llvm/test/Transforms/InstCombine/simplify-demanded-fpclass.ll
@@ -15,7 +15,7 @@ declare float @llvm.maxnum.f32(float, float)
 define float @ninf_user_select_inf(i1 %cond, float %x, float %y) {
 ; CHECK-LABEL: define float @ninf_user_select_inf
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float pinf
 ; CHECK-NEXT:    [[NINF_USER:%.*]] = fmul ninf float [[SELECT]], [[Y]]
 ; CHECK-NEXT:    ret float [[NINF_USER]]
 ;
@@ -79,7 +79,7 @@ define nofpclass(pinf) float @ret_nofpclass_pinf__pinf() {
 
 define nofpclass(pinf) float @ret_nofpclass_pinf__ninf() {
 ; CHECK-LABEL: define nofpclass(pinf) float @ret_nofpclass_pinf__ninf() {
-; CHECK-NEXT:    ret float 0xFFF0000000000000
+; CHECK-NEXT:    ret float ninf
 ;
   ret float 0xFFF0000000000000
 }
@@ -176,7 +176,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_ninf_or_pinf(i1 %cond, fl
 define nofpclass(ninf) float @ret_nofpclass_ninf__select_ninf_or_pinf(i1 %cond, float %x) {
 ; CHECK-LABEL: define nofpclass(ninf) float @ret_nofpclass_ninf__select_ninf_or_pinf
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %select = select i1 %cond, float 0xFFF0000000000000, float 0x7FF0000000000000
   ret float %select
@@ -186,7 +186,7 @@ define nofpclass(ninf) float @ret_nofpclass_ninf__select_ninf_or_pinf(i1 %cond,
 define nofpclass(pinf) float @ret_nofpclass_pinf__select_ninf_or_pinf(i1 %cond, float %x) {
 ; CHECK-LABEL: define nofpclass(pinf) float @ret_nofpclass_pinf__select_ninf_or_pinf
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
-; CHECK-NEXT:    ret float 0xFFF0000000000000
+; CHECK-NEXT:    ret float ninf
 ;
   %select = select i1 %cond, float 0xFFF0000000000000, float 0x7FF0000000000000
   ret float %select
@@ -256,7 +256,7 @@ define nofpclass(inf) <2 x float> @ret_nofpclass_inf__select_mixed_inf_lhs_vecto
 define nofpclass(inf) float @ret_nofpclass_inf__select_multi_use_pinf_lhs(i1 %cond, float %x, ptr %ptr) {
 ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__select_multi_use_pinf_lhs
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], ptr [[PTR:%.*]]) {
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float 0x7FF0000000000000, float [[X]]
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float pinf, float [[X]]
 ; CHECK-NEXT:    store float [[SELECT]], ptr [[PTR]], align 4
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
@@ -291,7 +291,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_p0_rhs(i1 %cond, float %x
 define nofpclass(nan) float @ret_nofpclass_nan__select_pinf_lhs(i1 %cond, float %x) {
 ; CHECK-LABEL: define nofpclass(nan) float @ret_nofpclass_nan__select_pinf_lhs
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float 0x7FF0000000000000, float [[X]]
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float pinf, float [[X]]
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
   %select = select i1 %cond, float 0x7FF0000000000000, float %x
@@ -302,7 +302,7 @@ define nofpclass(nan) float @ret_nofpclass_nan__select_pinf_lhs(i1 %cond, float
 define nofpclass(nan) float @ret_nofpclass_nan__select_pinf_rhs(i1 %cond, float %x) {
 ; CHECK-LABEL: define nofpclass(nan) float @ret_nofpclass_nan__select_pinf_rhs
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float 0x7FF0000000000000
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float [[X]], float pinf
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
   %select = select i1 %cond, float %x, float 0x7FF0000000000000
@@ -332,7 +332,7 @@ define nofpclass(inf nan) float @ret_nofpclass_inf_nan__select_chain_inf_nan_1(i
 define nofpclass(nan) float @ret_nofpclass_nan__select_chain_inf_nan(i1 %cond, float %x) {
 ; CHECK-LABEL: define nofpclass(nan) float @ret_nofpclass_nan__select_chain_inf_nan
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
-; CHECK-NEXT:    [[SELECT1:%.*]] = select i1 [[COND]], float 0x7FF0000000000000, float [[X]]
+; CHECK-NEXT:    [[SELECT1:%.*]] = select i1 [[COND]], float pinf, float [[X]]
 ; CHECK-NEXT:    ret float [[SELECT1]]
 ;
   %select0 = select i1 %cond, float 0x7FF8000000000000, float %x
@@ -353,7 +353,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_chain_inf_nan_0(i1 %cond,
 define nofpclass(inf) float @ret_nofpclass_inf__select_chain_inf_nan_1(i1 %cond, float %x) {
 ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_inf__select_chain_inf_nan_1
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %select0 = select i1 %cond, float 0x7FF8000000000000, float %x
   %select1 = select i1 %cond, float %select0, float 0x7FF0000000000000
@@ -388,7 +388,7 @@ define nofpclass(ninf nnorm nsub nzero) float @ret_nofpclass_no_negatives__fabs_
 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_nofpclass_no_negatives__fabs_select_pinf_rhs
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; CHECK-NEXT:    [[FABS:%.*]] = select i1 [[COND]], float [[TMP1]], float 0x7FF0000000000000
+; CHECK-NEXT:    [[FABS:%.*]] = select i1 [[COND]], float [[TMP1]], float pinf
 ; CHECK-NEXT:    ret float [[FABS]]
 ;
   %select = select i1 %cond, float %x, float 0x7FF0000000000000
@@ -412,7 +412,7 @@ define nofpclass(nan ninf nnorm nsub nzero) float @ret_nofpclass_no_negatives_na
 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_nofpclass_no_negatives_nan__fabs_select_pinf_rhs
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; CHECK-NEXT:    [[FABS:%.*]] = select i1 [[COND]], float [[TMP1]], float 0x7FF0000000000000
+; CHECK-NEXT:    [[FABS:%.*]] = select i1 [[COND]], float [[TMP1]], float pinf
 ; CHECK-NEXT:    ret float [[FABS]]
 ;
   %select = select i1 %cond, float %x, float 0x7FF0000000000000
@@ -471,7 +471,7 @@ define nofpclass(pzero psub pnorm pinf) float @ret_nofpclass_nopositives___fneg_
 ; CHECK-LABEL: define nofpclass(pinf pzero psub pnorm) float @ret_nofpclass_nopositives___fneg_select_pinf_rhs
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
 ; CHECK-NEXT:    [[X_NEG:%.*]] = fneg float [[X]]
-; CHECK-NEXT:    [[FNEG:%.*]] = select i1 [[COND]], float [[X_NEG]], float 0xFFF0000000000000
+; CHECK-NEXT:    [[FNEG:%.*]] = select i1 [[COND]], float [[X_NEG]], float ninf
 ; CHECK-NEXT:    ret float [[FNEG]]
 ;
   %select = select i1 %cond, float %x, float 0x7FF0000000000000
@@ -666,7 +666,7 @@ define nofpclass(ninf nnorm nsub nzero) float @ret_nofpclass_no_negatives__copys
 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_nofpclass_no_negatives__copysign_unknown_select_pinf_rhs
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; CHECK-NEXT:    [[COPYSIGN:%.*]] = select i1 [[COND]], float [[TMP1]], float 0x7FF0000000000000
+; CHECK-NEXT:    [[COPYSIGN:%.*]] = select i1 [[COND]], float [[TMP1]], float pinf
 ; CHECK-NEXT:    ret float [[COPYSIGN]]
 ;
   %select = select i1 %cond, float %x, float 0x7FF0000000000000
@@ -680,7 +680,7 @@ define nofpclass(pinf pnorm psub pzero) float @ret_nofpclass_no_positives__copys
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]])
 ; CHECK-NEXT:    [[DOTNEG:%.*]] = fneg float [[TMP1]]
-; CHECK-NEXT:    [[COPYSIGN:%.*]] = select i1 [[COND]], float [[DOTNEG]], float 0xFFF0000000000000
+; CHECK-NEXT:    [[COPYSIGN:%.*]] = select i1 [[COND]], float [[DOTNEG]], float ninf
 ; CHECK-NEXT:    ret float [[COPYSIGN]]
 ;
   %select = select i1 %cond, float %x, float 0x7FF0000000000000
@@ -693,7 +693,7 @@ define nofpclass(nan ninf nnorm nsub nzero) float @ret_nofpclass_no_negatives_no
 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_nofpclass_no_negatives_nonan__copysign_unknown_select_pinf_rhs
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; CHECK-NEXT:    [[COPYSIGN:%.*]] = select i1 [[COND]], float [[TMP1]], float 0x7FF0000000000000
+; CHECK-NEXT:    [[COPYSIGN:%.*]] = select i1 [[COND]], float [[TMP1]], float pinf
 ; CHECK-NEXT:    ret float [[COPYSIGN]]
 ;
   %select = select i1 %cond, float %x, float 0x7FF0000000000000
@@ -707,7 +707,7 @@ define nofpclass(nan pinf pnorm psub pzero) float @ret_nofpclass_no_positives_no
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[UNKNOWN_SIGN:%.*]]) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[X]])
 ; CHECK-NEXT:    [[DOTNEG:%.*]] = fneg float [[TMP1]]
-; CHECK-NEXT:    [[COPYSIGN:%.*]] = select i1 [[COND]], float [[DOTNEG]], float 0xFFF0000000000000
+; CHECK-NEXT:    [[COPYSIGN:%.*]] = select i1 [[COND]], float [[DOTNEG]], float ninf
 ; CHECK-NEXT:    ret float [[COPYSIGN]]
 ;
   %select = select i1 %cond, float %x, float 0x7FF0000000000000
@@ -781,7 +781,7 @@ define nofpclass(inf) float @ret_nofpclass_noinfs__assumed_isinf__select_pinf_lh
 ; CHECK-LABEL: define nofpclass(inf) float @ret_nofpclass_noinfs__assumed_isinf__select_pinf_lhs
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], float [[Y:%.*]]) {
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call float @llvm.fabs.f32(float [[X]])
-; CHECK-NEXT:    [[X_IS_INF:%.*]] = fcmp oeq float [[FABS_X]], 0x7FF0000000000000
+; CHECK-NEXT:    [[X_IS_INF:%.*]] = fcmp oeq float [[FABS_X]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[X_IS_INF]])
 ; CHECK-NEXT:    ret float [[Y]]
 ;
@@ -834,9 +834,9 @@ define nofpclass(nan inf nzero nsub nnorm) float @test_powr_issue64870_2(float n
 ; CHECK-SAME: (float nofpclass(nan inf) [[ARG:%.*]], float nofpclass(nan inf) [[ARG1:%.*]]) {
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    [[I:%.*]] = fcmp olt float [[ARG]], 0.000000e+00
-; CHECK-NEXT:    [[I2:%.*]] = select i1 [[I]], float 0x7FF8000000000000, float [[ARG]]
+; CHECK-NEXT:    [[I2:%.*]] = select i1 [[I]], float nan, float [[ARG]]
 ; CHECK-NEXT:    [[I3:%.*]] = tail call float @llvm.log2.f32(float noundef [[I2]])
-; CHECK-NEXT:    [[I4:%.*]] = select i1 [[I]], float 0x7FF8000000000000, float [[ARG1]]
+; CHECK-NEXT:    [[I4:%.*]] = select i1 [[I]], float nan, float [[ARG1]]
 ; CHECK-NEXT:    [[I5:%.*]] = fmul float [[I4]], [[I3]]
 ; CHECK-NEXT:    [[I6:%.*]] = tail call noundef nofpclass(ninf nzero nsub nnorm) float @llvm.exp2.f32(float noundef [[I5]])
 ; CHECK-NEXT:    [[I10:%.*]] = fcmp oeq float [[I2]], 0.000000e+00
@@ -936,7 +936,7 @@ define nofpclass(pinf) float @ret_nofpclass_pinf__nofpclass_call_only_inf(i1 %co
 ; CHECK-LABEL: define nofpclass(pinf) float @ret_nofpclass_pinf__nofpclass_call_only_inf
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[Y:%.*]]) {
 ; CHECK-NEXT:    [[MUST_BE_INF:%.*]] = call nofpclass(nan zero sub norm) float @extern()
-; CHECK-NEXT:    ret float 0xFFF0000000000000
+; CHECK-NEXT:    ret float ninf
 ;
   %must.be.inf = call nofpclass(nan norm zero sub) float @extern()
   ret float %must.be.inf
@@ -946,7 +946,7 @@ define nofpclass(ninf) float @ret_nofpclass_ninf__nofpclass_call_only_inf(i1 %co
 ; CHECK-LABEL: define nofpclass(ninf) float @ret_nofpclass_ninf__nofpclass_call_only_inf
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[Y:%.*]]) {
 ; CHECK-NEXT:    [[MUST_BE_INF:%.*]] = call nofpclass(nan zero sub norm) float @extern()
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %must.be.inf = call nofpclass(nan norm zero sub) float @extern()
   ret float %must.be.inf
@@ -1001,7 +1001,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__select_assumed_call_result_only_
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[Y:%.*]]) {
 ; CHECK-NEXT:    [[MUST_BE_INF:%.*]] = call float @extern()
 ; CHECK-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[MUST_BE_INF]])
-; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[FABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[IS_INF:%.*]] = fcmp oeq float [[FABS]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[IS_INF]])
 ; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float [[MUST_BE_INF]], float [[Y]]
 ; CHECK-NEXT:    ret float [[SELECT]]
@@ -1022,7 +1022,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__simple_phi_inf_or_unknown(i1 %co
 ; CHECK:       bb0:
 ; CHECK-NEXT:    br label [[RET]]
 ; CHECK:       ret:
-; CHECK-NEXT:    [[PHI:%.*]] = phi float [ 0x7FF0000000000000, [[ENTRY:%.*]] ], [ [[X]], [[BB0]] ]
+; CHECK-NEXT:    [[PHI:%.*]] = phi float [ pinf, [[ENTRY:%.*]] ], [ [[X]], [[BB0]] ]
 ; CHECK-NEXT:    ret float [[PHI]]
 ;
 entry:
@@ -1048,7 +1048,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__phi_0(i1 %cond0, float %unknown)
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br i1 [[COND0]], label [[LOOP:%.*]], label [[RET:%.*]]
 ; CHECK:       loop:
-; CHECK-NEXT:    [[PHI_LOOP:%.*]] = phi float [ 0x7FF0000000000000, [[ENTRY:%.*]] ], [ [[LOOP_FUNC:%.*]], [[LOOP]] ]
+; CHECK-NEXT:    [[PHI_LOOP:%.*]] = phi float [ pinf, [[ENTRY:%.*]] ], [ [[LOOP_FUNC:%.*]], [[LOOP]] ]
 ; CHECK-NEXT:    [[LOOP_FUNC]] = call nofpclass(nan) float @loop.func()
 ; CHECK-NEXT:    [[LOOP_COND:%.*]] = call i1 @loop.cond()
 ; CHECK-NEXT:    br i1 [[LOOP_COND]], label [[RET]], label [[LOOP]]
@@ -1130,7 +1130,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__phi_switch_repeated_predecessor(
 ; CHECK-NEXT:      i32 1, label [[LOOP]]
 ; CHECK-NEXT:    ]
 ; CHECK:       loop:
-; CHECK-NEXT:    [[PHI_LOOP:%.*]] = phi float [ 0x7FF0000000000000, [[ENTRY:%.*]] ], [ 0x7FF0000000000000, [[ENTRY]] ], [ [[UNKNOWN]], [[LOOP]] ]
+; CHECK-NEXT:    [[PHI_LOOP:%.*]] = phi float [ pinf, [[ENTRY:%.*]] ], [ pinf, [[ENTRY]] ], [ [[UNKNOWN]], [[LOOP]] ]
 ; CHECK-NEXT:    [[LOOP_COND:%.*]] = call i1 @loop.cond()
 ; CHECK-NEXT:    br i1 [[LOOP_COND]], label [[RET]], label [[LOOP]]
 ; CHECK:       ret:
@@ -1169,7 +1169,7 @@ define nofpclass(inf) float @ret_nofpclass_inf__arithmetic_fence_select_pinf_rhs
 define nofpclass(pinf) float @ret_nofpclass_pinf__minnum_pinf(i1 %cond, float %x) {
 ; CHECK-LABEL: define nofpclass(pinf) float @ret_nofpclass_pinf__minnum_pinf
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
-; CHECK-NEXT:    [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X]], float 0x7FF0000000000000)
+; CHECK-NEXT:    [[MIN:%.*]] = call float @llvm.minnum.f32(float [[X]], float pinf)
 ; CHECK-NEXT:    ret float [[MIN]]
 ;
   %min = call float @llvm.minnum.f32(float %x, float 0x7FF0000000000000)
@@ -1180,7 +1180,7 @@ define nofpclass(pinf) float @ret_nofpclass_pinf__minnum_pinf(i1 %cond, float %x
 define nofpclass(pinf) float @ret_nofpclass_pinf__minnum_ninf(i1 %cond, float %x) {
 ; CHECK-LABEL: define nofpclass(pinf) float @ret_nofpclass_pinf__minnum_ninf
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
-; CHECK-NEXT:    ret float 0xFFF0000000000000
+; CHECK-NEXT:    ret float ninf
 ;
   %min = call float @llvm.minnum.f32(float %x, float 0xFFF0000000000000)
   ret float %min
@@ -1190,7 +1190,7 @@ define nofpclass(pinf) float @ret_nofpclass_pinf__minnum_ninf(i1 %cond, float %x
 define nofpclass(ninf) float @ret_nofpclass_ninf__maxnum_ninf(i1 %cond, float %x) {
 ; CHECK-LABEL: define nofpclass(ninf) float @ret_nofpclass_ninf__maxnum_ninf
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
-; CHECK-NEXT:    [[MAX:%.*]] = call float @llvm.maxnum.f32(float [[X]], float 0xFFF0000000000000)
+; CHECK-NEXT:    [[MAX:%.*]] = call float @llvm.maxnum.f32(float [[X]], float ninf)
 ; CHECK-NEXT:    ret float [[MAX]]
 ;
   %max = call float @llvm.maxnum.f32(float %x, float 0xFFF0000000000000)
@@ -1201,7 +1201,7 @@ define nofpclass(ninf) float @ret_nofpclass_ninf__maxnum_ninf(i1 %cond, float %x
 define nofpclass(ninf) float @ret_nofpclass_ninf__maxnum_pinf(i1 %cond, float %x) {
 ; CHECK-LABEL: define nofpclass(ninf) float @ret_nofpclass_ninf__maxnum_pinf
 ; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]]) {
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %max = call float @llvm.maxnum.f32(float %x, float 0x7FF0000000000000)
   ret float %max
diff --git a/llvm/test/Transforms/InstCombine/sqrt.ll b/llvm/test/Transforms/InstCombine/sqrt.ll
index f72fe5a6a5817b..1d9ecba1e4d890 100644
--- a/llvm/test/Transforms/InstCombine/sqrt.ll
+++ b/llvm/test/Transforms/InstCombine/sqrt.ll
@@ -31,7 +31,7 @@ define float @test2(float %x) nounwind readnone ssp {
 
 define float @test3(ptr %v) nounwind uwtable ssp {
 ; CHECK-LABEL: @test3(
-; CHECK-NEXT:    [[CALL34:%.*]] = call double @sqrt(double 0x7FF8000000000000) #[[ATTR4]]
+; CHECK-NEXT:    [[CALL34:%.*]] = call double @sqrt(double nan) #[[ATTR4]]
 ; CHECK-NEXT:    [[CALL36:%.*]] = call i32 @foo(double [[CALL34]]) #[[ATTR5:[0-9]+]]
 ; CHECK-NEXT:    [[CONV38:%.*]] = fptrunc double [[CALL34]] to float
 ; CHECK-NEXT:    ret float [[CONV38]]
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/trunc.ll b/llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/trunc.ll
index 8a884928dad631..d2fcc8c701c8e0 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/trunc.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/trunc.ll
@@ -33,11 +33,11 @@ define void @test_i32_trunc_f32_s(ptr %p) {
 ; CHECK-NEXT:    store volatile i32 [[T14]], ptr [[P]], align 4
 ; CHECK-NEXT:    [[T15:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f32(float 0xC1E0000020000000)
 ; CHECK-NEXT:    store volatile i32 [[T15]], ptr [[P]], align 4
-; CHECK-NEXT:    [[T16:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f32(float 0x7FF0000000000000)
+; CHECK-NEXT:    [[T16:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f32(float pinf)
 ; CHECK-NEXT:    store volatile i32 [[T16]], ptr [[P]], align 4
-; CHECK-NEXT:    [[T17:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f32(float 0xFFF0000000000000)
+; CHECK-NEXT:    [[T17:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f32(float ninf)
 ; CHECK-NEXT:    store volatile i32 [[T17]], ptr [[P]], align 4
-; CHECK-NEXT:    [[T18:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f32(float 0x7FF8000000000000)
+; CHECK-NEXT:    [[T18:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f32(float nan)
 ; CHECK-NEXT:    store volatile i32 [[T18]], ptr [[P]], align 4
 ; CHECK-NEXT:    [[T19:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f32(float 0x7FFA000000000000)
 ; CHECK-NEXT:    store volatile i32 [[T19]], ptr [[P]], align 4
@@ -113,11 +113,11 @@ define void @test_i32_trunc_f32_u(ptr %p) {
 ; CHECK-NEXT:    store volatile i32 [[T13]], ptr [[P]], align 4
 ; CHECK-NEXT:    [[T14:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f32(float -1.000000e+00)
 ; CHECK-NEXT:    store volatile i32 [[T14]], ptr [[P]], align 4
-; CHECK-NEXT:    [[T15:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f32(float 0x7FF0000000000000)
+; CHECK-NEXT:    [[T15:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f32(float pinf)
 ; CHECK-NEXT:    store volatile i32 [[T15]], ptr [[P]], align 4
-; CHECK-NEXT:    [[T16:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f32(float 0xFFF0000000000000)
+; CHECK-NEXT:    [[T16:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f32(float ninf)
 ; CHECK-NEXT:    store volatile i32 [[T16]], ptr [[P]], align 4
-; CHECK-NEXT:    [[T17:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f32(float 0x7FF8000000000000)
+; CHECK-NEXT:    [[T17:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f32(float nan)
 ; CHECK-NEXT:    store volatile i32 [[T17]], ptr [[P]], align 4
 ; CHECK-NEXT:    [[T18:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f32(float 0x7FFA000000000000)
 ; CHECK-NEXT:    store volatile i32 [[T18]], ptr [[P]], align 4
@@ -194,11 +194,11 @@ define void @test_i32_trunc_f64_s(ptr %p) {
 ; CHECK-NEXT:    store volatile i32 [[T16]], ptr [[P]], align 4
 ; CHECK-NEXT:    [[T17:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f64(double 0xC1E0000000200000)
 ; CHECK-NEXT:    store volatile i32 [[T17]], ptr [[P]], align 4
-; CHECK-NEXT:    [[T18:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f64(double 0x7FF0000000000000)
+; CHECK-NEXT:    [[T18:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f64(double pinf)
 ; CHECK-NEXT:    store volatile i32 [[T18]], ptr [[P]], align 4
-; CHECK-NEXT:    [[T19:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f64(double 0xFFF0000000000000)
+; CHECK-NEXT:    [[T19:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f64(double ninf)
 ; CHECK-NEXT:    store volatile i32 [[T19]], ptr [[P]], align 4
-; CHECK-NEXT:    [[T20:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f64(double 0x7FF8000000000000)
+; CHECK-NEXT:    [[T20:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f64(double nan)
 ; CHECK-NEXT:    store volatile i32 [[T20]], ptr [[P]], align 4
 ; CHECK-NEXT:    [[T21:%.*]] = call i32 @llvm.wasm.trunc.signed.i32.f64(double 0x7FF4000000000000)
 ; CHECK-NEXT:    store volatile i32 [[T21]], ptr [[P]], align 4
@@ -286,11 +286,11 @@ define void @test_i32_trunc_f64_u(ptr %p) {
 ; CHECK-NEXT:    store volatile i32 [[T18]], ptr [[P]], align 4
 ; CHECK-NEXT:    [[T19:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f64(double 0x43E0000000000000)
 ; CHECK-NEXT:    store volatile i32 [[T19]], ptr [[P]], align 4
-; CHECK-NEXT:    [[T20:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f64(double 0x7FF0000000000000)
+; CHECK-NEXT:    [[T20:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f64(double pinf)
 ; CHECK-NEXT:    store volatile i32 [[T20]], ptr [[P]], align 4
-; CHECK-NEXT:    [[T21:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f64(double 0xFFF0000000000000)
+; CHECK-NEXT:    [[T21:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f64(double ninf)
 ; CHECK-NEXT:    store volatile i32 [[T21]], ptr [[P]], align 4
-; CHECK-NEXT:    [[T22:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f64(double 0x7FF8000000000000)
+; CHECK-NEXT:    [[T22:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f64(double nan)
 ; CHECK-NEXT:    store volatile i32 [[T22]], ptr [[P]], align 4
 ; CHECK-NEXT:    [[T23:%.*]] = call i32 @llvm.wasm.trunc.unsigned.i32.f64(double 0x7FF4000000000000)
 ; CHECK-NEXT:    store volatile i32 [[T23]], ptr [[P]], align 4
@@ -377,11 +377,11 @@ define void @test_i64_trunc_f32_s(ptr %p) {
 ; CHECK-NEXT:    store volatile i64 [[T16]], ptr [[P]], align 8
 ; CHECK-NEXT:    [[T17:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f32(float 0xC3E0000020000000)
 ; CHECK-NEXT:    store volatile i64 [[T17]], ptr [[P]], align 8
-; CHECK-NEXT:    [[T18:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f32(float 0x7FF0000000000000)
+; CHECK-NEXT:    [[T18:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f32(float pinf)
 ; CHECK-NEXT:    store volatile i64 [[T18]], ptr [[P]], align 8
-; CHECK-NEXT:    [[T19:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f32(float 0xFFF0000000000000)
+; CHECK-NEXT:    [[T19:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f32(float ninf)
 ; CHECK-NEXT:    store volatile i64 [[T19]], ptr [[P]], align 8
-; CHECK-NEXT:    [[T20:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f32(float 0x7FF8000000000000)
+; CHECK-NEXT:    [[T20:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f32(float nan)
 ; CHECK-NEXT:    store volatile i64 [[T20]], ptr [[P]], align 8
 ; CHECK-NEXT:    [[T21:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f32(float 0x7FFA000000000000)
 ; CHECK-NEXT:    store volatile i64 [[T21]], ptr [[P]], align 8
@@ -459,11 +459,11 @@ define void @test_i64_trunc_f32_u(ptr %p) {
 ; CHECK-NEXT:    store volatile i64 [[T11]], ptr [[P]], align 8
 ; CHECK-NEXT:    [[T12:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f32(float -1.000000e+00)
 ; CHECK-NEXT:    store volatile i64 [[T12]], ptr [[P]], align 8
-; CHECK-NEXT:    [[T13:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f32(float 0x7FF0000000000000)
+; CHECK-NEXT:    [[T13:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f32(float pinf)
 ; CHECK-NEXT:    store volatile i64 [[T13]], ptr [[P]], align 8
-; CHECK-NEXT:    [[T14:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f32(float 0xFFF0000000000000)
+; CHECK-NEXT:    [[T14:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f32(float ninf)
 ; CHECK-NEXT:    store volatile i64 [[T14]], ptr [[P]], align 8
-; CHECK-NEXT:    [[T15:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f32(float 0x7FF8000000000000)
+; CHECK-NEXT:    [[T15:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f32(float nan)
 ; CHECK-NEXT:    store volatile i64 [[T15]], ptr [[P]], align 8
 ; CHECK-NEXT:    [[T16:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f32(float 0x7FFA000000000000)
 ; CHECK-NEXT:    store volatile i64 [[T16]], ptr [[P]], align 8
@@ -536,11 +536,11 @@ define void @test_i64_trunc_f64_s(ptr %p) {
 ; CHECK-NEXT:    store volatile i64 [[T16]], ptr [[P]], align 8
 ; CHECK-NEXT:    [[T17:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f64(double 0xC3E0000000000001)
 ; CHECK-NEXT:    store volatile i64 [[T17]], ptr [[P]], align 8
-; CHECK-NEXT:    [[T18:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f64(double 0x7FF0000000000000)
+; CHECK-NEXT:    [[T18:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f64(double pinf)
 ; CHECK-NEXT:    store volatile i64 [[T18]], ptr [[P]], align 8
-; CHECK-NEXT:    [[T19:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f64(double 0xFFF0000000000000)
+; CHECK-NEXT:    [[T19:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f64(double ninf)
 ; CHECK-NEXT:    store volatile i64 [[T19]], ptr [[P]], align 8
-; CHECK-NEXT:    [[T20:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f64(double 0x7FF8000000000000)
+; CHECK-NEXT:    [[T20:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f64(double nan)
 ; CHECK-NEXT:    store volatile i64 [[T20]], ptr [[P]], align 8
 ; CHECK-NEXT:    [[T21:%.*]] = call i64 @llvm.wasm.trunc.signed.i64.f64(double 0x7FF4000000000000)
 ; CHECK-NEXT:    store volatile i64 [[T21]], ptr [[P]], align 8
@@ -622,11 +622,11 @@ define void @test_i64_trunc_f64_u(ptr %p) {
 ; CHECK-NEXT:    store volatile i64 [[T15]], ptr [[P]], align 8
 ; CHECK-NEXT:    [[T16:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f64(double -1.000000e+00)
 ; CHECK-NEXT:    store volatile i64 [[T16]], ptr [[P]], align 8
-; CHECK-NEXT:    [[T17:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f64(double 0x7FF0000000000000)
+; CHECK-NEXT:    [[T17:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f64(double pinf)
 ; CHECK-NEXT:    store volatile i64 [[T17]], ptr [[P]], align 8
-; CHECK-NEXT:    [[T18:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f64(double 0xFFF0000000000000)
+; CHECK-NEXT:    [[T18:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f64(double ninf)
 ; CHECK-NEXT:    store volatile i64 [[T18]], ptr [[P]], align 8
-; CHECK-NEXT:    [[T19:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f64(double 0x7FF8000000000000)
+; CHECK-NEXT:    [[T19:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f64(double nan)
 ; CHECK-NEXT:    store volatile i64 [[T19]], ptr [[P]], align 8
 ; CHECK-NEXT:    [[T20:%.*]] = call i64 @llvm.wasm.trunc.unsigned.i64.f64(double 0x7FF4000000000000)
 ; CHECK-NEXT:    store volatile i64 [[T20]], ptr [[P]], align 8
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/calls.ll b/llvm/test/Transforms/InstSimplify/ConstProp/calls.ll
index 61a30c781c0f4e..591d7442cf82a3 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/calls.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/calls.ll
@@ -197,7 +197,7 @@ define float @test_intrinsic_pow_f32_overflow() nounwind uwtable ssp {
 entry:
 ; CHECK-LABEL: @test_intrinsic_pow_f32_overflow(
 ; CHECK-NOT: call
-; CHECK: ret float 0x7FF0000000000000
+; CHECK: ret float pinf
   %0 = call float @llvm.pow.f32(float 40.0, float 50.0)
   ret float %0
 }
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/cast.ll b/llvm/test/Transforms/InstSimplify/ConstProp/cast.ll
index a2ed8cd6178d86..fba430a85409f6 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/cast.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/cast.ll
@@ -25,7 +25,7 @@ define i8 @overflow_fptoui() {
 
 define float @overflow_uitofp() {
 ; CHECK-LABEL: @overflow_uitofp(
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %i = uitofp i130 400000000000000000000000000000000000000 to float
   ret float %i
@@ -33,7 +33,7 @@ define float @overflow_uitofp() {
 
 define float @overflow_sitofp() {
 ; CHECK-LABEL: @overflow_sitofp(
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %i = sitofp i130 400000000000000000000000000000000000000 to float
   ret float %i
@@ -44,7 +44,7 @@ define float @overflow_sitofp() {
 
 define float @nan_f64_trunc() {
 ; CHECK-LABEL: @nan_f64_trunc(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %f = fptrunc double 0x7FF0000000000001 to float
   ret float %f
@@ -57,7 +57,7 @@ define float @nan_f64_trunc() {
 
 define <3 x half> @nan_v3f64_trunc() {
 ; CHECK-LABEL: @nan_v3f64_trunc(
-; CHECK-NEXT:    ret <3 x half> <half 0xH7E00, half 0xH7E00, half 0xH7E00>
+; CHECK-NEXT:    ret <3 x half> <half nan, half nan, half nan>
 ;
   %f = fptrunc <3 x double> <double 0x7FF0020000000000, double 0x7FF003FFFFFFFFFF, double 0x7FF8000000000001> to <3 x half>
   ret <3 x half> %f
@@ -65,7 +65,7 @@ define <3 x half> @nan_v3f64_trunc() {
 
 define bfloat @nan_bf16_trunc() {
 ; CHECK-LABEL: @nan_bf16_trunc(
-; CHECK-NEXT:    ret bfloat 0xR7FC0
+; CHECK-NEXT:    ret bfloat nan
 ;
   %f = fptrunc double 0x7FF0000000000001 to bfloat
   ret bfloat %f
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/fma.ll b/llvm/test/Transforms/InstSimplify/ConstProp/fma.ll
index d3ade92a6db05a..4e7b11bb4d123e 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/fma.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/fma.ll
@@ -28,7 +28,7 @@ define double @test_all_finite()  {
 ; Test builtin fma with a +/-NaN addend.
 define double @test_NaN_addend()  {
 ; CHECK-LABEL: @test_NaN_addend(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0x7FF8000000000000)
   ret double %1
@@ -45,7 +45,7 @@ define double @test_NaN_addend_2()  {
 ; Test builtin fma with a +/-Inf addend.
 define double @test_Inf_addend()  {
 ; CHECK-LABEL: @test_Inf_addend(
-; CHECK-NEXT:    ret double 0x7FF0000000000000
+; CHECK-NEXT:    ret double pinf
 ;
   %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0x7FF0000000000000)
   ret double %1
@@ -53,7 +53,7 @@ define double @test_Inf_addend()  {
 
 define double @test_Inf_addend_2()  {
 ; CHECK-LABEL: @test_Inf_addend_2(
-; CHECK-NEXT:    ret double 0xFFF0000000000000
+; CHECK-NEXT:    ret double ninf
 ;
   %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0xFFF0000000000000)
   ret double %1
@@ -62,7 +62,7 @@ define double @test_Inf_addend_2()  {
 ; Test builtin fma with one of the operands to the multiply being +/-NaN.
 define double @test_NaN_1()  {
 ; CHECK-LABEL: @test_NaN_1(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 0x7FF8000000000000, double 8.0, double 0.0)
   ret double %1
@@ -70,7 +70,7 @@ define double @test_NaN_1()  {
 
 define double @test_NaN_2()  {
 ; CHECK-LABEL: @test_NaN_2(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 7.0, double 0x7FF8000000000000, double 0.0)
   ret double %1
@@ -95,7 +95,7 @@ define double @test_NaN_4()  {
 ; Test builtin fma with one of the operands to the multiply being +/-Inf.
 define double @test_Inf_1()  {
 ; CHECK-LABEL: @test_Inf_1(
-; CHECK-NEXT:    ret double 0x7FF0000000000000
+; CHECK-NEXT:    ret double pinf
 ;
   %1 = call double @llvm.fma.f64(double 0x7FF0000000000000, double 8.0, double 0.0)
   ret double %1
@@ -103,7 +103,7 @@ define double @test_Inf_1()  {
 
 define double @test_Inf_2()  {
 ; CHECK-LABEL: @test_Inf_2(
-; CHECK-NEXT:    ret double 0x7FF0000000000000
+; CHECK-NEXT:    ret double pinf
 ;
   %1 = call double @llvm.fma.f64(double 7.0, double 0x7FF0000000000000, double 0.0)
   ret double %1
@@ -111,7 +111,7 @@ define double @test_Inf_2()  {
 
 define double @test_Inf_3()  {
 ; CHECK-LABEL: @test_Inf_3(
-; CHECK-NEXT:    ret double 0xFFF0000000000000
+; CHECK-NEXT:    ret double ninf
 ;
   %1 = call double @llvm.fma.f64(double 0xFFF0000000000000, double 8.0, double 0.0)
   ret double %1
@@ -119,7 +119,7 @@ define double @test_Inf_3()  {
 
 define double @test_Inf_4()  {
 ; CHECK-LABEL: @test_Inf_4(
-; CHECK-NEXT:    ret double 0xFFF0000000000000
+; CHECK-NEXT:    ret double ninf
 ;
   %1 = call double @llvm.fma.f64(double 7.0, double 0xFFF0000000000000, double 0.0)
   ret double %1
@@ -129,7 +129,7 @@ define double @test_Inf_4()  {
 
 define double @inf_product_opposite_inf_addend_1()  {
 ; CHECK-LABEL: @inf_product_opposite_inf_addend_1(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 7.0, double 0xFFF0000000000000, double 0x7FF0000000000000)
   ret double %1
@@ -139,7 +139,7 @@ define double @inf_product_opposite_inf_addend_1()  {
 
 define double @inf_product_opposite_inf_addend_2()  {
 ; CHECK-LABEL: @inf_product_opposite_inf_addend_2(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 7.0, double 0x7FF0000000000000, double 0xFFF0000000000000)
   ret double %1
@@ -149,7 +149,7 @@ define double @inf_product_opposite_inf_addend_2()  {
 
 define double @inf_product_opposite_inf_addend_3()  {
 ; CHECK-LABEL: @inf_product_opposite_inf_addend_3(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 0xFFF0000000000000, double 42.0, double 0x7FF0000000000000)
   ret double %1
@@ -159,7 +159,7 @@ define double @inf_product_opposite_inf_addend_3()  {
 
 define double @inf_product_opposite_inf_addend_4()  {
 ; CHECK-LABEL: @inf_product_opposite_inf_addend_4(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 0x7FF0000000000000, double 42.0, double 0xFFF0000000000000)
   ret double %1
@@ -169,7 +169,7 @@ define double @inf_product_opposite_inf_addend_4()  {
 
 define double @inf_times_zero_1()  {
 ; CHECK-LABEL: @inf_times_zero_1(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 0.0, double 0xFFF0000000000000, double 42.0)
   ret double %1
@@ -179,7 +179,7 @@ define double @inf_times_zero_1()  {
 
 define double @inf_times_zero_2()  {
 ; CHECK-LABEL: @inf_times_zero_2(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 0.0, double 0x7FF0000000000000, double 42.0)
   ret double %1
@@ -189,7 +189,7 @@ define double @inf_times_zero_2()  {
 
 define double @inf_times_zero_3()  {
 ; CHECK-LABEL: @inf_times_zero_3(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 0xFFF0000000000000, double 0.0, double 42.0)
   ret double %1
@@ -199,7 +199,7 @@ define double @inf_times_zero_3()  {
 
 define double @inf_times_zero_4()  {
 ; CHECK-LABEL: @inf_times_zero_4(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 0x7FF0000000000000, double 0.0, double 42.0)
   ret double %1
@@ -209,7 +209,7 @@ define double @inf_times_zero_4()  {
 
 define double @inf_times_zero_5()  {
 ; CHECK-LABEL: @inf_times_zero_5(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double -0.0, double 0xFFF0000000000000, double 42.0)
   ret double %1
@@ -219,7 +219,7 @@ define double @inf_times_zero_5()  {
 
 define double @inf_times_zero_6()  {
 ; CHECK-LABEL: @inf_times_zero_6(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double -0.0, double 0x7FF0000000000000, double 42.0)
   ret double %1
@@ -229,7 +229,7 @@ define double @inf_times_zero_6()  {
 
 define double @inf_times_zero_7()  {
 ; CHECK-LABEL: @inf_times_zero_7(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 0xFFF0000000000000, double -0.0, double 42.0)
   ret double %1
@@ -239,7 +239,7 @@ define double @inf_times_zero_7()  {
 
 define double @inf_times_zero_8()  {
 ; CHECK-LABEL: @inf_times_zero_8(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %1 = call double @llvm.fma.f64(double 0x7FF0000000000000, double -0.0, double 42.0)
   ret double %1
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll b/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll
index 6fa57a8a1467ae..6efe1fae479a2a 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/fp-undef.ll
@@ -52,7 +52,7 @@ define double @frem_undef_undef(double %x) {
 
 define float @fadd_undef_op0_nnan_constant(float %x) {
 ; CHECK-LABEL: @fadd_undef_op0_nnan_constant(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fadd nnan float undef, 1.0
   ret float %r
@@ -60,7 +60,7 @@ define float @fadd_undef_op0_nnan_constant(float %x) {
 
 define float @fadd_undef_op1_constant(float %x) {
 ; CHECK-LABEL: @fadd_undef_op1_constant(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fadd float 2.0, undef
   ret float %r
@@ -68,7 +68,7 @@ define float @fadd_undef_op1_constant(float %x) {
 
 define float @fsub_undef_op0_fast_constant(float %x) {
 ; CHECK-LABEL: @fsub_undef_op0_fast_constant(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fsub fast float undef, 3.0
   ret float %r
@@ -76,7 +76,7 @@ define float @fsub_undef_op0_fast_constant(float %x) {
 
 define float @fsub_undef_op1_constant(float %x) {
 ; CHECK-LABEL: @fsub_undef_op1_constant(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fsub float 4.0, undef
   ret float %r
@@ -84,7 +84,7 @@ define float @fsub_undef_op1_constant(float %x) {
 
 define float @fmul_undef_op0_nnan_constant(float %x) {
 ; CHECK-LABEL: @fmul_undef_op0_nnan_constant(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fmul nnan float undef, 5.0
   ret float %r
@@ -92,7 +92,7 @@ define float @fmul_undef_op0_nnan_constant(float %x) {
 
 define float @fmul_undef_op1_constant(float %x) {
 ; CHECK-LABEL: @fmul_undef_op1_constant(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fmul float 6.0, undef
   ret float %r
@@ -100,7 +100,7 @@ define float @fmul_undef_op1_constant(float %x) {
 
 define float @fdiv_undef_op0_fast_constant(float %x) {
 ; CHECK-LABEL: @fdiv_undef_op0_fast_constant(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fdiv fast float undef, 7.0
   ret float %r
@@ -108,7 +108,7 @@ define float @fdiv_undef_op0_fast_constant(float %x) {
 
 define float @fdiv_undef_op1_constant(float %x) {
 ; CHECK-LABEL: @fdiv_undef_op1_constant(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fdiv float 8.0, undef
   ret float %r
@@ -116,7 +116,7 @@ define float @fdiv_undef_op1_constant(float %x) {
 
 define float @frem_undef_op0_nnan_constant(float %x) {
 ; CHECK-LABEL: @frem_undef_op0_nnan_constant(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = frem nnan float undef, 9.0
   ret float %r
@@ -124,7 +124,7 @@ define float @frem_undef_op0_nnan_constant(float %x) {
 
 define float @frem_undef_op1_constant(float %x) {
 ; CHECK-LABEL: @frem_undef_op1_constant(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = frem float 10.0, undef
   ret float %r
@@ -134,7 +134,7 @@ define float @frem_undef_op1_constant(float %x) {
 
 define double @fadd_undef_op0_constant_0(double %x) {
 ; CHECK-LABEL: @fadd_undef_op0_constant_0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fadd double undef, 0x0000000000000000
   ret double %r
@@ -142,7 +142,7 @@ define double @fadd_undef_op0_constant_0(double %x) {
 
 define double @fadd_undef_op1_constant_0(double %x) {
 ; CHECK-LABEL: @fadd_undef_op1_constant_0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fadd double 0x0000000000000000, undef
   ret double %r
@@ -158,7 +158,7 @@ define double @fsub_undef_op0_constant_0(double %x) {
 
 define double @fsub_undef_op1_constant_0(double %x) {
 ; CHECK-LABEL: @fsub_undef_op1_constant_0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fsub double 0x0000000000000000, undef
   ret double %r
@@ -166,7 +166,7 @@ define double @fsub_undef_op1_constant_0(double %x) {
 
 define double @fmul_undef_op0_constant_0(double %x) {
 ; CHECK-LABEL: @fmul_undef_op0_constant_0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fmul double undef, 0x0000000000000000
   ret double %r
@@ -174,7 +174,7 @@ define double @fmul_undef_op0_constant_0(double %x) {
 
 define double @fmul_undef_op1_constant_0(double %x) {
 ; CHECK-LABEL: @fmul_undef_op1_constant_0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fmul double 0x0000000000000000, undef
   ret double %r
@@ -182,7 +182,7 @@ define double @fmul_undef_op1_constant_0(double %x) {
 
 define double @fdiv_undef_op0_constant_0(double %x) {
 ; CHECK-LABEL: @fdiv_undef_op0_constant_0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fdiv double undef, 0x0000000000000000
   ret double %r
@@ -190,7 +190,7 @@ define double @fdiv_undef_op0_constant_0(double %x) {
 
 define double @fdiv_undef_op1_constant_0(double %x) {
 ; CHECK-LABEL: @fdiv_undef_op1_constant_0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fdiv double 0x0000000000000000, undef
   ret double %r
@@ -198,7 +198,7 @@ define double @fdiv_undef_op1_constant_0(double %x) {
 
 define double @frem_undef_op0_constant_0(double %x) {
 ; CHECK-LABEL: @frem_undef_op0_constant_0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = frem double undef, 0x0000000000000000
   ret double %r
@@ -206,7 +206,7 @@ define double @frem_undef_op0_constant_0(double %x) {
 
 define double @frem_undef_op1_constant_0(double %x) {
 ; CHECK-LABEL: @frem_undef_op1_constant_0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = frem double 0x0000000000000000, undef
   ret double %r
@@ -232,7 +232,7 @@ define double @fadd_undef_op1_constant_neg0(double %x) {
 
 define double @fsub_undef_op0_constant_neg0(double %x) {
 ; CHECK-LABEL: @fsub_undef_op0_constant_neg0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fsub double undef, 0x8000000000000000
   ret double %r
@@ -248,7 +248,7 @@ define double @fsub_undef_op1_constant_neg0(double %x) {
 
 define double @fmul_undef_op0_constant_neg0(double %x) {
 ; CHECK-LABEL: @fmul_undef_op0_constant_neg0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fmul double undef, 0x8000000000000000
   ret double %r
@@ -256,7 +256,7 @@ define double @fmul_undef_op0_constant_neg0(double %x) {
 
 define double @fmul_undef_op1_constant_neg0(double %x) {
 ; CHECK-LABEL: @fmul_undef_op1_constant_neg0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fmul double 0x8000000000000000, undef
   ret double %r
@@ -264,7 +264,7 @@ define double @fmul_undef_op1_constant_neg0(double %x) {
 
 define double @fdiv_undef_op0_constant_neg0(double %x) {
 ; CHECK-LABEL: @fdiv_undef_op0_constant_neg0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fdiv double undef, 0x8000000000000000
   ret double %r
@@ -272,7 +272,7 @@ define double @fdiv_undef_op0_constant_neg0(double %x) {
 
 define double @fdiv_undef_op1_constant_neg0(double %x) {
 ; CHECK-LABEL: @fdiv_undef_op1_constant_neg0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fdiv double 0x8000000000000000, undef
   ret double %r
@@ -280,7 +280,7 @@ define double @fdiv_undef_op1_constant_neg0(double %x) {
 
 define double @frem_undef_op0_constant_neg0(double %x) {
 ; CHECK-LABEL: @frem_undef_op0_constant_neg0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = frem double undef, 0x8000000000000000
   ret double %r
@@ -288,7 +288,7 @@ define double @frem_undef_op0_constant_neg0(double %x) {
 
 define double @frem_undef_op1_constant_neg0(double %x) {
 ; CHECK-LABEL: @frem_undef_op1_constant_neg0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = frem double 0x8000000000000000, undef
   ret double %r
@@ -298,7 +298,7 @@ define double @frem_undef_op1_constant_neg0(double %x) {
 
 define double @fadd_undef_op0_constant_nan(double %x) {
 ; CHECK-LABEL: @fadd_undef_op0_constant_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fadd double undef, 0x7FF8000000000000
   ret double %r
@@ -306,7 +306,7 @@ define double @fadd_undef_op0_constant_nan(double %x) {
 
 define double @fadd_undef_op1_fast_constant_nan(double %x) {
 ; CHECK-LABEL: @fadd_undef_op1_fast_constant_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fadd fast double 0xFFF0000000000001, undef
   ret double %r
@@ -314,7 +314,7 @@ define double @fadd_undef_op1_fast_constant_nan(double %x) {
 
 define double @fsub_undef_op0_constant_nan(double %x) {
 ; CHECK-LABEL: @fsub_undef_op0_constant_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fsub double undef, 0xFFF8000000000010
   ret double %r
@@ -322,7 +322,7 @@ define double @fsub_undef_op0_constant_nan(double %x) {
 
 define double @fsub_undef_op1_nnan_constant_nan(double %x) {
 ; CHECK-LABEL: @fsub_undef_op1_nnan_constant_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fsub nnan double 0x7FF0000000000011, undef
   ret double %r
@@ -330,7 +330,7 @@ define double @fsub_undef_op1_nnan_constant_nan(double %x) {
 
 define double @fmul_undef_op0_constant_nan(double %x) {
 ; CHECK-LABEL: @fmul_undef_op0_constant_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fmul double undef, 0x7FF8000000000100
   ret double %r
@@ -338,7 +338,7 @@ define double @fmul_undef_op0_constant_nan(double %x) {
 
 define double @fmul_undef_op1_fast_constant_nan(double %x) {
 ; CHECK-LABEL: @fmul_undef_op1_fast_constant_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fmul fast double 0xFFF0000000000101, undef
   ret double %r
@@ -346,7 +346,7 @@ define double @fmul_undef_op1_fast_constant_nan(double %x) {
 
 define double @fdiv_undef_op0_constant_nan(double %x) {
 ; CHECK-LABEL: @fdiv_undef_op0_constant_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fdiv double undef, 0xFFF8000000000110
   ret double %r
@@ -354,7 +354,7 @@ define double @fdiv_undef_op0_constant_nan(double %x) {
 
 define double @fdiv_undef_op1_nnan_constant_nan(double %x) {
 ; CHECK-LABEL: @fdiv_undef_op1_nnan_constant_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fdiv nnan double 0x7FF0000000000111, undef
   ret double %r
@@ -362,7 +362,7 @@ define double @fdiv_undef_op1_nnan_constant_nan(double %x) {
 
 define double @frem_undef_op0_constant_nan(double %x) {
 ; CHECK-LABEL: @frem_undef_op0_constant_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = frem double undef, 0x7FF8000000001000
   ret double %r
@@ -370,7 +370,7 @@ define double @frem_undef_op0_constant_nan(double %x) {
 
 define double @frem_undef_op1_fast_constant_nan(double %x) {
 ; CHECK-LABEL: @frem_undef_op1_fast_constant_nan(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = frem fast double 0xFFF0000000001001, undef
   ret double %r
@@ -380,7 +380,7 @@ define double @frem_undef_op1_fast_constant_nan(double %x) {
 
 define double @fadd_undef_op0_constant_inf(double %x) {
 ; CHECK-LABEL: @fadd_undef_op0_constant_inf(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fadd double undef, 0x7FF0000000000000
   ret double %r
@@ -388,7 +388,7 @@ define double @fadd_undef_op0_constant_inf(double %x) {
 
 define double @fadd_undef_op1_fast_constant_inf(double %x) {
 ; CHECK-LABEL: @fadd_undef_op1_fast_constant_inf(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fadd fast double 0xFFF0000000000000, undef
   ret double %r
@@ -396,7 +396,7 @@ define double @fadd_undef_op1_fast_constant_inf(double %x) {
 
 define double @fsub_undef_op0_constant_inf(double %x) {
 ; CHECK-LABEL: @fsub_undef_op0_constant_inf(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fsub double undef, 0xFFF0000000000000
   ret double %r
@@ -404,7 +404,7 @@ define double @fsub_undef_op0_constant_inf(double %x) {
 
 define double @fsub_undef_op1_ninf_constant_inf(double %x) {
 ; CHECK-LABEL: @fsub_undef_op1_ninf_constant_inf(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fsub ninf double 0x7FF0000000000000, undef
   ret double %r
@@ -412,7 +412,7 @@ define double @fsub_undef_op1_ninf_constant_inf(double %x) {
 
 define double @fmul_undef_op0_constant_inf(double %x) {
 ; CHECK-LABEL: @fmul_undef_op0_constant_inf(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fmul double undef, 0x7FF0000000000000
   ret double %r
@@ -420,7 +420,7 @@ define double @fmul_undef_op0_constant_inf(double %x) {
 
 define double @fmul_undef_op1_fast_constant_inf(double %x) {
 ; CHECK-LABEL: @fmul_undef_op1_fast_constant_inf(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fmul fast double 0xFFF0000000000000, undef
   ret double %r
@@ -428,7 +428,7 @@ define double @fmul_undef_op1_fast_constant_inf(double %x) {
 
 define double @fdiv_undef_op0_constant_inf(double %x) {
 ; CHECK-LABEL: @fdiv_undef_op0_constant_inf(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fdiv double undef, 0xFFF0000000000000
   ret double %r
@@ -436,7 +436,7 @@ define double @fdiv_undef_op0_constant_inf(double %x) {
 
 define double @fdiv_undef_op1_ninf_constant_inf(double %x) {
 ; CHECK-LABEL: @fdiv_undef_op1_ninf_constant_inf(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fdiv ninf double 0x7FF0000000000000, undef
   ret double %r
@@ -444,7 +444,7 @@ define double @fdiv_undef_op1_ninf_constant_inf(double %x) {
 
 define double @frem_undef_op0_constant_inf(double %x) {
 ; CHECK-LABEL: @frem_undef_op0_constant_inf(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = frem double undef, 0x7FF0000000000000
   ret double %r
@@ -452,7 +452,7 @@ define double @frem_undef_op0_constant_inf(double %x) {
 
 define double @frem_undef_op1_fast_constant_inf(double %x) {
 ; CHECK-LABEL: @frem_undef_op1_fast_constant_inf(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = frem fast double 0xFFF0000000000000, undef
   ret double %r
@@ -460,7 +460,7 @@ define double @frem_undef_op1_fast_constant_inf(double %x) {
 
 define <2 x double> @fadd_undef_op1_constant_vec(<2 x double> %x) {
 ; CHECK-LABEL: @fadd_undef_op1_constant_vec(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = fadd <2 x double> <double 42.0, double undef>, undef
   ret <2 x double> %r
@@ -468,7 +468,7 @@ define <2 x double> @fadd_undef_op1_constant_vec(<2 x double> %x) {
 
 define <2 x double> @fadd_undef_op0_constant_vec(<2 x double> %x) {
 ; CHECK-LABEL: @fadd_undef_op0_constant_vec(
-; CHECK-NEXT:    ret <2 x double> <double undef, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double undef, double nan>
 ;
   %r = fadd <2 x double> undef, <double undef, double 42.0>
   ret <2 x double> %r
@@ -476,7 +476,7 @@ define <2 x double> @fadd_undef_op0_constant_vec(<2 x double> %x) {
 
 define <2 x double> @fsub_undef_op1_constant_vec(<2 x double> %x) {
 ; CHECK-LABEL: @fsub_undef_op1_constant_vec(
-; CHECK-NEXT:    ret <2 x double> <double undef, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double undef, double nan>
 ;
   %r = fsub <2 x double> <double undef, double 42.0>, undef
   ret <2 x double> %r
@@ -484,7 +484,7 @@ define <2 x double> @fsub_undef_op1_constant_vec(<2 x double> %x) {
 
 define <2 x double> @fsub_undef_op0_constant_vec(<2 x double> %x) {
 ; CHECK-LABEL: @fsub_undef_op0_constant_vec(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = fsub <2 x double> undef, <double 42.0, double undef>
   ret <2 x double> %r
@@ -492,7 +492,7 @@ define <2 x double> @fsub_undef_op0_constant_vec(<2 x double> %x) {
 
 define <2 x double> @fmul_undef_op1_constant_vec(<2 x double> %x) {
 ; CHECK-LABEL: @fmul_undef_op1_constant_vec(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = fmul <2 x double> <double 42.0, double undef>, undef
   ret <2 x double> %r
@@ -500,7 +500,7 @@ define <2 x double> @fmul_undef_op1_constant_vec(<2 x double> %x) {
 
 define <2 x double> @fmul_undef_op0_constant_vec(<2 x double> %x) {
 ; CHECK-LABEL: @fmul_undef_op0_constant_vec(
-; CHECK-NEXT:    ret <2 x double> <double undef, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double undef, double nan>
 ;
   %r = fmul <2 x double> undef, <double undef, double 42.0>
   ret <2 x double> %r
@@ -508,7 +508,7 @@ define <2 x double> @fmul_undef_op0_constant_vec(<2 x double> %x) {
 
 define <2 x double> @fdiv_undef_op1_constant_vec(<2 x double> %x) {
 ; CHECK-LABEL: @fdiv_undef_op1_constant_vec(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = fdiv <2 x double> <double 42.0, double undef>, undef
   ret <2 x double> %r
@@ -516,7 +516,7 @@ define <2 x double> @fdiv_undef_op1_constant_vec(<2 x double> %x) {
 
 define <2 x double> @fdiv_undef_op0_constant_vec(<2 x double> %x) {
 ; CHECK-LABEL: @fdiv_undef_op0_constant_vec(
-; CHECK-NEXT:    ret <2 x double> <double undef, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double undef, double nan>
 ;
   %r = fdiv <2 x double> undef, <double undef, double 42.0>
   ret <2 x double> %r
@@ -524,7 +524,7 @@ define <2 x double> @fdiv_undef_op0_constant_vec(<2 x double> %x) {
 
 define <2 x double> @frem_undef_op1_constant_vec(<2 x double> %x) {
 ; CHECK-LABEL: @frem_undef_op1_constant_vec(
-; CHECK-NEXT:    ret <2 x double> <double undef, double 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x double> <double undef, double nan>
 ;
   %r = frem <2 x double> <double undef, double 42.0>, undef
   ret <2 x double> %r
@@ -532,7 +532,7 @@ define <2 x double> @frem_undef_op1_constant_vec(<2 x double> %x) {
 
 define <2 x double> @frem_undef_op0_constant_vec(<2 x double> %x) {
 ; CHECK-LABEL: @frem_undef_op0_constant_vec(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = frem <2 x double> undef, <double 42.0, double undef>
   ret <2 x double> %r
@@ -540,7 +540,7 @@ define <2 x double> @frem_undef_op0_constant_vec(<2 x double> %x) {
 
 define <2 x double> @maximum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) {
 ; CHECK-LABEL: @maximum_nan_op0_vec_partial_undef_op1_undef(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = call <2 x double> @llvm.maximum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> undef)
   ret <2 x double> %r
@@ -548,7 +548,7 @@ define <2 x double> @maximum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x
 
 define <2 x double> @maximum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) {
 ; CHECK-LABEL: @maximum_nan_op1_vec_partial_undef_op0_undef(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = call <2 x double> @llvm.maximum.v2f64(<2 x double> undef, <2 x double> <double 0x7ff8000000000000, double undef>)
   ret <2 x double> %r
@@ -556,7 +556,7 @@ define <2 x double> @maximum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x
 
 define <2 x double> @minimum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) {
 ; CHECK-LABEL: @minimum_nan_op0_vec_partial_undef_op1_undef(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = call <2 x double> @llvm.minimum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> undef)
   ret <2 x double> %r
@@ -564,7 +564,7 @@ define <2 x double> @minimum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x
 
 define <2 x double> @minimum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) {
 ; CHECK-LABEL: @minimum_nan_op1_vec_partial_undef_op0_undef(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = call <2 x double> @llvm.minimum.v2f64(<2 x double> undef, <2 x double> <double 0x7ff8000000000000, double undef>)
   ret <2 x double> %r
@@ -572,7 +572,7 @@ define <2 x double> @minimum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x
 
 define <2 x double> @maxnum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) {
 ; CHECK-LABEL: @maxnum_nan_op0_vec_partial_undef_op1_undef(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = call <2 x double> @llvm.maxnum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> undef)
   ret <2 x double> %r
@@ -580,7 +580,7 @@ define <2 x double> @maxnum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x)
 
 define <2 x double> @maxnum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) {
 ; CHECK-LABEL: @maxnum_nan_op1_vec_partial_undef_op0_undef(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = call <2 x double> @llvm.maxnum.v2f64(<2 x double> undef, <2 x double> <double 0x7ff8000000000000, double undef>)
   ret <2 x double> %r
@@ -588,7 +588,7 @@ define <2 x double> @maxnum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x)
 
 define <2 x double> @minnum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) {
 ; CHECK-LABEL: @minnum_nan_op0_vec_partial_undef_op1_undef(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = call <2 x double> @llvm.minnum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> undef)
   ret <2 x double> %r
@@ -596,7 +596,7 @@ define <2 x double> @minnum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x)
 
 define <2 x double> @minnum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) {
 ; CHECK-LABEL: @minnum_nan_op1_vec_partial_undef_op0_undef(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double undef>
+; CHECK-NEXT:    ret <2 x double> <double nan, double undef>
 ;
   %r = call <2 x double> @llvm.minnum.v2f64(<2 x double> undef, <2 x double> <double 0x7ff8000000000000, double undef>)
   ret <2 x double> %r
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/min-max.ll b/llvm/test/Transforms/InstSimplify/ConstProp/min-max.ll
index 9120649eb5c4f1..6981ec5a909720 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/min-max.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/min-max.ll
@@ -101,7 +101,7 @@ define half @minnum_half() {
 
 define <4 x float> @minnum_float_vec() {
 ; CHECK-LABEL: @minnum_float_vec(
-; CHECK-NEXT:    ret <4 x float> <float 0x7FF8000000000000, float 5.000000e+00, float 4.200000e+01, float 5.000000e+00>
+; CHECK-NEXT:    ret <4 x float> <float nan, float 5.000000e+00, float 4.200000e+01, float 5.000000e+00>
 ;
   %1 = call <4 x float> @llvm.minnum.v4f32(<4 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000, float 42., float 42.>, <4 x float> <float 0x7FF8000000000000, float 5., float 0x7FF8000000000000, float 5.>)
   ret <4 x float> %1
@@ -109,7 +109,7 @@ define <4 x float> @minnum_float_vec() {
 
 define <4 x bfloat> @minnum_bfloat_vec() {
 ; CHECK-LABEL: @minnum_bfloat_vec(
-; CHECK-NEXT:    ret <4 x bfloat> <bfloat 0xR7FC0, bfloat 0xR40A0, bfloat 0xR4228, bfloat 0xR40A0>
+; CHECK-NEXT:    ret <4 x bfloat> <bfloat nan, bfloat 0xR40A0, bfloat 0xR4228, bfloat 0xR40A0>
 ;
   %1 = call <4 x bfloat> @llvm.minnum.v4bf16(<4 x bfloat> <bfloat 0x7FF8000000000000, bfloat 0x7FF8000000000000, bfloat 42., bfloat 42.>, <4 x bfloat> <bfloat 0x7FF8000000000000, bfloat 5., bfloat 0x7FF8000000000000, bfloat 5.>)
   ret <4 x bfloat> %1
@@ -117,7 +117,7 @@ define <4 x bfloat> @minnum_bfloat_vec() {
 
 define <4 x half> @minnum_half_vec() {
 ; CHECK-LABEL: @minnum_half_vec(
-; CHECK-NEXT:    ret <4 x half> <half 0xH7E00, half 0xH4500, half 0xH5140, half 0xH4500>
+; CHECK-NEXT:    ret <4 x half> <half nan, half 0xH4500, half 0xH5140, half 0xH4500>
 ;
   %1 = call <4 x half> @llvm.minnum.v4f16(<4 x half> <half 0x7FF8000000000000, half 0x7FF8000000000000, half 42., half 42.>, <4 x half> <half 0x7FF8000000000000, half 5., half 0x7FF8000000000000, half 5.>)
   ret <4 x half> %1
@@ -193,7 +193,7 @@ define half @maxnum_half() {
 
 define <4 x float> @maxnum_float_vec() {
 ; CHECK-LABEL: @maxnum_float_vec(
-; CHECK-NEXT:    ret <4 x float> <float 0x7FF8000000000000, float 5.000000e+00, float 4.200000e+01, float 4.200000e+01>
+; CHECK-NEXT:    ret <4 x float> <float nan, float 5.000000e+00, float 4.200000e+01, float 4.200000e+01>
 ;
   %1 = call <4 x float> @llvm.maxnum.v4f32(<4 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000, float 42., float 42.>, <4 x float> <float 0x7FF8000000000000, float 5., float 0x7FF8000000000000, float 5.>)
   ret <4 x float> %1
@@ -201,7 +201,7 @@ define <4 x float> @maxnum_float_vec() {
 
 define <4 x bfloat> @maxnum_bfloat_vec() {
 ; CHECK-LABEL: @maxnum_bfloat_vec(
-; CHECK-NEXT:    ret <4 x bfloat> <bfloat 0xR7FC0, bfloat 0xR40A0, bfloat 0xR4228, bfloat 0xR4228>
+; CHECK-NEXT:    ret <4 x bfloat> <bfloat nan, bfloat 0xR40A0, bfloat 0xR4228, bfloat 0xR4228>
 ;
   %1 = call <4 x bfloat> @llvm.maxnum.v4bf16(<4 x bfloat> <bfloat 0x7FF8000000000000, bfloat 0x7FF8000000000000, bfloat 42., bfloat 42.>, <4 x bfloat> <bfloat 0x7FF8000000000000, bfloat 5., bfloat 0x7FF8000000000000, bfloat 5.>)
   ret <4 x bfloat> %1
@@ -209,7 +209,7 @@ define <4 x bfloat> @maxnum_bfloat_vec() {
 
 define <4 x half> @maxnum_half_vec() {
 ; CHECK-LABEL: @maxnum_half_vec(
-; CHECK-NEXT:    ret <4 x half> <half 0xH7E00, half 0xH4500, half 0xH5140, half 0xH5140>
+; CHECK-NEXT:    ret <4 x half> <half nan, half 0xH4500, half 0xH5140, half 0xH5140>
 ;
   %1 = call <4 x half> @llvm.maxnum.v4f16(<4 x half> <half 0x7FF8000000000000, half 0x7FF8000000000000, half 42., half 42.>, <4 x half> <half 0x7FF8000000000000, half 5., half 0x7FF8000000000000, half 5.>)
   ret <4 x half> %1
@@ -253,7 +253,7 @@ define half @minimum_half() {
 
 define <4 x float> @minimum_float_vec() {
 ; CHECK-LABEL: @minimum_float_vec(
-; CHECK-NEXT:    ret <4 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000, float 5.000000e+00>
+; CHECK-NEXT:    ret <4 x float> <float nan, float nan, float nan, float 5.000000e+00>
 ;
   %1 = call <4 x float> @llvm.minimum.v4f32(<4 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000, float 42., float 42.>, <4 x float> <float 0x7FF8000000000000, float 5., float 0x7FF8000000000000, float 5.>)
   ret <4 x float> %1
@@ -261,7 +261,7 @@ define <4 x float> @minimum_float_vec() {
 
 define <4 x bfloat> @minimum_bfloat_vec() {
 ; CHECK-LABEL: @minimum_bfloat_vec(
-; CHECK-NEXT:    ret <4 x bfloat> <bfloat 0xR7FC0, bfloat 0xR7FC0, bfloat 0xR7FC0, bfloat 0xR40A0>
+; CHECK-NEXT:    ret <4 x bfloat> <bfloat nan, bfloat nan, bfloat nan, bfloat 0xR40A0>
 ;
   %1 = call <4 x bfloat> @llvm.minimum.v4bf16(<4 x bfloat> <bfloat 0x7FF8000000000000, bfloat 0x7FF8000000000000, bfloat 42., bfloat 42.>, <4 x bfloat> <bfloat 0x7FF8000000000000, bfloat 5., bfloat 0x7FF8000000000000, bfloat 5.>)
   ret <4 x bfloat> %1
@@ -269,7 +269,7 @@ define <4 x bfloat> @minimum_bfloat_vec() {
 
 define <4 x half> @minimum_half_vec() {
 ; CHECK-LABEL: @minimum_half_vec(
-; CHECK-NEXT:    ret <4 x half> <half 0xH7E00, half 0xH7E00, half 0xH7E00, half 0xH4500>
+; CHECK-NEXT:    ret <4 x half> <half nan, half nan, half nan, half 0xH4500>
 ;
   %1 = call <4 x half> @llvm.minimum.v4f16(<4 x half> <half 0x7FF8000000000000, half 0x7FF8000000000000, half 42., half 42.>, <4 x half> <half 0x7FF8000000000000, half 5., half 0x7FF8000000000000, half 5.>)
   ret <4 x half> %1
@@ -313,7 +313,7 @@ define half @maximum_half() {
 
 define <4 x float> @maximum_float_vec() {
 ; CHECK-LABEL: @maximum_float_vec(
-; CHECK-NEXT:    ret <4 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000, float 4.200000e+01>
+; CHECK-NEXT:    ret <4 x float> <float nan, float nan, float nan, float 4.200000e+01>
 ;
   %1 = call <4 x float> @llvm.maximum.v4f32(<4 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000, float 42., float 42.>, <4 x float> <float 0x7FF8000000000000, float 5., float 0x7FF8000000000000, float 5.>)
   ret <4 x float> %1
@@ -321,7 +321,7 @@ define <4 x float> @maximum_float_vec() {
 
 define <4 x bfloat> @maximum_bfloat_vec() {
 ; CHECK-LABEL: @maximum_bfloat_vec(
-; CHECK-NEXT:    ret <4 x bfloat> <bfloat 0xR7FC0, bfloat 0xR7FC0, bfloat 0xR7FC0, bfloat 0xR4228>
+; CHECK-NEXT:    ret <4 x bfloat> <bfloat nan, bfloat nan, bfloat nan, bfloat 0xR4228>
 ;
   %1 = call <4 x bfloat> @llvm.maximum.v4bf16(<4 x bfloat> <bfloat 0x7FF8000000000000, bfloat 0x7FF8000000000000, bfloat 42., bfloat 42.>, <4 x bfloat> <bfloat 0x7FF8000000000000, bfloat 5., bfloat 0x7FF8000000000000, bfloat 5.>)
   ret <4 x bfloat> %1
@@ -329,7 +329,7 @@ define <4 x bfloat> @maximum_bfloat_vec() {
 
 define <4 x half> @maximum_half_vec() {
 ; CHECK-LABEL: @maximum_half_vec(
-; CHECK-NEXT:    ret <4 x half> <half 0xH7E00, half 0xH7E00, half 0xH7E00, half 0xH5140>
+; CHECK-NEXT:    ret <4 x half> <half nan, half nan, half nan, half 0xH5140>
 ;
   %1 = call <4 x half> @llvm.maximum.v4f16(<4 x half> <half 0x7FF8000000000000, half 0x7FF8000000000000, half 42., half 42.>, <4 x half> <half 0x7FF8000000000000, half 5., half 0x7FF8000000000000, half 5.>)
   ret <4 x half> %1
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/vector-undef-elts-inseltpoison.ll b/llvm/test/Transforms/InstSimplify/ConstProp/vector-undef-elts-inseltpoison.ll
index 08ec5dfbab774f..5470e92a803142 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/vector-undef-elts-inseltpoison.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/vector-undef-elts-inseltpoison.ll
@@ -45,7 +45,7 @@ define <3 x i8> @or_commute() {
 
 define <3 x float> @fadd() {
 ; CHECK-LABEL: @fadd(
-; CHECK-NEXT:    ret <3 x float> <float undef, float 0x7FF8000000000000, float undef>
+; CHECK-NEXT:    ret <3 x float> <float undef, float nan, float undef>
 ;
   %c = fadd <3 x float> <float undef, float 42.0, float undef>, undef
   ret <3 x float> %c
@@ -53,7 +53,7 @@ define <3 x float> @fadd() {
 
 define <3 x float> @fadd_commute() {
 ; CHECK-LABEL: @fadd_commute(
-; CHECK-NEXT:    ret <3 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000, float undef>
+; CHECK-NEXT:    ret <3 x float> <float nan, float nan, float undef>
 ;
   %c = fadd <3 x float> undef, <float -42.0, float 42.0, float undef>
   ret <3 x float> %c
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/vector-undef-elts.ll b/llvm/test/Transforms/InstSimplify/ConstProp/vector-undef-elts.ll
index 0e29e8c53f330e..30852355b0cb0b 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/vector-undef-elts.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/vector-undef-elts.ll
@@ -45,7 +45,7 @@ define <3 x i8> @or_commute() {
 
 define <3 x float> @fadd() {
 ; CHECK-LABEL: @fadd(
-; CHECK-NEXT:    ret <3 x float> <float undef, float 0x7FF8000000000000, float undef>
+; CHECK-NEXT:    ret <3 x float> <float undef, float nan, float undef>
 ;
   %c = fadd <3 x float> <float undef, float 42.0, float undef>, undef
   ret <3 x float> %c
@@ -53,7 +53,7 @@ define <3 x float> @fadd() {
 
 define <3 x float> @fadd_commute() {
 ; CHECK-LABEL: @fadd_commute(
-; CHECK-NEXT:    ret <3 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000, float undef>
+; CHECK-NEXT:    ret <3 x float> <float nan, float nan, float undef>
 ;
   %c = fadd <3 x float> undef, <float -42.0, float 42.0, float undef>
   ret <3 x float> %c
diff --git a/llvm/test/Transforms/InstSimplify/X86/fp-nan-strictfp.ll b/llvm/test/Transforms/InstSimplify/X86/fp-nan-strictfp.ll
index a9f0662629347c..04b967279f1759 100644
--- a/llvm/test/Transforms/InstSimplify/X86/fp-nan-strictfp.ll
+++ b/llvm/test/Transforms/InstSimplify/X86/fp-nan-strictfp.ll
@@ -7,7 +7,7 @@
 
 define float @fadd_nan_op0_strict(float %x) #0 {
 ; CHECK-LABEL: @fadd_nan_op0_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF8000000000000, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float nan, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.strict")
@@ -16,7 +16,7 @@ define float @fadd_nan_op0_strict(float %x) #0 {
 
 define float @fadd_nan_op0_maytrap(float %x) #0 {
 ; CHECK-LABEL: @fadd_nan_op0_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -24,7 +24,7 @@ define float @fadd_nan_op0_maytrap(float %x) #0 {
 
 define float @fadd_nan_op0_upward(float %x) #0 {
 ; CHECK-LABEL: @fadd_nan_op0_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF8000000000000, float %x, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -32,7 +32,7 @@ define float @fadd_nan_op0_upward(float %x) #0 {
 
 define float @fadd_nan_op0_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fadd_nan_op0_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF8000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -40,7 +40,7 @@ define float @fadd_nan_op0_defaultfp(float %x) #0 {
 
 define float @fadd_nan_op1_strict(float %x) #0 {
 ; CHECK-LABEL: @fadd_nan_op1_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float [[X:%.*]], float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float [[X:%.*]], float nan, metadata !"round.dynamic", metadata !"fpexcept.strict")
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.fadd.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
@@ -49,7 +49,7 @@ define float @fadd_nan_op1_strict(float %x) #0 {
 
 define float @fadd_nan_op1_maytrap(float %x) #0 {
 ; CHECK-LABEL: @fadd_nan_op1_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fadd.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -57,7 +57,7 @@ define float @fadd_nan_op1_maytrap(float %x) #0 {
 
 define float @fadd_nan_op1_upward(float %x) #0 {
 ; CHECK-LABEL: @fadd_nan_op1_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fadd.f32(float %x, float 0x7FF8000000000000, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -65,7 +65,7 @@ define float @fadd_nan_op1_upward(float %x) #0 {
 
 define float @fadd_nan_op1_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fadd_nan_op1_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fadd.f32(float %x, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -77,7 +77,7 @@ define float @fadd_nan_op1_defaultfp(float %x) #0 {
 
 define float @fsub_nan_op0_strict(float %x) #0 {
 ; CHECK-LABEL: @fsub_nan_op0_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fsub.f32(float 0x7FF8000000000000, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fsub.f32(float nan, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.fsub.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.strict")
@@ -86,7 +86,7 @@ define float @fsub_nan_op0_strict(float %x) #0 {
 
 define float @fsub_nan_op0_maytrap(float %x) #0 {
 ; CHECK-LABEL: @fsub_nan_op0_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fsub.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -94,7 +94,7 @@ define float @fsub_nan_op0_maytrap(float %x) #0 {
 
 define float @fsub_nan_op0_upward(float %x) #0 {
 ; CHECK-LABEL: @fsub_nan_op0_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fsub.f32(float 0x7FF8000000000000, float %x, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -102,7 +102,7 @@ define float @fsub_nan_op0_upward(float %x) #0 {
 
 define float @fsub_nan_op0_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fsub_nan_op0_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fsub.f32(float 0x7FF8000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -110,7 +110,7 @@ define float @fsub_nan_op0_defaultfp(float %x) #0 {
 
 define float @fsub_nan_op1_strict(float %x) #0 {
 ; CHECK-LABEL: @fsub_nan_op1_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fsub.f32(float [[X:%.*]], float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fsub.f32(float [[X:%.*]], float nan, metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR0:[0-9]+]]
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.fsub.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict") #0
@@ -119,7 +119,7 @@ define float @fsub_nan_op1_strict(float %x) #0 {
 
 define float @fsub_nan_op1_maytrap(float %x) #0 {
 ; CHECK-LABEL: @fsub_nan_op1_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fsub.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -127,7 +127,7 @@ define float @fsub_nan_op1_maytrap(float %x) #0 {
 
 define float @fsub_nan_op1_upward(float %x) #0 {
 ; CHECK-LABEL: @fsub_nan_op1_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fsub.f32(float %x, float 0x7FF8000000000000, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -135,7 +135,7 @@ define float @fsub_nan_op1_upward(float %x) #0 {
 
 define float @fsub_nan_op1_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fsub_nan_op1_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fsub.f32(float %x, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -147,7 +147,7 @@ define float @fsub_nan_op1_defaultfp(float %x) #0 {
 
 define float @fmul_nan_op0_strict(float %x) #0 {
 ; CHECK-LABEL: @fmul_nan_op0_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fmul.f32(float 0x7FF8000000000000, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fmul.f32(float nan, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.fmul.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.strict")
@@ -156,7 +156,7 @@ define float @fmul_nan_op0_strict(float %x) #0 {
 
 define float @fmul_nan_op0_maytrap(float %x) #0 {
 ; CHECK-LABEL: @fmul_nan_op0_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fmul.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -164,7 +164,7 @@ define float @fmul_nan_op0_maytrap(float %x) #0 {
 
 define float @fmul_nan_op0_upward(float %x) #0 {
 ; CHECK-LABEL: @fmul_nan_op0_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fmul.f32(float 0x7FF8000000000000, float %x, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -172,7 +172,7 @@ define float @fmul_nan_op0_upward(float %x) #0 {
 
 define float @fmul_nan_op0_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fmul_nan_op0_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fmul.f32(float 0x7FF8000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -180,7 +180,7 @@ define float @fmul_nan_op0_defaultfp(float %x) #0 {
 
 define float @fmul_nan_op1_strict(float %x) #0 {
 ; CHECK-LABEL: @fmul_nan_op1_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fmul.f32(float [[X:%.*]], float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fmul.f32(float [[X:%.*]], float nan, metadata !"round.dynamic", metadata !"fpexcept.strict")
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.fmul.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
@@ -189,7 +189,7 @@ define float @fmul_nan_op1_strict(float %x) #0 {
 
 define float @fmul_nan_op1_maytrap(float %x) #0 {
 ; CHECK-LABEL: @fmul_nan_op1_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fmul.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -197,7 +197,7 @@ define float @fmul_nan_op1_maytrap(float %x) #0 {
 
 define float @fmul_nan_op1_upward(float %x) #0 {
 ; CHECK-LABEL: @fmul_nan_op1_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fmul.f32(float %x, float 0x7FF8000000000000, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -205,7 +205,7 @@ define float @fmul_nan_op1_upward(float %x) #0 {
 
 define float @fmul_nan_op1_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fmul_nan_op1_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fmul.f32(float %x, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -217,7 +217,7 @@ define float @fmul_nan_op1_defaultfp(float %x) #0 {
 
 define float @fdiv_nan_op0_strict(float %x) #0 {
 ; CHECK-LABEL: @fdiv_nan_op0_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fdiv.f32(float 0x7FF8000000000000, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fdiv.f32(float nan, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.fdiv.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.strict")
@@ -226,7 +226,7 @@ define float @fdiv_nan_op0_strict(float %x) #0 {
 
 define float @fdiv_nan_op0_maytrap(float %x) #0 {
 ; CHECK-LABEL: @fdiv_nan_op0_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fdiv.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -234,7 +234,7 @@ define float @fdiv_nan_op0_maytrap(float %x) #0 {
 
 define float @fdiv_nan_op0_upward(float %x) #0 {
 ; CHECK-LABEL: @fdiv_nan_op0_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fdiv.f32(float 0x7FF8000000000000, float %x, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -242,7 +242,7 @@ define float @fdiv_nan_op0_upward(float %x) #0 {
 
 define float @fdiv_nan_op0_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fdiv_nan_op0_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fdiv.f32(float 0x7FF8000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -250,7 +250,7 @@ define float @fdiv_nan_op0_defaultfp(float %x) #0 {
 
 define float @fdiv_nan_op1_strict(float %x) #0 {
 ; CHECK-LABEL: @fdiv_nan_op1_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fdiv.f32(float [[X:%.*]], float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fdiv.f32(float [[X:%.*]], float nan, metadata !"round.dynamic", metadata !"fpexcept.strict")
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.fdiv.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
@@ -259,7 +259,7 @@ define float @fdiv_nan_op1_strict(float %x) #0 {
 
 define float @fdiv_nan_op1_maytrap(float %x) #0 {
 ; CHECK-LABEL: @fdiv_nan_op1_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fdiv.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -267,7 +267,7 @@ define float @fdiv_nan_op1_maytrap(float %x) #0 {
 
 define float @fdiv_nan_op1_upward(float %x) #0 {
 ; CHECK-LABEL: @fdiv_nan_op1_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fdiv.f32(float %x, float 0x7FF8000000000000, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -275,7 +275,7 @@ define float @fdiv_nan_op1_upward(float %x) #0 {
 
 define float @fdiv_nan_op1_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fdiv_nan_op1_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fdiv.f32(float %x, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -287,7 +287,7 @@ define float @fdiv_nan_op1_defaultfp(float %x) #0 {
 
 define float @frem_nan_op0_strict(float %x) #0 {
 ; CHECK-LABEL: @frem_nan_op0_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.frem.f32(float 0x7FF8000000000000, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.frem.f32(float nan, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.frem.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.strict")
@@ -296,7 +296,7 @@ define float @frem_nan_op0_strict(float %x) #0 {
 
 define float @frem_nan_op0_maytrap(float %x) #0 {
 ; CHECK-LABEL: @frem_nan_op0_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.frem.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -304,7 +304,7 @@ define float @frem_nan_op0_maytrap(float %x) #0 {
 
 define float @frem_nan_op0_upward(float %x) #0 {
 ; CHECK-LABEL: @frem_nan_op0_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.frem.f32(float 0x7FF8000000000000, float %x, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -312,7 +312,7 @@ define float @frem_nan_op0_upward(float %x) #0 {
 
 define float @frem_nan_op0_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @frem_nan_op0_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.frem.f32(float 0x7FF8000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -320,7 +320,7 @@ define float @frem_nan_op0_defaultfp(float %x) #0 {
 
 define float @frem_nan_op1_strict(float %x) #0 {
 ; CHECK-LABEL: @frem_nan_op1_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.frem.f32(float [[X:%.*]], float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.frem.f32(float [[X:%.*]], float nan, metadata !"round.dynamic", metadata !"fpexcept.strict")
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.frem.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
@@ -329,7 +329,7 @@ define float @frem_nan_op1_strict(float %x) #0 {
 
 define float @frem_nan_op1_maytrap(float %x) #0 {
 ; CHECK-LABEL: @frem_nan_op1_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.frem.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -337,7 +337,7 @@ define float @frem_nan_op1_maytrap(float %x) #0 {
 
 define float @frem_nan_op1_upward(float %x) #0 {
 ; CHECK-LABEL: @frem_nan_op1_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.frem.f32(float %x, float 0x7FF8000000000000, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -345,7 +345,7 @@ define float @frem_nan_op1_upward(float %x) #0 {
 
 define float @frem_nan_op1_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @frem_nan_op1_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.frem.f32(float %x, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -357,7 +357,7 @@ define float @frem_nan_op1_defaultfp(float %x) #0 {
 
 define float @fma_nan_op0_strict(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_nan_op0_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fma.f32(float 0x7FF8000000000000, float [[X:%.*]], float [[Y:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fma.f32(float nan, float [[X:%.*]], float [[Y:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float 0x7FF8000000000000, float %x, float %y, metadata !"round.dynamic", metadata !"fpexcept.strict")
@@ -366,7 +366,7 @@ define float @fma_nan_op0_strict(float %x, float %y) #0 {
 
 define float @fma_nan_op0_maytrap(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_nan_op0_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float 0x7FF8000000000000, float %x, float %y, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -374,7 +374,7 @@ define float @fma_nan_op0_maytrap(float %x, float %y) #0 {
 
 define float @fma_nan_op0_upward(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_nan_op0_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float 0x7FF8000000000000, float %x, float %y, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -382,7 +382,7 @@ define float @fma_nan_op0_upward(float %x, float %y) #0 {
 
 define float @fma_nan_op0_defaultfp(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_nan_op0_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float 0x7FF8000000000000, float %x, float %y, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -390,7 +390,7 @@ define float @fma_nan_op0_defaultfp(float %x, float %y) #0 {
 
 define float @fma_nan_op1_strict(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_nan_op1_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fma.f32(float [[X:%.*]], float 0x7FF8000000000000, float [[Y:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fma.f32(float [[X:%.*]], float nan, float [[Y:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float %x, float 0x7FF8000000000000, float %y, metadata !"round.dynamic", metadata !"fpexcept.strict")
@@ -399,7 +399,7 @@ define float @fma_nan_op1_strict(float %x, float %y) #0 {
 
 define float @fma_nan_op1_maytrap(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_nan_op1_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float %x, float 0x7FF8000000000000, float %y, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -407,7 +407,7 @@ define float @fma_nan_op1_maytrap(float %x, float %y) #0 {
 
 define float @fma_nan_op1_upward(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_nan_op1_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float %x, float 0x7FF8000000000000, float %y, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -415,7 +415,7 @@ define float @fma_nan_op1_upward(float %x, float %y) #0 {
 
 define float @fma_nan_op1_defaultfp(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_nan_op1_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float %x, float 0x7FF8000000000000, float %y, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -423,7 +423,7 @@ define float @fma_nan_op1_defaultfp(float %x, float %y) #0 {
 
 define float @fma_nan_op2_strict(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_nan_op2_strict(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fma.f32(float [[X:%.*]], float [[Y:%.*]], float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.experimental.constrained.fma.f32(float [[X:%.*]], float [[Y:%.*]], float nan, metadata !"round.dynamic", metadata !"fpexcept.strict")
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float %x, float %y, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
@@ -432,7 +432,7 @@ define float @fma_nan_op2_strict(float %x, float %y) #0 {
 
 define float @fma_nan_op2_maytrap(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_nan_op2_maytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float %x, float %y, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
   ret float %r
@@ -440,7 +440,7 @@ define float @fma_nan_op2_maytrap(float %x, float %y) #0 {
 
 define float @fma_nan_op2_upward(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_nan_op2_upward(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float %x, float %y, float 0x7FF8000000000000, metadata !"round.upward", metadata !"fpexcept.ignore")
   ret float %r
@@ -448,7 +448,7 @@ define float @fma_nan_op2_upward(float %x, float %y) #0 {
 
 define float @fma_nan_op2_defaultfp(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_nan_op2_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float %x, float %y, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
diff --git a/llvm/test/Transforms/InstSimplify/assume-fcmp-constant-implies-class.ll b/llvm/test/Transforms/InstSimplify/assume-fcmp-constant-implies-class.ll
index 8d5ac063108c23..2bc9708ae02572 100644
--- a/llvm/test/Transforms/InstSimplify/assume-fcmp-constant-implies-class.ll
+++ b/llvm/test/Transforms/InstSimplify/assume-fcmp-constant-implies-class.ll
@@ -2878,7 +2878,7 @@ define i1 @assume_olt_neg1__oeq_ninf(float %arg) {
 ; CHECK-SAME: float [[ARG:%.*]]) {
 ; CHECK-NEXT:    [[OLT_NEG1:%.*]] = fcmp olt float [[ARG]], -1.000000e+00
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[OLT_NEG1]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[ARG]], ninf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %olt.neg1 = fcmp olt float %arg, -1.0
@@ -2892,7 +2892,7 @@ define i1 @assume_olt_neg1__one_ninf(float %arg) {
 ; CHECK-SAME: float [[ARG:%.*]]) {
 ; CHECK-NEXT:    [[OLT_NEG1:%.*]] = fcmp olt float [[ARG]], -1.000000e+00
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[OLT_NEG1]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp one float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp one float [[ARG]], ninf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %olt.neg1 = fcmp olt float %arg, -1.0
@@ -2955,7 +2955,7 @@ define i1 @assume_olt_2__olt_1(float %arg) {
 define i1 @assume_ogt_neginf_one_neginf(float %arg) {
 ; CHECK-LABEL: define i1 @assume_ogt_neginf_one_neginf(
 ; CHECK-SAME: float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[CMP_OGT_NEGINF:%.*]] = fcmp ogt float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP_OGT_NEGINF:%.*]] = fcmp ogt float [[ARG]], ninf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[CMP_OGT_NEGINF]])
 ; CHECK-NEXT:    ret i1 true
 ;
@@ -2968,9 +2968,9 @@ define i1 @assume_ogt_neginf_one_neginf(float %arg) {
 define i1 @assume_ogt_neginf_oeq_posinf(float %arg) {
 ; CHECK-LABEL: define i1 @assume_ogt_neginf_oeq_posinf(
 ; CHECK-SAME: float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[CMP_OGT_NEGINF:%.*]] = fcmp ogt float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP_OGT_NEGINF:%.*]] = fcmp ogt float [[ARG]], ninf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[CMP_OGT_NEGINF]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[ARG]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[ARG]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp.ogt.neginf = fcmp ogt float %arg, 0xFFF0000000000000
@@ -2982,9 +2982,9 @@ define i1 @assume_ogt_neginf_oeq_posinf(float %arg) {
 define i1 @assume_ule_neginf_oeq_neginf(float %arg) {
 ; CHECK-LABEL: define i1 @assume_ule_neginf_oeq_neginf(
 ; CHECK-SAME: float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[CMP_ULE_NEGINF:%.*]] = fcmp ule float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP_ULE_NEGINF:%.*]] = fcmp ule float [[ARG]], ninf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[CMP_ULE_NEGINF]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[ARG]], ninf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp.ule.neginf = fcmp ule float %arg, 0xFFF0000000000000
@@ -2996,7 +2996,7 @@ define i1 @assume_ule_neginf_oeq_neginf(float %arg) {
 define i1 @assume_ult_neginf_oeq_neginf(float %arg) {
 ; CHECK-LABEL: define i1 @assume_ult_neginf_oeq_neginf(
 ; CHECK-SAME: float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[CMP_ULT_NEGINF:%.*]] = fcmp ult float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP_ULT_NEGINF:%.*]] = fcmp ult float [[ARG]], ninf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[CMP_ULT_NEGINF]])
 ; CHECK-NEXT:    ret i1 false
 ;
@@ -3010,9 +3010,9 @@ define i1 @assume_fabs_ogt_neginf_one_neginf(float %arg) {
 ; CHECK-LABEL: define i1 @assume_fabs_ogt_neginf_one_neginf(
 ; CHECK-SAME: float [[ARG:%.*]]) {
 ; CHECK-NEXT:    [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]])
-; CHECK-NEXT:    [[CMP_OGT_NEGINF:%.*]] = fcmp ogt float [[FABS_ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP_OGT_NEGINF:%.*]] = fcmp ogt float [[FABS_ARG]], ninf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[CMP_OGT_NEGINF]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp one float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp one float [[ARG]], ninf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %fabs.arg = call float @llvm.fabs.f32(float %arg)
@@ -3026,9 +3026,9 @@ define i1 @assume_fabs_ogt_neginf_one_posinf(float %arg) {
 ; CHECK-LABEL: define i1 @assume_fabs_ogt_neginf_one_posinf(
 ; CHECK-SAME: float [[ARG:%.*]]) {
 ; CHECK-NEXT:    [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]])
-; CHECK-NEXT:    [[CMP_OGT_NEGINF:%.*]] = fcmp ogt float [[FABS_ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP_OGT_NEGINF:%.*]] = fcmp ogt float [[FABS_ARG]], ninf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[CMP_OGT_NEGINF]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp one float [[ARG]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp one float [[ARG]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %fabs.arg = call float @llvm.fabs.f32(float %arg)
@@ -3042,7 +3042,7 @@ define i1 @assume_fabs_ule_neginf_oeq_neginf(float %arg) {
 ; CHECK-LABEL: define i1 @assume_fabs_ule_neginf_oeq_neginf(
 ; CHECK-SAME: float [[ARG:%.*]]) {
 ; CHECK-NEXT:    [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]])
-; CHECK-NEXT:    [[CMP_OGT_NEGINF:%.*]] = fcmp ule float [[FABS_ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP_OGT_NEGINF:%.*]] = fcmp ule float [[FABS_ARG]], ninf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[CMP_OGT_NEGINF]])
 ; CHECK-NEXT:    ret i1 false
 ;
@@ -3056,9 +3056,9 @@ define i1 @assume_fabs_ule_neginf_oeq_neginf(float %arg) {
 define i1 @assume_oge_neginf_oeq_neginf(float %arg) {
 ; CHECK-LABEL: define i1 @assume_oge_neginf_oeq_neginf(
 ; CHECK-SAME: float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[CMP_OGE_NEGINF:%.*]] = fcmp oge float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP_OGE_NEGINF:%.*]] = fcmp oge float [[ARG]], ninf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[CMP_OGE_NEGINF]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[ARG]], 0xFFF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp oeq float [[ARG]], ninf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %cmp.oge.neginf = fcmp oge float %arg, 0xFFF0000000000000
diff --git a/llvm/test/Transforms/InstSimplify/call.ll b/llvm/test/Transforms/InstSimplify/call.ll
index c6f6b65f89dc2b..951d3735ae45c3 100644
--- a/llvm/test/Transforms/InstSimplify/call.ll
+++ b/llvm/test/Transforms/InstSimplify/call.ll
@@ -1001,7 +1001,7 @@ declare double @llvm.fmuladd.f64(double,double,double)
 
 define double @fma_undef_op0(double %x, double %y) {
 ; CHECK-LABEL: @fma_undef_op0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = call double @llvm.fma.f64(double undef, double %x, double %y)
   ret double %r
@@ -1017,7 +1017,7 @@ define double @fma_poison_op0(double %x, double %y) {
 
 define double @fma_undef_op1(double %x, double %y) {
 ; CHECK-LABEL: @fma_undef_op1(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = call double @llvm.fma.f64(double %x, double undef, double %y)
   ret double %r
@@ -1033,7 +1033,7 @@ define double @fma_poison_op1(double %x, double %y) {
 
 define double @fma_undef_op2(double %x, double %y) {
 ; CHECK-LABEL: @fma_undef_op2(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = call double @llvm.fma.f64(double %x, double %y, double undef)
   ret double %r
@@ -1065,7 +1065,7 @@ define double @fma_undef_op0_poison_op2(double %x) {
 
 define double @fmuladd_undef_op0(double %x, double %y) {
 ; CHECK-LABEL: @fmuladd_undef_op0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = call double @llvm.fmuladd.f64(double undef, double %x, double %y)
   ret double %r
@@ -1081,7 +1081,7 @@ define double @fmuladd_poison_op0(double %x, double %y) {
 
 define double @fmuladd_undef_op1(double %x, double %y) {
 ; CHECK-LABEL: @fmuladd_undef_op1(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = call double @llvm.fmuladd.f64(double %x, double undef, double %y)
   ret double %r
@@ -1097,7 +1097,7 @@ define double @fmuladd_poison_op1(double %x, double %y) {
 
 define double @fmuladd_undef_op2(double %x, double %y) {
 ; CHECK-LABEL: @fmuladd_undef_op2(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = call double @llvm.fmuladd.f64(double %x, double %y, double undef)
   ret double %r
@@ -1129,7 +1129,7 @@ define double @fmuladd_nan_op1_poison_op2(double %x) {
 
 define double @fma_nan_op0(double %x, double %y) {
 ; CHECK-LABEL: @fma_nan_op0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = call double @llvm.fma.f64(double 0x7ff8000000000000, double %x, double %y)
   ret double %r
@@ -1177,7 +1177,7 @@ define double @fmuladd_nan_op1_op2(double %x) {
 
 define double @fma_nan_multiplicand_inf_zero(double %x) {
 ; CHECK-LABEL: @fma_nan_multiplicand_inf_zero(
-; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fma.f64(double 0x7FF0000000000000, double 0.000000e+00, double [[X:%.*]])
+; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fma.f64(double pinf, double 0.000000e+00, double [[X:%.*]])
 ; CHECK-NEXT:    ret double [[R]]
 ;
   %r = call double @llvm.fma.f64(double 0x7ff0000000000000, double 0.0, double %x)
@@ -1186,7 +1186,7 @@ define double @fma_nan_multiplicand_inf_zero(double %x) {
 
 define double @fma_nan_multiplicand_zero_inf(double %x) {
 ; CHECK-LABEL: @fma_nan_multiplicand_zero_inf(
-; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fma.f64(double 0.000000e+00, double 0x7FF0000000000000, double [[X:%.*]])
+; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fma.f64(double 0.000000e+00, double pinf, double [[X:%.*]])
 ; CHECK-NEXT:    ret double [[R]]
 ;
   %r = call double @llvm.fma.f64(double 0.0, double 0x7ff0000000000000, double %x)
@@ -1196,7 +1196,7 @@ define double @fma_nan_multiplicand_zero_inf(double %x) {
 define double @fma_nan_addend_inf_neginf(double %x, i32 %y) {
 ; CHECK-LABEL: @fma_nan_addend_inf_neginf(
 ; CHECK-NEXT:    [[NOTNAN:%.*]] = uitofp i32 [[Y:%.*]] to double
-; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fma.f64(double 0x7FF0000000000000, double [[NOTNAN]], double 0xFFF0000000000000)
+; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fma.f64(double pinf, double [[NOTNAN]], double ninf)
 ; CHECK-NEXT:    ret double [[R]]
 ;
   %notnan = uitofp i32 %y to double
@@ -1207,7 +1207,7 @@ define double @fma_nan_addend_inf_neginf(double %x, i32 %y) {
 define double @fma_nan_addend_neginf_inf(double %x, i1 %y) {
 ; CHECK-LABEL: @fma_nan_addend_neginf_inf(
 ; CHECK-NEXT:    [[NOTNAN:%.*]] = select i1 [[Y:%.*]], double 4.200000e+01, double -1.000000e-01
-; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fma.f64(double [[NOTNAN]], double 0xFFF0000000000000, double 0x7FF0000000000000)
+; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fma.f64(double [[NOTNAN]], double ninf, double pinf)
 ; CHECK-NEXT:    ret double [[R]]
 ;
   %notnan = select i1 %y, double 42.0, double -0.1
@@ -1217,7 +1217,7 @@ define double @fma_nan_addend_neginf_inf(double %x, i1 %y) {
 
 define double @fmuladd_nan_multiplicand_neginf_zero(double %x) {
 ; CHECK-LABEL: @fmuladd_nan_multiplicand_neginf_zero(
-; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fmuladd.f64(double 0xFFF0000000000000, double 0.000000e+00, double [[X:%.*]])
+; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fmuladd.f64(double ninf, double 0.000000e+00, double [[X:%.*]])
 ; CHECK-NEXT:    ret double [[R]]
 ;
   %r = call double @llvm.fmuladd.f64(double 0xfff0000000000000, double 0.0, double %x)
@@ -1226,7 +1226,7 @@ define double @fmuladd_nan_multiplicand_neginf_zero(double %x) {
 
 define double @fmuladd_nan_multiplicand_negzero_inf(double %x) {
 ; CHECK-LABEL: @fmuladd_nan_multiplicand_negzero_inf(
-; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fmuladd.f64(double -0.000000e+00, double 0x7FF0000000000000, double [[X:%.*]])
+; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fmuladd.f64(double -0.000000e+00, double pinf, double [[X:%.*]])
 ; CHECK-NEXT:    ret double [[R]]
 ;
   %r = call double @llvm.fmuladd.f64(double -0.0, double 0x7ff0000000000000, double %x)
@@ -1236,7 +1236,7 @@ define double @fmuladd_nan_multiplicand_negzero_inf(double %x) {
 define double @fmuladd_nan_addend_inf_neginf(double %x, i32 %y) {
 ; CHECK-LABEL: @fmuladd_nan_addend_inf_neginf(
 ; CHECK-NEXT:    [[NOTNAN:%.*]] = sitofp i32 [[Y:%.*]] to double
-; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fmuladd.f64(double 0x7FF0000000000000, double [[NOTNAN]], double 0xFFF0000000000000)
+; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fmuladd.f64(double pinf, double [[NOTNAN]], double ninf)
 ; CHECK-NEXT:    ret double [[R]]
 ;
   %notnan = sitofp i32 %y to double
@@ -1247,7 +1247,7 @@ define double @fmuladd_nan_addend_inf_neginf(double %x, i32 %y) {
 define double @fmuladd_nan_addend_neginf_inf(double %x, i1 %y) {
 ; CHECK-LABEL: @fmuladd_nan_addend_neginf_inf(
 ; CHECK-NEXT:    [[NOTNAN:%.*]] = select i1 [[Y:%.*]], double 4.200000e+01, double -1.000000e-01
-; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fmuladd.f64(double [[NOTNAN]], double 0xFFF0000000000000, double 0x7FF0000000000000)
+; CHECK-NEXT:    [[R:%.*]] = call double @llvm.fmuladd.f64(double [[NOTNAN]], double ninf, double pinf)
 ; CHECK-NEXT:    ret double [[R]]
 ;
   %notnan = select i1 %y, double 42.0, double -0.1
diff --git a/llvm/test/Transforms/InstSimplify/canonicalize.ll b/llvm/test/Transforms/InstSimplify/canonicalize.ll
index c3877ec0cef8d1..8f1b0464395239 100644
--- a/llvm/test/Transforms/InstSimplify/canonicalize.ll
+++ b/llvm/test/Transforms/InstSimplify/canonicalize.ll
@@ -243,7 +243,7 @@ define float @canonicalize_neg_denorm_preserve_sign_output_dynamic_input() "deno
 
 define float @canonicalize_inf() {
 ; CHECK-LABEL: @canonicalize_inf(
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %ret = call float @llvm.canonicalize.f32(float 0x7FF0000000000000)
   ret float %ret
@@ -251,7 +251,7 @@ define float @canonicalize_inf() {
 
 define float @canonicalize_neg_inf() {
 ; CHECK-LABEL: @canonicalize_neg_inf(
-; CHECK-NEXT:    ret float 0xFFF0000000000000
+; CHECK-NEXT:    ret float ninf
 ;
   %ret = call float @llvm.canonicalize.f32(float 0xFFF0000000000000)
   ret float %ret
@@ -259,7 +259,7 @@ define float @canonicalize_neg_inf() {
 
 define float @canonicalize_qnan() {
 ; CHECK-LABEL: @canonicalize_qnan(
-; CHECK-NEXT:    [[RET:%.*]] = call float @llvm.canonicalize.f32(float 0x7FF8000000000000)
+; CHECK-NEXT:    [[RET:%.*]] = call float @llvm.canonicalize.f32(float nan)
 ; CHECK-NEXT:    ret float [[RET]]
 ;
   %ret = call float @llvm.canonicalize.f32(float 0x7FF8000000000000)
@@ -377,7 +377,7 @@ define double @canonicalize_0x00000000000001_f64() {
 
 define double @canonicalize_inf_f64() {
 ; CHECK-LABEL: @canonicalize_inf_f64(
-; CHECK-NEXT:    ret double 0x7FF0000000000000
+; CHECK-NEXT:    ret double pinf
 ;
   %ret = call double @llvm.canonicalize.f64(double 0x7FF0000000000000)
   ret double %ret
@@ -385,7 +385,7 @@ define double @canonicalize_inf_f64() {
 
 define double @canonicalize_ninf_f64() {
 ; CHECK-LABEL: @canonicalize_ninf_f64(
-; CHECK-NEXT:    ret double 0xFFF0000000000000
+; CHECK-NEXT:    ret double ninf
 ;
   %ret = call double @llvm.canonicalize.f64(double 0xFFF0000000000000)
   ret double %ret
@@ -421,7 +421,7 @@ define half @canonicalize_0x0001_f16() {
 
 define half @canonicalize_inf_f16() {
 ; CHECK-LABEL: @canonicalize_inf_f16(
-; CHECK-NEXT:    ret half 0xH7C00
+; CHECK-NEXT:    ret half pinf
 ;
   %ret = call half @llvm.canonicalize.f16(half 0xH7C00)
   ret half %ret
@@ -429,7 +429,7 @@ define half @canonicalize_inf_f16() {
 
 define half @canonicalize_neg_inf_f16() {
 ; CHECK-LABEL: @canonicalize_neg_inf_f16(
-; CHECK-NEXT:    ret half 0xHFC00
+; CHECK-NEXT:    ret half ninf
 ;
   %ret = call half @llvm.canonicalize.f16(half 0xHFC00)
   ret half %ret
@@ -465,7 +465,7 @@ define fp128 @canonicalize_0x00000000000000000000000000000001_fp128() {
 
 define fp128 @canonicalize_inf_fp128() {
 ; CHECK-LABEL: @canonicalize_inf_fp128(
-; CHECK-NEXT:    ret fp128 0xL00000000000000007FFF000000000000
+; CHECK-NEXT:    ret fp128 pinf
 ;
   %ret = call fp128 @llvm.canonicalize.fp128(fp128 0xL00000000000000007FFF000000000000)
   ret fp128 %ret
@@ -473,7 +473,7 @@ define fp128 @canonicalize_inf_fp128() {
 
 define fp128 @canonicalize_neg_inf_fp128() {
 ; CHECK-LABEL: @canonicalize_neg_inf_fp128(
-; CHECK-NEXT:    ret fp128 0xL0000000000000000FFFF000000000000
+; CHECK-NEXT:    ret fp128 ninf
 ;
   %ret = call fp128 @llvm.canonicalize.fp128(fp128 0xL0000000000000000FFFF000000000000)
   ret fp128 %ret
@@ -481,7 +481,7 @@ define fp128 @canonicalize_neg_inf_fp128() {
 
 define fp128 @canonicalize_nan_fp128() {
 ; CHECK-LABEL: @canonicalize_nan_fp128(
-; CHECK-NEXT:    [[RET:%.*]] = call fp128 @llvm.canonicalize.f128(fp128 0xL00000000000000007FFF800000000000)
+; CHECK-NEXT:    [[RET:%.*]] = call fp128 @llvm.canonicalize.f128(fp128 nan)
 ; CHECK-NEXT:    ret fp128 [[RET]]
 ;
   %ret = call fp128 @llvm.canonicalize.fp128(fp128 0xL00000000000000007FFF800000000000)
@@ -518,7 +518,7 @@ define bfloat @canonicalize_0x0001_bf16() {
 
 define bfloat @canonicalize_inf_bf16() {
 ; CHECK-LABEL: @canonicalize_inf_bf16(
-; CHECK-NEXT:    ret bfloat 0xR7F80
+; CHECK-NEXT:    ret bfloat pinf
 ;
   %ret = call bfloat @llvm.canonicalize.bf16(bfloat 0xR7F80)
   ret bfloat %ret
@@ -526,7 +526,7 @@ define bfloat @canonicalize_inf_bf16() {
 
 define bfloat @canonicalize_neg_inf_bf16() {
 ; CHECK-LABEL: @canonicalize_neg_inf_bf16(
-; CHECK-NEXT:    ret bfloat 0xRFF80
+; CHECK-NEXT:    ret bfloat ninf
 ;
   %ret = call bfloat @llvm.canonicalize.bf16(bfloat 0xRFF80)
   ret bfloat %ret
@@ -534,7 +534,7 @@ define bfloat @canonicalize_neg_inf_bf16() {
 
 define bfloat @canonicalize_nan_bf16() {
 ; CHECK-LABEL: @canonicalize_nan_bf16(
-; CHECK-NEXT:    [[RET:%.*]] = call bfloat @llvm.canonicalize.bf16(bfloat 0xR7FC0)
+; CHECK-NEXT:    [[RET:%.*]] = call bfloat @llvm.canonicalize.bf16(bfloat nan)
 ; CHECK-NEXT:    ret bfloat [[RET]]
 ;
   %ret = call bfloat @llvm.canonicalize.bf16(bfloat 0xR7FC0)
@@ -587,7 +587,7 @@ define x86_fp80 @canonicalize_negzero_f80() {
 
 define x86_fp80 @canonicalize_inf_f80() {
 ; CHECK-LABEL: @canonicalize_inf_f80(
-; CHECK-NEXT:    [[RET:%.*]] = call x86_fp80 @llvm.canonicalize.f80(x86_fp80 0xK7FFF8000000000000000)
+; CHECK-NEXT:    [[RET:%.*]] = call x86_fp80 @llvm.canonicalize.f80(x86_fp80 pinf)
 ; CHECK-NEXT:    ret x86_fp80 [[RET]]
 ;
   %ret = call x86_fp80 @llvm.canonicalize.f80(x86_fp80 0xK7FFF8000000000000000)
@@ -596,7 +596,7 @@ define x86_fp80 @canonicalize_inf_f80() {
 
 define x86_fp80 @canonicalize_ninf_f80() {
 ; CHECK-LABEL: @canonicalize_ninf_f80(
-; CHECK-NEXT:    [[RET:%.*]] = call x86_fp80 @llvm.canonicalize.f80(x86_fp80 0xKFFFF8000000000000000)
+; CHECK-NEXT:    [[RET:%.*]] = call x86_fp80 @llvm.canonicalize.f80(x86_fp80 ninf)
 ; CHECK-NEXT:    ret x86_fp80 [[RET]]
 ;
   %ret = call x86_fp80 @llvm.canonicalize.f80(x86_fp80 0xKFFFF8000000000000000)
@@ -710,7 +710,7 @@ define ppc_fp128 @canonicalize_noncanonical_negzero_0_ppcf128() {
 
 define ppc_fp128 @canonicalize_inf_ppcf128() {
 ; CHECK-LABEL: @canonicalize_inf_ppcf128(
-; CHECK-NEXT:    [[RET:%.*]] = call ppc_fp128 @llvm.canonicalize.ppcf128(ppc_fp128 0xM7FF00000000000000000000000000000)
+; CHECK-NEXT:    [[RET:%.*]] = call ppc_fp128 @llvm.canonicalize.ppcf128(ppc_fp128 pinf)
 ; CHECK-NEXT:    ret ppc_fp128 [[RET]]
 ;
   %ret = call ppc_fp128 @llvm.canonicalize.ppcf128(ppc_fp128 0xM7FF00000000000000000000000000000)
@@ -719,7 +719,7 @@ define ppc_fp128 @canonicalize_inf_ppcf128() {
 
 define ppc_fp128 @canonicalize_neginf_ppcf128() {
 ; CHECK-LABEL: @canonicalize_neginf_ppcf128(
-; CHECK-NEXT:    [[RET:%.*]] = call ppc_fp128 @llvm.canonicalize.ppcf128(ppc_fp128 0xMFFF00000000000000000000000000000)
+; CHECK-NEXT:    [[RET:%.*]] = call ppc_fp128 @llvm.canonicalize.ppcf128(ppc_fp128 ninf)
 ; CHECK-NEXT:    ret ppc_fp128 [[RET]]
 ;
   %ret = call ppc_fp128 @llvm.canonicalize.ppcf128(ppc_fp128 0xMFFF00000000000000000000000000000)
diff --git a/llvm/test/Transforms/InstSimplify/constfold-constrained.ll b/llvm/test/Transforms/InstSimplify/constfold-constrained.ll
index a9ef7f6a765d19..51a2bda3d0bc39 100644
--- a/llvm/test/Transforms/InstSimplify/constfold-constrained.ll
+++ b/llvm/test/Transforms/InstSimplify/constfold-constrained.ll
@@ -168,7 +168,7 @@ entry:
 define double @nonfinite_02() #0 {
 ; CHECK-LABEL: @nonfinite_02(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
 entry:
   %result = call double @llvm.experimental.constrained.trunc.f64(double 0x7ff4000000000000, metadata !"fpexcept.ignore") #0
@@ -179,8 +179,8 @@ entry:
 define double @nonfinite_03() #0 {
 ; CHECK-LABEL: @nonfinite_03(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[RESULT:%.*]] = call double @llvm.experimental.constrained.trunc.f64(double 0x7FF8000000000000, metadata !"fpexcept.strict") #[[ATTR0]]
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    [[RESULT:%.*]] = call double @llvm.experimental.constrained.trunc.f64(double nan, metadata !"fpexcept.strict") #[[ATTR0]]
+; CHECK-NEXT:    ret double nan
 ;
 entry:
   %result = call double @llvm.experimental.constrained.trunc.f64(double 0x7ff8000000000000, metadata !"fpexcept.strict") #0
@@ -191,8 +191,8 @@ entry:
 define double @nonfinite_04() #0 {
 ; CHECK-LABEL: @nonfinite_04(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[RESULT:%.*]] = call double @llvm.experimental.constrained.trunc.f64(double 0x7FF0000000000000, metadata !"fpexcept.strict") #[[ATTR0]]
-; CHECK-NEXT:    ret double 0x7FF0000000000000
+; CHECK-NEXT:    [[RESULT:%.*]] = call double @llvm.experimental.constrained.trunc.f64(double pinf, metadata !"fpexcept.strict") #[[ATTR0]]
+; CHECK-NEXT:    ret double pinf
 ;
 entry:
   %result = call double @llvm.experimental.constrained.trunc.f64(double 0x7ff0000000000000, metadata !"fpexcept.strict") #0
@@ -318,7 +318,7 @@ entry:
 define double @fadd_08() #0 {
 ; CHECK-LABEL: @fadd_08(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    ret double 0x7FF0000000000000
+; CHECK-NEXT:    ret double pinf
 ;
 entry:
   %result = call double @llvm.experimental.constrained.fadd.f64(double 0x7fEFFFFFFFFFFFFF, double 0x7fEFFFFFFFFFFFFF, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
@@ -515,7 +515,7 @@ entry:
 define i1 @cmp_eq_nan_03() #0 {
 ; CHECK-LABEL: @cmp_eq_nan_03(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[RESULT:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double 0x7FF8000000000000, double 1.000000e+00, metadata !"oeq", metadata !"fpexcept.strict") #[[ATTR0]]
+; CHECK-NEXT:    [[RESULT:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f64(double nan, double 1.000000e+00, metadata !"oeq", metadata !"fpexcept.strict") #[[ATTR0]]
 ; CHECK-NEXT:    ret i1 false
 ;
 entry:
@@ -526,7 +526,7 @@ entry:
 define i1 @cmp_eq_nan_04() #0 {
 ; CHECK-LABEL: @cmp_eq_nan_04(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[RESULT:%.*]] = call i1 @llvm.experimental.constrained.fcmps.f64(double 0x7FF8000000000000, double 1.000000e+00, metadata !"oeq", metadata !"fpexcept.strict") #[[ATTR0]]
+; CHECK-NEXT:    [[RESULT:%.*]] = call i1 @llvm.experimental.constrained.fcmps.f64(double nan, double 1.000000e+00, metadata !"oeq", metadata !"fpexcept.strict") #[[ATTR0]]
 ; CHECK-NEXT:    ret i1 [[RESULT]]
 ;
 entry:
diff --git a/llvm/test/Transforms/InstSimplify/exp10.ll b/llvm/test/Transforms/InstSimplify/exp10.ll
index 11617ceec666d0..3f9c7f417951d6 100644
--- a/llvm/test/Transforms/InstSimplify/exp10.ll
+++ b/llvm/test/Transforms/InstSimplify/exp10.ll
@@ -9,8 +9,8 @@ declare <vscale x 2 x float> @llvm.exp10.nxv2f32(<vscale x 2 x float>)
 
 
 define float @exp10_exp10(float %x) {
-; CHECK-LABEL: define float @exp10_exp10
-; CHECK-SAME: (float [[X:%.*]]) {
+; CHECK-LABEL: define float @exp10_exp10(
+; CHECK-SAME: float [[X:%.*]]) {
 ; CHECK-NEXT:    [[EXP100:%.*]] = call float @llvm.exp10.f32(float [[X]])
 ; CHECK-NEXT:    [[EXP101:%.*]] = call float @llvm.exp10.f32(float [[EXP100]])
 ; CHECK-NEXT:    ret float [[EXP101]]
@@ -21,8 +21,8 @@ define float @exp10_exp10(float %x) {
 }
 
 define <2 x float> @exp10_exp10_vector(<2 x float> %x) {
-; CHECK-LABEL: define <2 x float> @exp10_exp10_vector
-; CHECK-SAME: (<2 x float> [[X:%.*]]) {
+; CHECK-LABEL: define <2 x float> @exp10_exp10_vector(
+; CHECK-SAME: <2 x float> [[X:%.*]]) {
 ; CHECK-NEXT:    [[EXP100:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> [[X]])
 ; CHECK-NEXT:    [[EXP101:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> [[EXP100]])
 ; CHECK-NEXT:    ret <2 x float> [[EXP101]]
@@ -33,9 +33,9 @@ define <2 x float> @exp10_exp10_vector(<2 x float> %x) {
 }
 
 define float @exp10_exp10_const(float %x) {
-; CHECK-LABEL: define float @exp10_exp10_const
-; CHECK-SAME: (float [[X:%.*]]) {
-; CHECK-NEXT:    [[EXP101:%.*]] = call float @llvm.exp10.f32(float 0x7FF0000000000000)
+; CHECK-LABEL: define float @exp10_exp10_const(
+; CHECK-SAME: float [[X:%.*]]) {
+; CHECK-NEXT:    [[EXP101:%.*]] = call float @llvm.exp10.f32(float pinf)
 ; CHECK-NEXT:    ret float [[EXP101]]
 ;
   %exp100 = call float @llvm.exp10.f32(float 42.0)
@@ -44,8 +44,8 @@ define float @exp10_exp10_const(float %x) {
 }
 
 define <vscale x 2 x float> @exp10_exp10_scalable_vector(<vscale x 2 x float> %x) {
-; CHECK-LABEL: define <vscale x 2 x float> @exp10_exp10_scalable_vector
-; CHECK-SAME: (<vscale x 2 x float> [[X:%.*]]) {
+; CHECK-LABEL: define <vscale x 2 x float> @exp10_exp10_scalable_vector(
+; CHECK-SAME: <vscale x 2 x float> [[X:%.*]]) {
 ; CHECK-NEXT:    [[EXP100:%.*]] = call <vscale x 2 x float> @llvm.exp10.nxv2f32(<vscale x 2 x float> [[X]])
 ; CHECK-NEXT:    [[EXP101:%.*]] = call <vscale x 2 x float> @llvm.exp10.nxv2f32(<vscale x 2 x float> [[EXP100]])
 ; CHECK-NEXT:    ret <vscale x 2 x float> [[EXP101]]
@@ -183,7 +183,7 @@ define float @exp10_negtwo() {
 
 define float @exp10_inf() {
 ; CHECK-LABEL: define float @exp10_inf() {
-; CHECK-NEXT:    [[RET:%.*]] = call float @llvm.exp10.f32(float 0x7FF0000000000000)
+; CHECK-NEXT:    [[RET:%.*]] = call float @llvm.exp10.f32(float pinf)
 ; CHECK-NEXT:    ret float [[RET]]
 ;
   %ret = call float @llvm.exp10.f32(float 0x7FF0000000000000)
@@ -192,7 +192,7 @@ define float @exp10_inf() {
 
 define float @exp10_neginf() {
 ; CHECK-LABEL: define float @exp10_neginf() {
-; CHECK-NEXT:    [[RET:%.*]] = call float @llvm.exp10.f32(float 0xFFF0000000000000)
+; CHECK-NEXT:    [[RET:%.*]] = call float @llvm.exp10.f32(float ninf)
 ; CHECK-NEXT:    ret float [[RET]]
 ;
   %ret = call float @llvm.exp10.f32(float 0xFFF0000000000000)
@@ -201,7 +201,7 @@ define float @exp10_neginf() {
 
 define float @exp10_qnan() {
 ; CHECK-LABEL: define float @exp10_qnan() {
-; CHECK-NEXT:    [[RET:%.*]] = call float @llvm.exp10.f32(float 0x7FF8000000000000)
+; CHECK-NEXT:    [[RET:%.*]] = call float @llvm.exp10.f32(float nan)
 ; CHECK-NEXT:    ret float [[RET]]
 ;
   %ret = call float @llvm.exp10.f32(float 0x7FF8000000000000)
@@ -270,7 +270,7 @@ define <2 x float> @exp10_splat_4() {
 
 define <2 x float> @exp10_splat_qnan() {
 ; CHECK-LABEL: define <2 x float> @exp10_splat_qnan() {
-; CHECK-NEXT:    [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>)
+; CHECK-NEXT:    [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float nan, float nan>)
 ; CHECK-NEXT:    ret <2 x float> [[RET]]
 ;
   %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>)
@@ -279,7 +279,7 @@ define <2 x float> @exp10_splat_qnan() {
 
 define <2 x float> @exp10_splat_inf() {
 ; CHECK-LABEL: define <2 x float> @exp10_splat_inf() {
-; CHECK-NEXT:    [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>)
+; CHECK-NEXT:    [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float pinf, float pinf>)
 ; CHECK-NEXT:    ret <2 x float> [[RET]]
 ;
   %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>)
@@ -288,7 +288,7 @@ define <2 x float> @exp10_splat_inf() {
 
 define <2 x float> @exp10_splat_neginf() {
 ; CHECK-LABEL: define <2 x float> @exp10_splat_neginf() {
-; CHECK-NEXT:    [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float 0xFFF0000000000000, float 0xFFF0000000000000>)
+; CHECK-NEXT:    [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float ninf, float ninf>)
 ; CHECK-NEXT:    ret <2 x float> [[RET]]
 ;
   %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float 0xFFF0000000000000, float 0xFFF0000000000000>)
@@ -297,7 +297,7 @@ define <2 x float> @exp10_splat_neginf() {
 
 define <2 x float> @exp10_splat_undef_inf() {
 ; CHECK-LABEL: define <2 x float> @exp10_splat_undef_inf() {
-; CHECK-NEXT:    [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float undef, float 0x7FF0000000000000>)
+; CHECK-NEXT:    [[RET:%.*]] = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float undef, float pinf>)
 ; CHECK-NEXT:    ret <2 x float> [[RET]]
 ;
   %ret = call <2 x float> @llvm.exp10.v2f32(<2 x float> <float undef, float 0x7FF0000000000000>)
diff --git a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
index 7a35f09f03b995..f85fc9a2f597f7 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll
@@ -259,7 +259,7 @@ define float @src_fma_nzero_neg(float nofpclass(inf nan pzero psub pnorm) %f, fl
 define { float, float } @test_fmul_0_assumed_finite(float %x) {
 ; CHECK-LABEL: @test_fmul_0_assumed_finite(
 ; CHECK-NEXT:    [[FABS_X:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
-; CHECK-NEXT:    [[IS_FINITE_X:%.*]] = fcmp one float [[FABS_X]], 0x7FF0000000000000
+; CHECK-NEXT:    [[IS_FINITE_X:%.*]] = fcmp one float [[FABS_X]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[IS_FINITE_X]])
 ; CHECK-NEXT:    ret { float, float } { float 0.000000e+00, float -0.000000e+00 }
 ;
@@ -462,7 +462,7 @@ define <2 x float> @fabs_select_neg0_neg1_vector(i32 %c) {
 define float @fabs_select_nan_nan(i32 %c) {
 ; CHECK-LABEL: @fabs_select_nan_nan(
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[C:%.*]], 0
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[CMP]], float 0x7FF8000000000000, float 0x7FF8000100000000
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[CMP]], float nan, float 0x7FF8000100000000
 ; CHECK-NEXT:    ret float [[SELECT]]
 ;
   %cmp = icmp eq i32 %c, 0
@@ -474,7 +474,7 @@ define float @fabs_select_nan_nan(i32 %c) {
 define <2 x float> @fabs_select_nan_nan_vector(i32 %c) {
 ; CHECK-LABEL: @fabs_select_nan_nan_vector(
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[C:%.*]], 0
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[CMP]], <2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>, <2 x float> <float 0x7FF8000100000000, float 0x7FF8000100000000>
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[CMP]], <2 x float> <float nan, float nan>, <2 x float> <float 0x7FF8000100000000, float 0x7FF8000100000000>
 ; CHECK-NEXT:    ret <2 x float> [[SELECT]]
 ;
   %cmp = icmp eq i32 %c, 0
@@ -486,7 +486,7 @@ define <2 x float> @fabs_select_nan_nan_vector(i32 %c) {
 define float @fabs_select_negnan_nan(i32 %c) {
 ; CHECK-LABEL: @fabs_select_negnan_nan(
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[C:%.*]], 0
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[CMP]], float 0xFFF8000000000000, float 0x7FF8000000000000
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[CMP]], float 0xFFF8000000000000, float nan
 ; CHECK-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[SELECT]])
 ; CHECK-NEXT:    ret float [[FABS]]
 ;
@@ -499,7 +499,7 @@ define float @fabs_select_negnan_nan(i32 %c) {
 define <2 x float> @fabs_select_negnan_nan_vector(i32 %c) {
 ; CHECK-LABEL: @fabs_select_negnan_nan_vector(
 ; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[C:%.*]], 0
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[CMP]], <2 x float> <float 0xFFF8000000000000, float 0xFFF8000000000000>, <2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[CMP]], <2 x float> <float 0xFFF8000000000000, float 0xFFF8000000000000>, <2 x float> <float nan, float nan>
 ; CHECK-NEXT:    [[FABS:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[SELECT]])
 ; CHECK-NEXT:    ret <2 x float> [[FABS]]
 ;
@@ -894,7 +894,7 @@ define float @maxnum_with_pos_one_op(float %a) {
 
 define double @fadd_nnan_inf_op0(double %x) {
 ; CHECK-LABEL: @fadd_nnan_inf_op0(
-; CHECK-NEXT:    ret double 0x7FF0000000000000
+; CHECK-NEXT:    ret double pinf
 ;
   %r = fadd nnan double 0x7ff0000000000000, %x
   ret double %r
@@ -902,7 +902,7 @@ define double @fadd_nnan_inf_op0(double %x) {
 
 define double @fadd_nnan_inf_op1(double %x) {
 ; CHECK-LABEL: @fadd_nnan_inf_op1(
-; CHECK-NEXT:    ret double 0x7FF0000000000000
+; CHECK-NEXT:    ret double pinf
 ;
   %r = fadd nnan double %x, 0x7ff0000000000000
   ret double %r
@@ -910,7 +910,7 @@ define double @fadd_nnan_inf_op1(double %x) {
 
 define <2 x double> @fadd_nnan_neginf_op1(<2 x double> %x) {
 ; CHECK-LABEL: @fadd_nnan_neginf_op1(
-; CHECK-NEXT:    ret <2 x double> <double 0xFFF0000000000000, double poison>
+; CHECK-NEXT:    ret <2 x double> <double ninf, double poison>
 ;
   %r = fadd nnan <2 x double> %x, <double 0xfff0000000000000, double poison>
   ret <2 x double> %r
@@ -918,7 +918,7 @@ define <2 x double> @fadd_nnan_neginf_op1(<2 x double> %x) {
 
 define double @fadd_nnan_neginf_op0(double %x) {
 ; CHECK-LABEL: @fadd_nnan_neginf_op0(
-; CHECK-NEXT:    ret double 0xFFF0000000000000
+; CHECK-NEXT:    ret double ninf
 ;
   %r = fadd nnan double 0xfff0000000000000, %x
   ret double %r
@@ -928,7 +928,7 @@ define double @fadd_nnan_neginf_op0(double %x) {
 
 define double @fadd_inf_op0(double %x) {
 ; CHECK-LABEL: @fadd_inf_op0(
-; CHECK-NEXT:    [[R:%.*]] = fadd double 0x7FF0000000000000, [[X:%.*]]
+; CHECK-NEXT:    [[R:%.*]] = fadd double pinf, [[X:%.*]]
 ; CHECK-NEXT:    ret double [[R]]
 ;
   %r = fadd double 0x7ff0000000000000, %x
@@ -937,7 +937,7 @@ define double @fadd_inf_op0(double %x) {
 
 define double @fsub_nnan_inf_op0(double %x) {
 ; CHECK-LABEL: @fsub_nnan_inf_op0(
-; CHECK-NEXT:    ret double 0x7FF0000000000000
+; CHECK-NEXT:    ret double pinf
 ;
   %r = fsub nnan double 0x7ff0000000000000, %x
   ret double %r
@@ -947,7 +947,7 @@ define double @fsub_nnan_inf_op0(double %x) {
 
 define double @fsub_nnan_inf_op1(double %x) {
 ; CHECK-LABEL: @fsub_nnan_inf_op1(
-; CHECK-NEXT:    ret double 0xFFF0000000000000
+; CHECK-NEXT:    ret double ninf
 ;
   %r = fsub nnan double %x, 0x7ff0000000000000
   ret double %r
@@ -955,7 +955,7 @@ define double @fsub_nnan_inf_op1(double %x) {
 
 define <2 x double> @fsub_nnan_inf_op1_vec(<2 x double> %x) {
 ; CHECK-LABEL: @fsub_nnan_inf_op1_vec(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF0000000000000, double poison>
+; CHECK-NEXT:    ret <2 x double> <double pinf, double poison>
 ;
   %r = fsub nnan <2 x double> %x, <double 0xfff0000000000000, double poison>
   ret <2 x double> %r
@@ -963,7 +963,7 @@ define <2 x double> @fsub_nnan_inf_op1_vec(<2 x double> %x) {
 
 define <2 x double> @fsub_nnan_neginf_op0(<2 x double> %x) {
 ; CHECK-LABEL: @fsub_nnan_neginf_op0(
-; CHECK-NEXT:    ret <2 x double> <double 0xFFF0000000000000, double poison>
+; CHECK-NEXT:    ret <2 x double> <double ninf, double poison>
 ;
   %r = fsub nnan <2 x double> <double 0xfff0000000000000, double poison>, %x
   ret <2 x double> %r
@@ -973,7 +973,7 @@ define <2 x double> @fsub_nnan_neginf_op0(<2 x double> %x) {
 
 define double @fsub_nnan_neginf_op1(double %x) {
 ; CHECK-LABEL: @fsub_nnan_neginf_op1(
-; CHECK-NEXT:    ret double 0x7FF0000000000000
+; CHECK-NEXT:    ret double pinf
 ;
   %r = fsub nnan double %x, 0xfff0000000000000
   ret double %r
@@ -983,7 +983,7 @@ define double @fsub_nnan_neginf_op1(double %x) {
 
 define double @fsub_inf_op0(double %x) {
 ; CHECK-LABEL: @fsub_inf_op0(
-; CHECK-NEXT:    [[R:%.*]] = fsub double 0x7FF0000000000000, [[X:%.*]]
+; CHECK-NEXT:    [[R:%.*]] = fsub double pinf, [[X:%.*]]
 ; CHECK-NEXT:    ret double [[R]]
 ;
   %r = fsub double 0x7ff0000000000000, %x
diff --git a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
index e9d5c353cbccfc..88eb4a8bc12ea2 100644
--- a/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
+++ b/llvm/test/Transforms/InstSimplify/floating-point-compare.ll
@@ -1395,7 +1395,7 @@ define i1 @is_infinite(float %x) {
 define i1 @is_infinite_assumed_finite(float %x) {
 ; CHECK-LABEL: @is_infinite_assumed_finite(
 ; CHECK-NEXT:    [[XABS:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
-; CHECK-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[XABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[XABS]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[NOT_INF]])
 ; CHECK-NEXT:    ret i1 false
 ;
@@ -1409,7 +1409,7 @@ define i1 @is_infinite_assumed_finite(float %x) {
 define i1 @une_inf_assumed_not_inf(float %x) {
 ; CHECK-LABEL: @une_inf_assumed_not_inf(
 ; CHECK-NEXT:    [[XABS:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
-; CHECK-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[XABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[NOT_INF:%.*]] = fcmp one float [[XABS]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[NOT_INF]])
 ; CHECK-NEXT:    ret i1 true
 ;
@@ -1434,7 +1434,7 @@ define <2 x i1> @is_infinite_neg(<2 x float> %x) {
 define i1 @is_infinite_or_nan(float %x) {
 ; CHECK-LABEL: @is_infinite_or_nan(
 ; CHECK-NEXT:    [[X42:%.*]] = fadd ninf float [[X:%.*]], 4.200000e+01
-; CHECK-NEXT:    [[R:%.*]] = fcmp ueq float [[X42]], 0xFFF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp ueq float [[X42]], ninf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %x42 = fadd ninf float %x, 42.0
@@ -1454,7 +1454,7 @@ define i1 @is_infinite_or_nan2(float %x) {
 define i1 @is_infinite_or_nan2_assume(float %x) {
 ; CHECK-LABEL: @is_infinite_or_nan2_assume(
 ; CHECK-NEXT:    [[XABS:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
-; CHECK-NEXT:    [[IS_INF_OR_NAN:%.*]] = fcmp one float [[XABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[IS_INF_OR_NAN:%.*]] = fcmp one float [[XABS]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[IS_INF_OR_NAN]])
 ; CHECK-NEXT:    ret i1 false
 ;
@@ -1498,7 +1498,7 @@ define <2 x i1> @is_finite_or_nan_commute(<2 x i8> %x) {
 define i1 @is_finite_and_ordered(double %x) {
 ; CHECK-LABEL: @is_finite_and_ordered(
 ; CHECK-NEXT:    [[XX:%.*]] = fmul ninf double [[X:%.*]], [[X]]
-; CHECK-NEXT:    [[R:%.*]] = fcmp one double [[XX]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp one double [[XX]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %xx = fmul ninf double %x, %x
@@ -1519,7 +1519,7 @@ define i1 @is_finite(i1 %c, double %x) {
 define i1 @is_finite_assume(i1 %c, double %x) {
 ; CHECK-LABEL: @is_finite_assume(
 ; CHECK-NEXT:    [[XABS:%.*]] = call double @llvm.fabs.f64(double [[X:%.*]])
-; CHECK-NEXT:    [[IS_INF_OR_NAN:%.*]] = fcmp one double [[XABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[IS_INF_OR_NAN:%.*]] = fcmp one double [[XABS]], pinf
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[IS_INF_OR_NAN]])
 ; CHECK-NEXT:    ret i1 true
 ;
diff --git a/llvm/test/Transforms/InstSimplify/fminmax-folds.ll b/llvm/test/Transforms/InstSimplify/fminmax-folds.ll
index 668a93ddf5a426..cea6684bcf118d 100644
--- a/llvm/test/Transforms/InstSimplify/fminmax-folds.ll
+++ b/llvm/test/Transforms/InstSimplify/fminmax-folds.ll
@@ -56,7 +56,7 @@ define float @test_minimum_const_nan(float %x) {
 
 define float @test_minnum_const_inf(float %x) {
 ; CHECK-LABEL: @test_minnum_const_inf(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float 0x7FF0000000000000)
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.minnum.f32(float [[X:%.*]], float pinf)
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.minnum.f32(float %x, float 0x7ff0000000000000)
@@ -65,7 +65,7 @@ define float @test_minnum_const_inf(float %x) {
 
 define float @test_maxnum_const_inf(float %x) {
 ; CHECK-LABEL: @test_maxnum_const_inf(
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %r = call float @llvm.maxnum.f32(float %x, float 0x7ff0000000000000)
   ret float %r
@@ -73,7 +73,7 @@ define float @test_maxnum_const_inf(float %x) {
 
 define float @test_maximum_const_inf(float %x) {
 ; CHECK-LABEL: @test_maximum_const_inf(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.maximum.f32(float [[X:%.*]], float 0x7FF0000000000000)
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.maximum.f32(float [[X:%.*]], float pinf)
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.maximum.f32(float %x, float 0x7ff0000000000000)
@@ -90,7 +90,7 @@ define float @test_minimum_const_inf(float %x) {
 
 define float @test_minnum_const_neg_inf(float %x) {
 ; CHECK-LABEL: @test_minnum_const_neg_inf(
-; CHECK-NEXT:    ret float 0xFFF0000000000000
+; CHECK-NEXT:    ret float ninf
 ;
   %r = call float @llvm.minnum.f32(float %x, float 0xfff0000000000000)
   ret float %r
@@ -98,7 +98,7 @@ define float @test_minnum_const_neg_inf(float %x) {
 
 define float @test_maxnum_const_neg_inf(float %x) {
 ; CHECK-LABEL: @test_maxnum_const_neg_inf(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float 0xFFF0000000000000)
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.maxnum.f32(float [[X:%.*]], float ninf)
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.maxnum.f32(float %x, float 0xfff0000000000000)
@@ -115,7 +115,7 @@ define float @test_maximum_const_neg_inf(float %x) {
 
 define float @test_minimum_const_neg_inf(float %x) {
 ; CHECK-LABEL: @test_minimum_const_neg_inf(
-; CHECK-NEXT:    [[R:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float 0xFFF0000000000000)
+; CHECK-NEXT:    [[R:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float ninf)
 ; CHECK-NEXT:    ret float [[R]]
 ;
   %r = call float @llvm.minimum.f32(float %x, float 0xfff0000000000000)
@@ -132,7 +132,7 @@ define float @test_minnum_const_inf_nnan(float %x) {
 
 define float @test_maxnum_const_inf_nnan(float %x) {
 ; CHECK-LABEL: @test_maxnum_const_inf_nnan(
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %r = call nnan float @llvm.maxnum.f32(float %x, float 0x7ff0000000000000)
   ret float %r
@@ -140,7 +140,7 @@ define float @test_maxnum_const_inf_nnan(float %x) {
 
 define float @test_maximum_const_inf_nnan(float %x) {
 ; CHECK-LABEL: @test_maximum_const_inf_nnan(
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %r = call nnan float @llvm.maximum.f32(float %x, float 0x7ff0000000000000)
   ret float %r
@@ -164,7 +164,7 @@ define float @test_minnum_const_inf_nnan_comm(float %x) {
 
 define float @test_maxnum_const_inf_nnan_comm(float %x) {
 ; CHECK-LABEL: @test_maxnum_const_inf_nnan_comm(
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %r = call nnan float @llvm.maxnum.f32(float 0x7ff0000000000000, float %x)
   ret float %r
@@ -172,7 +172,7 @@ define float @test_maxnum_const_inf_nnan_comm(float %x) {
 
 define float @test_maximum_const_inf_nnan_comm(float %x) {
 ; CHECK-LABEL: @test_maximum_const_inf_nnan_comm(
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %r = call nnan float @llvm.maximum.f32(float 0x7ff0000000000000, float %x)
   ret float %r
@@ -196,7 +196,7 @@ define <2 x float> @test_minnum_const_inf_nnan_comm_vec(<2 x float> %x) {
 
 define <2 x float> @test_maxnum_const_inf_nnan_comm_vec(<2 x float> %x) {
 ; CHECK-LABEL: @test_maxnum_const_inf_nnan_comm_vec(
-; CHECK-NEXT:    ret <2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>
+; CHECK-NEXT:    ret <2 x float> <float pinf, float pinf>
 ;
   %r = call nnan <2 x float> @llvm.maxnum.v2f32(<2 x float> <float 0x7ff0000000000000, float 0x7ff0000000000000>, <2 x float> %x)
   ret <2 x float> %r
@@ -204,7 +204,7 @@ define <2 x float> @test_maxnum_const_inf_nnan_comm_vec(<2 x float> %x) {
 
 define <2 x float> @test_maximum_const_inf_nnan_comm_vec(<2 x float> %x) {
 ; CHECK-LABEL: @test_maximum_const_inf_nnan_comm_vec(
-; CHECK-NEXT:    ret <2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>
+; CHECK-NEXT:    ret <2 x float> <float pinf, float pinf>
 ;
   %r = call nnan <2 x float> @llvm.maximum.v2f32(<2 x float> <float 0x7ff0000000000000, float 0x7ff0000000000000>, <2 x float> %x)
   ret <2 x float> %r
@@ -220,7 +220,7 @@ define <2 x float> @test_minimum_const_inf_nnan_comm_vec(<2 x float> %x) {
 
 define float @test_minnum_const_neg_inf_nnan(float %x) {
 ; CHECK-LABEL: @test_minnum_const_neg_inf_nnan(
-; CHECK-NEXT:    ret float 0xFFF0000000000000
+; CHECK-NEXT:    ret float ninf
 ;
   %r = call nnan float @llvm.minnum.f32(float %x, float 0xfff0000000000000)
   ret float %r
@@ -244,7 +244,7 @@ define float @test_maximum_const_neg_inf_nnan(float %x) {
 
 define float @test_minimum_const_neg_inf_nnan(float %x) {
 ; CHECK-LABEL: @test_minimum_const_neg_inf_nnan(
-; CHECK-NEXT:    ret float 0xFFF0000000000000
+; CHECK-NEXT:    ret float ninf
 ;
   %r = call nnan float @llvm.minimum.f32(float %x, float 0xfff0000000000000)
   ret float %r
@@ -719,7 +719,7 @@ define float @minnum_x_y_minnum_z(float %x, float %y, float %z) {
 
 define float @minnum_neginf(float %x) {
 ; CHECK-LABEL: @minnum_neginf(
-; CHECK-NEXT:    ret float 0xFFF0000000000000
+; CHECK-NEXT:    ret float ninf
 ;
   %val = call float @llvm.minnum.f32(float %x, float 0xFFF0000000000000)
   ret float %val
@@ -727,7 +727,7 @@ define float @minnum_neginf(float %x) {
 
 define <2 x double> @minnum_neginf_commute_vec(<2 x double> %x) {
 ; CHECK-LABEL: @minnum_neginf_commute_vec(
-; CHECK-NEXT:    ret <2 x double> <double 0xFFF0000000000000, double 0xFFF0000000000000>
+; CHECK-NEXT:    ret <2 x double> <double ninf, double ninf>
 ;
   %r = call <2 x double> @llvm.minnum.v2f64(<2 x double> <double 0xFFF0000000000000, double 0xFFF0000000000000>, <2 x double> %x)
   ret <2 x double> %r
@@ -737,7 +737,7 @@ define <2 x double> @minnum_neginf_commute_vec(<2 x double> %x) {
 
 define float @minnum_inf(float %x) {
 ; CHECK-LABEL: @minnum_inf(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.minnum.f32(float 0x7FF0000000000000, float [[X:%.*]])
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.minnum.f32(float pinf, float [[X:%.*]])
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.minnum.f32(float 0x7FF0000000000000, float %x)
@@ -813,7 +813,7 @@ define float @maxnum_x_y_maxnum_z(float %x, float %y, float %z) {
 
 define <2 x double> @maxnum_inf(<2 x double> %x) {
 ; CHECK-LABEL: @maxnum_inf(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF0000000000000, double 0x7FF0000000000000>
+; CHECK-NEXT:    ret <2 x double> <double pinf, double pinf>
 ;
   %val = call <2 x double> @llvm.maxnum.v2f64(<2 x double> %x, <2 x double><double 0x7FF0000000000000, double 0x7FF0000000000000>)
   ret <2 x double> %val
@@ -821,7 +821,7 @@ define <2 x double> @maxnum_inf(<2 x double> %x) {
 
 define float @maxnum_inf_commute(float %x) {
 ; CHECK-LABEL: @maxnum_inf_commute(
-; CHECK-NEXT:    ret float 0x7FF0000000000000
+; CHECK-NEXT:    ret float pinf
 ;
   %val = call float @llvm.maxnum.f32(float 0x7FF0000000000000, float %x)
   ret float %val
@@ -831,7 +831,7 @@ define float @maxnum_inf_commute(float %x) {
 
 define float @maxnum_neginf(float %x) {
 ; CHECK-LABEL: @maxnum_neginf(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.maxnum.f32(float 0xFFF0000000000000, float [[X:%.*]])
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.maxnum.f32(float ninf, float [[X:%.*]])
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.maxnum.f32(float 0xFFF0000000000000, float %x)
@@ -843,7 +843,7 @@ define float @maxnum_neginf(float %x) {
 
 define double @maximum_nan_op0(double %x) {
 ; CHECK-LABEL: @maximum_nan_op0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = call double @llvm.maximum.f64(double 0x7ff8000000000000, double %x)
   ret double %r
@@ -875,7 +875,7 @@ define double @minimum_nan_op1(double %x) {
 
 define <2 x double> @maximum_nan_op0_vec_partial_poison(<2 x double> %x) {
 ; CHECK-LABEL: @maximum_nan_op0_vec_partial_poison(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double poison>
+; CHECK-NEXT:    ret <2 x double> <double nan, double poison>
 ;
   %r = call <2 x double> @llvm.maximum.v2f64(<2 x double> <double 0x7ff8000000000000, double poison>, <2 x double> %x)
   ret <2 x double> %r
@@ -883,7 +883,7 @@ define <2 x double> @maximum_nan_op0_vec_partial_poison(<2 x double> %x) {
 
 define <2 x double> @maximum_nan_op1_vec_partial_poison(<2 x double> %x) {
 ; CHECK-LABEL: @maximum_nan_op1_vec_partial_poison(
-; CHECK-NEXT:    ret <2 x double> <double 0x7FF8000000000000, double poison>
+; CHECK-NEXT:    ret <2 x double> <double nan, double poison>
 ;
   %r = call <2 x double> @llvm.maximum.v2f64(<2 x double> %x, <2 x double> <double 0x7ff8000000000000, double poison>)
   ret <2 x double> %r
@@ -1153,7 +1153,7 @@ define float @maximum_x_y_maximum_z(float %x, float %y, float %z) {
 
 define float @minimum_neginf(float %x) {
 ; CHECK-LABEL: @minimum_neginf(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float 0xFFF0000000000000)
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.minimum.f32(float [[X:%.*]], float ninf)
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.minimum.f32(float %x, float 0xFFF0000000000000)
@@ -1164,7 +1164,7 @@ define float @minimum_neginf(float %x) {
 
 define <2 x double> @minimum_neginf_commute_vec(<2 x double> %x) {
 ; CHECK-LABEL: @minimum_neginf_commute_vec(
-; CHECK-NEXT:    [[R:%.*]] = call <2 x double> @llvm.minimum.v2f64(<2 x double> <double 0xFFF0000000000000, double 0xFFF0000000000000>, <2 x double> [[X:%.*]])
+; CHECK-NEXT:    [[R:%.*]] = call <2 x double> @llvm.minimum.v2f64(<2 x double> <double ninf, double ninf>, <2 x double> [[X:%.*]])
 ; CHECK-NEXT:    ret <2 x double> [[R]]
 ;
   %r = call <2 x double> @llvm.minimum.v2f64(<2 x double> <double 0xFFF0000000000000, double 0xFFF0000000000000>, <2 x double> %x)
@@ -1185,7 +1185,7 @@ define float @minimum_inf(float %x) {
 
 define <2 x double> @maximum_inf(<2 x double> %x) {
 ; CHECK-LABEL: @maximum_inf(
-; CHECK-NEXT:    [[VAL:%.*]] = call <2 x double> @llvm.maximum.v2f64(<2 x double> [[X:%.*]], <2 x double> <double 0x7FF0000000000000, double 0x7FF0000000000000>)
+; CHECK-NEXT:    [[VAL:%.*]] = call <2 x double> @llvm.maximum.v2f64(<2 x double> [[X:%.*]], <2 x double> <double pinf, double pinf>)
 ; CHECK-NEXT:    ret <2 x double> [[VAL]]
 ;
   %val = call <2 x double> @llvm.maximum.v2f64(<2 x double> %x, <2 x double><double 0x7FF0000000000000, double 0x7FF0000000000000>)
@@ -1196,7 +1196,7 @@ define <2 x double> @maximum_inf(<2 x double> %x) {
 
 define float @maximum_inf_commute(float %x) {
 ; CHECK-LABEL: @maximum_inf_commute(
-; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.maximum.f32(float 0x7FF0000000000000, float [[X:%.*]])
+; CHECK-NEXT:    [[VAL:%.*]] = call float @llvm.maximum.f32(float pinf, float [[X:%.*]])
 ; CHECK-NEXT:    ret float [[VAL]]
 ;
   %val = call float @llvm.maximum.f32(float 0x7FF0000000000000, float %x)
diff --git a/llvm/test/Transforms/InstSimplify/fp-nan.ll b/llvm/test/Transforms/InstSimplify/fp-nan.ll
index bb557500822c14..6b978396489e73 100644
--- a/llvm/test/Transforms/InstSimplify/fp-nan.ll
+++ b/llvm/test/Transforms/InstSimplify/fp-nan.ll
@@ -5,7 +5,7 @@
 
 define double @fadd_nan_op0(double %x) {
 ; CHECK-LABEL: @fadd_nan_op0(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fadd double 0x7FF8000000000000, %x
   ret double %r
@@ -103,7 +103,7 @@ define <vscale x 1 x double> @fmul_nan_op0_scalable_vec_1(<vscale x 1 x double>
 
 define <2 x float> @fmul_nan_op1(<2 x float> %x) {
 ; CHECK-LABEL: @fmul_nan_op1(
-; CHECK-NEXT:    ret <2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>
+; CHECK-NEXT:    ret <2 x float> <float nan, float nan>
 ;
   %r = fmul <2 x float> %x, <float 0x7FF8000000000000, float 0x7FF8000000000000>
   ret <2 x float> %r
@@ -111,7 +111,7 @@ define <2 x float> @fmul_nan_op1(<2 x float> %x) {
 
 define <vscale x 1 x double> @fmul_nan_op1_scalable_vec(<vscale x 1 x double> %x) {
 ; CHECK-LABEL: @fmul_nan_op1_scalable_vec(
-; CHECK-NEXT:    ret <vscale x 1 x double> shufflevector (<vscale x 1 x double> insertelement (<vscale x 1 x double> poison, double 0x7FF8000000000000, i64 0), <vscale x 1 x double> poison, <vscale x 1 x i32> zeroinitializer)
+; CHECK-NEXT:    ret <vscale x 1 x double> shufflevector (<vscale x 1 x double> insertelement (<vscale x 1 x double> poison, double nan, i64 0), <vscale x 1 x double> poison, <vscale x 1 x i32> zeroinitializer)
 ;
   %r = fmul <vscale x 1 x double> %x, splat (double 0x7FF8000000000000)
   ret <vscale x 1 x double> %r
@@ -186,7 +186,7 @@ define <3 x double> @fadd_nan_poison_undef_op1(<3 x double> %x) {
 
 define float @frem_nan_op1(float %x) {
 ; CHECK-LABEL: @frem_nan_op1(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = frem float %x, 0x7FF8000000000000
   ret float %r
diff --git a/llvm/test/Transforms/InstSimplify/fp-undef-poison-strictfp.ll b/llvm/test/Transforms/InstSimplify/fp-undef-poison-strictfp.ll
index 801fd75a24a715..b61b7e4bd7b1a9 100644
--- a/llvm/test/Transforms/InstSimplify/fp-undef-poison-strictfp.ll
+++ b/llvm/test/Transforms/InstSimplify/fp-undef-poison-strictfp.ll
@@ -36,7 +36,7 @@ define float @fadd_undef_op0_upward(float %x) #0 {
 
 define float @fadd_undef_op0_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fadd_undef_op0_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fadd.f32(float undef, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -104,7 +104,7 @@ define float @fadd_undef_op1_upward(float %x) #0 {
 
 define float @fadd_undef_op1_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fadd_undef_op1_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fadd.f32(float %x, float undef, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -176,7 +176,7 @@ define float @fsub_undef_op0_upward(float %x) #0 {
 
 define float @fsub_undef_op0_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fsub_undef_op0_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fsub.f32(float undef, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -244,7 +244,7 @@ define float @fsub_undef_op1_upward(float %x) #0 {
 
 define float @fsub_undef_op1_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fsub_undef_op1_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fsub.f32(float %x, float undef, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -316,7 +316,7 @@ define float @fmul_undef_op0_upward(float %x) #0 {
 
 define float @fmul_undef_op0_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fmul_undef_op0_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fmul.f32(float undef, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -331,7 +331,7 @@ define float @fmul_poison_op0_strict(float %x) #0 {
   ret float %r
 }
 
-define float @fmul_poison_op0_maytrap(float %x) #0 { 
+define float @fmul_poison_op0_maytrap(float %x) #0 {
 ; CHECK-LABEL: @fmul_poison_op0_maytrap(
 ; CHECK-NEXT:    ret float poison
 ;
@@ -384,7 +384,7 @@ define float @fmul_undef_op1_upward(float %x) #0 {
 
 define float @fmul_undef_op1_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fmul_undef_op1_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fmul.f32(float %x, float undef, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -456,7 +456,7 @@ define float @fdiv_undef_op0_upward(float %x) #0 {
 
 define float @fdiv_undef_op0_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fdiv_undef_op0_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fdiv.f32(float undef, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -524,7 +524,7 @@ define float @fdiv_undef_op1_upward(float %x) #0 {
 
 define float @fdiv_undef_op1_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @fdiv_undef_op1_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fdiv.f32(float %x, float undef, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -596,7 +596,7 @@ define float @frem_undef_op0_upward(float %x) #0 {
 
 define float @frem_undef_op0_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @frem_undef_op0_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.frem.f32(float undef, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -664,7 +664,7 @@ define float @frem_undef_op1_upward(float %x) #0 {
 
 define float @frem_undef_op1_defaultfp(float %x) #0 {
 ; CHECK-LABEL: @frem_undef_op1_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.frem.f32(float %x, float undef, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -736,7 +736,7 @@ define float @fma_undef_op0_upward(float %x, float %y) #0 {
 
 define float @fma_undef_op0_defaultfp(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_undef_op0_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float undef, float %x, float %y, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -804,7 +804,7 @@ define float @fma_undef_op1_upward(float %x, float %y) #0 {
 
 define float @fma_undef_op1_defaultfp(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_undef_op1_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float %x, float undef, float %y, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
@@ -872,7 +872,7 @@ define float @fma_undef_op2_upward(float %x, float %y) #0 {
 
 define float @fma_undef_op2_defaultfp(float %x, float %y) #0 {
 ; CHECK-LABEL: @fma_undef_op2_defaultfp(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = call float @llvm.experimental.constrained.fma.f32(float %x, float %y, float undef, metadata !"round.tonearest", metadata !"fpexcept.ignore")
   ret float %r
diff --git a/llvm/test/Transforms/InstSimplify/fp-undef-poison.ll b/llvm/test/Transforms/InstSimplify/fp-undef-poison.ll
index cb2026df962c85..a75b6006163fff 100644
--- a/llvm/test/Transforms/InstSimplify/fp-undef-poison.ll
+++ b/llvm/test/Transforms/InstSimplify/fp-undef-poison.ll
@@ -3,7 +3,7 @@
 
 define float @fadd_undef_op0(float %x) {
 ; CHECK-LABEL: @fadd_undef_op0(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fadd float undef, %x
   ret float %r
@@ -19,7 +19,7 @@ define float @fadd_poison_op0(float %x) {
 
 define float @fadd_undef_op1(float %x) {
 ; CHECK-LABEL: @fadd_undef_op1(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fadd float %x, undef
   ret float %r
@@ -35,7 +35,7 @@ define float @fadd_poison_op1(float %x) {
 
 define float @fsub_undef_op0(float %x) {
 ; CHECK-LABEL: @fsub_undef_op0(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fsub float undef, %x
   ret float %r
@@ -51,7 +51,7 @@ define float @fsub_poison_op0(float %x) {
 
 define float @fsub_undef_op1(float %x) {
 ; CHECK-LABEL: @fsub_undef_op1(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fsub float %x, undef
   ret float %r
@@ -67,7 +67,7 @@ define float @fsub_poison_op1(float %x) {
 
 define float @fmul_undef_op0(float %x) {
 ; CHECK-LABEL: @fmul_undef_op0(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fmul float undef, %x
   ret float %r
@@ -83,7 +83,7 @@ define float @fmul_poison_op0(float %x) {
 
 define float @fmul_undef_op1(float %x) {
 ; CHECK-LABEL: @fmul_undef_op1(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fmul float %x, undef
   ret float %r
@@ -99,7 +99,7 @@ define float @fmul_poison_op1(float %x) {
 
 define float @fdiv_undef_op0(float %x) {
 ; CHECK-LABEL: @fdiv_undef_op0(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fdiv float undef, %x
   ret float %r
@@ -115,7 +115,7 @@ define float @fdiv_poison_op0(float %x) {
 
 define float @fdiv_undef_op1(float %x) {
 ; CHECK-LABEL: @fdiv_undef_op1(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = fdiv float %x, undef
   ret float %r
@@ -131,7 +131,7 @@ define float @fdiv_poison_op1(float %x) {
 
 define float @frem_undef_op0(float %x) {
 ; CHECK-LABEL: @frem_undef_op0(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = frem float undef, %x
   ret float %r
@@ -147,7 +147,7 @@ define float @frem_poison_op0(float %x) {
 
 define float @frem_undef_op1(float %x) {
 ; CHECK-LABEL: @frem_undef_op1(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %r = frem float %x, undef
   ret float %r
@@ -253,7 +253,7 @@ define double @fdiv_ninf_nan_op0(double %x) {
 
 define double @fadd_ninf_nan_op1(double %x) {
 ; CHECK-LABEL: @fadd_ninf_nan_op1(
-; CHECK-NEXT:    ret double 0x7FF8000000000000
+; CHECK-NEXT:    ret double nan
 ;
   %r = fadd ninf double %x, 0x7ff8000000000000
   ret double %r
@@ -277,7 +277,7 @@ define double @fadd_ninf_inf_op1(double %x) {
 
 define double @fsub_nnan_inf_op0(double %x) {
 ; CHECK-LABEL: @fsub_nnan_inf_op0(
-; CHECK-NEXT:    ret double 0x7FF0000000000000
+; CHECK-NEXT:    ret double pinf
 ;
   %r = fsub nnan double 0x7ff0000000000000, %x
   ret double %r
@@ -287,7 +287,7 @@ define double @fsub_nnan_inf_op0(double %x) {
 
 define double @fmul_nnan_inf_op1(double %x) {
 ; CHECK-LABEL: @fmul_nnan_inf_op1(
-; CHECK-NEXT:    [[R:%.*]] = fmul nnan double [[X:%.*]], 0xFFF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fmul nnan double [[X:%.*]], ninf
 ; CHECK-NEXT:    ret double [[R]]
 ;
   %r = fmul nnan double %x, 0xfff0000000000000
diff --git a/llvm/test/Transforms/InstSimplify/frexp.ll b/llvm/test/Transforms/InstSimplify/frexp.ll
index 63fe1dec692933..bd7ca0a7300dfc 100644
--- a/llvm/test/Transforms/InstSimplify/frexp.ll
+++ b/llvm/test/Transforms/InstSimplify/frexp.ll
@@ -9,8 +9,8 @@ declare { <vscale x 2 x float>, <vscale x 2 x i32> } @llvm.frexp.nxv2f32.nxv2i32
 
 
 define { float, i32 } @frexp_frexp(float %x) {
-; CHECK-LABEL: define { float, i32 } @frexp_frexp
-; CHECK-SAME: (float [[X:%.*]]) {
+; CHECK-LABEL: define { float, i32 } @frexp_frexp(
+; CHECK-SAME: float [[X:%.*]]) {
 ; CHECK-NEXT:    [[FREXP0:%.*]] = call { float, i32 } @llvm.frexp.f32.i32(float [[X]])
 ; CHECK-NEXT:    ret { float, i32 } [[FREXP0]]
 ;
@@ -21,8 +21,8 @@ define { float, i32 } @frexp_frexp(float %x) {
 }
 
 define { <2 x float>, <2 x i32> } @frexp_frexp_vector(<2 x float> %x) {
-; CHECK-LABEL: define { <2 x float>, <2 x i32> } @frexp_frexp_vector
-; CHECK-SAME: (<2 x float> [[X:%.*]]) {
+; CHECK-LABEL: define { <2 x float>, <2 x i32> } @frexp_frexp_vector(
+; CHECK-SAME: <2 x float> [[X:%.*]]) {
 ; CHECK-NEXT:    [[FREXP0:%.*]] = call { <2 x float>, <2 x i32> } @llvm.frexp.v2f32.v2i32(<2 x float> [[X]])
 ; CHECK-NEXT:    ret { <2 x float>, <2 x i32> } [[FREXP0]]
 ;
@@ -33,8 +33,8 @@ define { <2 x float>, <2 x i32> } @frexp_frexp_vector(<2 x float> %x) {
 }
 
 define { float, i32 } @frexp_frexp_const(float %x) {
-; CHECK-LABEL: define { float, i32 } @frexp_frexp_const
-; CHECK-SAME: (float [[X:%.*]]) {
+; CHECK-LABEL: define { float, i32 } @frexp_frexp_const(
+; CHECK-SAME: float [[X:%.*]]) {
 ; CHECK-NEXT:    ret { float, i32 } { float 6.562500e-01, i32 0 }
 ;
   %frexp0 = call { float, i32 } @llvm.frexp.f32.i32(float 42.0)
@@ -44,8 +44,8 @@ define { float, i32 } @frexp_frexp_const(float %x) {
 }
 
 define { <vscale x 2 x float>, <vscale x 2 x i32> } @frexp_frexp_scalable_vector(<vscale x 2 x float> %x) {
-; CHECK-LABEL: define { <vscale x 2 x float>, <vscale x 2 x i32> } @frexp_frexp_scalable_vector
-; CHECK-SAME: (<vscale x 2 x float> [[X:%.*]]) {
+; CHECK-LABEL: define { <vscale x 2 x float>, <vscale x 2 x i32> } @frexp_frexp_scalable_vector(
+; CHECK-SAME: <vscale x 2 x float> [[X:%.*]]) {
 ; CHECK-NEXT:    [[FREXP0:%.*]] = call { <vscale x 2 x float>, <vscale x 2 x i32> } @llvm.frexp.nxv2f32.nxv2i32(<vscale x 2 x float> [[X]])
 ; CHECK-NEXT:    ret { <vscale x 2 x float>, <vscale x 2 x i32> } [[FREXP0]]
 ;
@@ -180,7 +180,7 @@ define { float, i32 } @frexp_negtwo() {
 
 define { float, i32 } @frexp_inf() {
 ; CHECK-LABEL: define { float, i32 } @frexp_inf() {
-; CHECK-NEXT:    ret { float, i32 } { float 0x7FF0000000000000, i32 0 }
+; CHECK-NEXT:    ret { float, i32 } { float pinf, i32 0 }
 ;
   %ret = call { float, i32 } @llvm.frexp.f32.i32(float 0x7FF0000000000000)
   ret { float, i32 } %ret
@@ -188,7 +188,7 @@ define { float, i32 } @frexp_inf() {
 
 define { float, i32 } @frexp_neginf() {
 ; CHECK-LABEL: define { float, i32 } @frexp_neginf() {
-; CHECK-NEXT:    ret { float, i32 } { float 0xFFF0000000000000, i32 0 }
+; CHECK-NEXT:    ret { float, i32 } { float ninf, i32 0 }
 ;
   %ret = call { float, i32 } @llvm.frexp.f32.i32(float 0xFFF0000000000000)
   ret { float, i32 } %ret
@@ -196,7 +196,7 @@ define { float, i32 } @frexp_neginf() {
 
 define { float, i32 } @frexp_qnan() {
 ; CHECK-LABEL: define { float, i32 } @frexp_qnan() {
-; CHECK-NEXT:    ret { float, i32 } { float 0x7FF8000000000000, i32 0 }
+; CHECK-NEXT:    ret { float, i32 } { float nan, i32 0 }
 ;
   %ret = call { float, i32 } @llvm.frexp.f32.i32(float 0x7FF8000000000000)
   ret { float, i32 } %ret
@@ -260,7 +260,7 @@ define { <2 x float>, <2 x i32> } @frexp_splat_4() {
 
 define { <2 x float>, <2 x i32> } @frexp_splat_qnan() {
 ; CHECK-LABEL: define { <2 x float>, <2 x i32> } @frexp_splat_qnan() {
-; CHECK-NEXT:    ret { <2 x float>, <2 x i32> } { <2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>, <2 x i32> zeroinitializer }
+; CHECK-NEXT:    ret { <2 x float>, <2 x i32> } { <2 x float> <float nan, float nan>, <2 x i32> zeroinitializer }
 ;
   %ret = call { <2 x float>, <2 x i32> } @llvm.frexp.v2f32.v2i32(<2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>)
   ret { <2 x float>, <2 x i32> } %ret
@@ -268,7 +268,7 @@ define { <2 x float>, <2 x i32> } @frexp_splat_qnan() {
 
 define { <2 x float>, <2 x i32> } @frexp_splat_inf() {
 ; CHECK-LABEL: define { <2 x float>, <2 x i32> } @frexp_splat_inf() {
-; CHECK-NEXT:    ret { <2 x float>, <2 x i32> } { <2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>, <2 x i32> zeroinitializer }
+; CHECK-NEXT:    ret { <2 x float>, <2 x i32> } { <2 x float> <float pinf, float pinf>, <2 x i32> zeroinitializer }
 ;
   %ret = call { <2 x float>, <2 x i32> } @llvm.frexp.v2f32.v2i32(<2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>)
   ret { <2 x float>, <2 x i32> } %ret
@@ -276,7 +276,7 @@ define { <2 x float>, <2 x i32> } @frexp_splat_inf() {
 
 define { <2 x float>, <2 x i32> } @frexp_splat_neginf() {
 ; CHECK-LABEL: define { <2 x float>, <2 x i32> } @frexp_splat_neginf() {
-; CHECK-NEXT:    ret { <2 x float>, <2 x i32> } { <2 x float> <float 0xFFF0000000000000, float 0xFFF0000000000000>, <2 x i32> zeroinitializer }
+; CHECK-NEXT:    ret { <2 x float>, <2 x i32> } { <2 x float> <float ninf, float ninf>, <2 x i32> zeroinitializer }
 ;
   %ret = call { <2 x float>, <2 x i32> } @llvm.frexp.v2f32.v2i32(<2 x float> <float 0xFFF0000000000000, float 0xFFF0000000000000>)
   ret { <2 x float>, <2 x i32> } %ret
@@ -284,7 +284,7 @@ define { <2 x float>, <2 x i32> } @frexp_splat_neginf() {
 
 define { <2 x float>, <2 x i32> } @frexp_splat_undef_inf() {
 ; CHECK-LABEL: define { <2 x float>, <2 x i32> } @frexp_splat_undef_inf() {
-; CHECK-NEXT:    [[RET:%.*]] = call { <2 x float>, <2 x i32> } @llvm.frexp.v2f32.v2i32(<2 x float> <float undef, float 0x7FF0000000000000>)
+; CHECK-NEXT:    [[RET:%.*]] = call { <2 x float>, <2 x i32> } @llvm.frexp.v2f32.v2i32(<2 x float> <float undef, float pinf>)
 ; CHECK-NEXT:    ret { <2 x float>, <2 x i32> } [[RET]]
 ;
   %ret = call { <2 x float>, <2 x i32> } @llvm.frexp.v2f32.v2i32(<2 x float> <float undef, float 0x7FF0000000000000>)
diff --git a/llvm/test/Transforms/InstSimplify/known-never-infinity.ll b/llvm/test/Transforms/InstSimplify/known-never-infinity.ll
index 4d662c08b1a7a1..9f1c134aecd80b 100644
--- a/llvm/test/Transforms/InstSimplify/known-never-infinity.ll
+++ b/llvm/test/Transforms/InstSimplify/known-never-infinity.ll
@@ -20,7 +20,7 @@ define i1 @isNotKnownNeverInfinity_uitofp(i16 %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_uitofp
 ; CHECK-SAME: (i16 [[X:%.*]]) {
 ; CHECK-NEXT:    [[F:%.*]] = uitofp i16 [[X]] to half
-; CHECK-NEXT:    [[R:%.*]] = fcmp une half [[F]], 0xH7C00
+; CHECK-NEXT:    [[R:%.*]] = fcmp une half [[F]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %f = uitofp i16 %x to half
@@ -69,7 +69,7 @@ define i1 @isNotKnownNeverInfinity_sitofp(i17 %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_sitofp
 ; CHECK-SAME: (i17 [[X:%.*]]) {
 ; CHECK-NEXT:    [[F:%.*]] = sitofp i17 [[X]] to half
-; CHECK-NEXT:    [[R:%.*]] = fcmp une half [[F]], 0xH7C00
+; CHECK-NEXT:    [[R:%.*]] = fcmp une half [[F]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %f = sitofp i17 %x to half
@@ -93,7 +93,7 @@ define i1 @isNotKnownNeverNegativeInfinity_sitofp(i17 %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverNegativeInfinity_sitofp
 ; CHECK-SAME: (i17 [[X:%.*]]) {
 ; CHECK-NEXT:    [[F:%.*]] = sitofp i17 [[X]] to half
-; CHECK-NEXT:    [[R:%.*]] = fcmp oeq half [[F]], 0xHFC00
+; CHECK-NEXT:    [[R:%.*]] = fcmp oeq half [[F]], ninf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %f = sitofp i17 %x to half
@@ -128,7 +128,7 @@ define i1 @isKnownNeverInfinity_fptrunc(double %x) {
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = fadd ninf double [[X]], 1.000000e+00
 ; CHECK-NEXT:    [[E:%.*]] = fptrunc double [[A]] to float
-; CHECK-NEXT:    [[R:%.*]] = fcmp une float [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une float [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = fadd ninf double %x, 1.0
@@ -141,7 +141,7 @@ define i1 @isNotKnownNeverInfinity_fptrunc(double %unknown) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_fptrunc
 ; CHECK-SAME: (double [[UNKNOWN:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = fptrunc double [[UNKNOWN]] to float
-; CHECK-NEXT:    [[R:%.*]] = fcmp une float [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une float [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = fptrunc double %unknown to float
@@ -164,7 +164,7 @@ define i1 @isNotKnownNeverInfinity_canonicalize(double %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_canonicalize
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.canonicalize.f64(double [[X]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = call double @llvm.canonicalize.f64(double %x)
@@ -187,7 +187,7 @@ define i1 @isNotKnownNeverInfinity_fabs(double %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_fabs
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.fabs.f64(double [[X]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = call double @llvm.fabs.f64(double %x)
@@ -210,7 +210,7 @@ define i1 @isNotKnownNeverInfinity_fneg(double %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_fneg
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = fneg double [[X]]
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = fneg double %x
@@ -233,7 +233,7 @@ define i1 @isNotKnownNeverInfinity_copysign(double %x, double %sign) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_copysign
 ; CHECK-SAME: (double [[X:%.*]], double [[SIGN:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.copysign.f64(double [[X]], double [[SIGN]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = call double @llvm.copysign.f64(double %x, double %sign)
@@ -256,7 +256,7 @@ define i1 @isNotKnownNeverInfinity_arithmetic_fence(double %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_arithmetic_fence
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.arithmetic.fence.f64(double [[X]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = call double @llvm.arithmetic.fence.f64(double %x)
@@ -279,7 +279,7 @@ define i1 @isNotKnownNeverInfinity_floor(double %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_floor
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.floor.f64(double [[X]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = call double @llvm.floor.f64(double %x)
@@ -302,7 +302,7 @@ define i1 @isNotKnownNeverInfinity_ceil(double %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_ceil
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.ceil.f64(double [[X]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = call double @llvm.ceil.f64(double %x)
@@ -325,7 +325,7 @@ define i1 @isNotKnownNeverInfinity_trunc(double %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_trunc
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.trunc.f64(double [[X]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = call double @llvm.trunc.f64(double %x)
@@ -348,7 +348,7 @@ define i1 @isNotKnownNeverInfinity_rint(double %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_rint
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.rint.f64(double [[X]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = call double @llvm.rint.f64(double %x)
@@ -371,7 +371,7 @@ define i1 @isNotKnownNeverInfinity_nearbyint(double %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_nearbyint
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.nearbyint.f64(double [[X]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = call double @llvm.nearbyint.f64(double %x)
@@ -394,7 +394,7 @@ define i1 @isNotKnownNeverInfinity_round(double %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_round
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.round.f64(double [[X]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = call double @llvm.round.f64(double %x)
@@ -417,7 +417,7 @@ define i1 @isNotKnownNeverInfinity_roundeven(double %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_roundeven
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.roundeven.f64(double [[X]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = call double @llvm.roundeven.f64(double %x)
@@ -430,7 +430,7 @@ define i1 @isNotKnownNeverInfinity_fptrunc_round(double %x) {
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = fadd ninf double [[X]], 1.000000e+00
 ; CHECK-NEXT:    [[E:%.*]] = call float @llvm.fptrunc.round.f32.f64(double [[A]], metadata !"round.downward")
-; CHECK-NEXT:    [[R:%.*]] = fcmp une float [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une float [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = fadd ninf double %x, 1.0
@@ -444,7 +444,7 @@ define i1 @isKnownNeverInfinity_floor_ppcf128(ppc_fp128 %x) {
 ; CHECK-SAME: (ppc_fp128 [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = fadd ninf ppc_fp128 [[X]], [[X]]
 ; CHECK-NEXT:    [[E:%.*]] = call ppc_fp128 @llvm.floor.ppcf128(ppc_fp128 [[A]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une ppc_fp128 [[E]], 0xM7FF00000000000000000000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une ppc_fp128 [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = fadd ninf ppc_fp128 %x, %x
@@ -458,7 +458,7 @@ define i1 @isKnownNeverInfinity_ceil_ppcf128(ppc_fp128 %x) {
 ; CHECK-SAME: (ppc_fp128 [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = fadd ninf ppc_fp128 [[X]], [[X]]
 ; CHECK-NEXT:    [[E:%.*]] = call ppc_fp128 @llvm.ceil.ppcf128(ppc_fp128 [[A]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une ppc_fp128 [[E]], 0xM7FF00000000000000000000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une ppc_fp128 [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = fadd ninf ppc_fp128 %x, %x
@@ -472,7 +472,7 @@ define i1 @isKnownNeverInfinity_rint_ppcf128(ppc_fp128 %x) {
 ; CHECK-SAME: (ppc_fp128 [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = fadd ninf ppc_fp128 [[X]], [[X]]
 ; CHECK-NEXT:    [[E:%.*]] = call ppc_fp128 @llvm.rint.ppcf128(ppc_fp128 [[A]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une ppc_fp128 [[E]], 0xM7FF00000000000000000000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une ppc_fp128 [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = fadd ninf ppc_fp128 %x, %x
@@ -486,7 +486,7 @@ define i1 @isKnownNeverInfinity_nearbyint_ppcf128(ppc_fp128 %x) {
 ; CHECK-SAME: (ppc_fp128 [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = fadd ninf ppc_fp128 [[X]], [[X]]
 ; CHECK-NEXT:    [[E:%.*]] = call ppc_fp128 @llvm.nearbyint.ppcf128(ppc_fp128 [[A]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une ppc_fp128 [[E]], 0xM7FF00000000000000000000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une ppc_fp128 [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = fadd ninf ppc_fp128 %x, %x
@@ -500,7 +500,7 @@ define i1 @isKnownNeverInfinity_round_ppcf128(ppc_fp128 %x) {
 ; CHECK-SAME: (ppc_fp128 [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = fadd ninf ppc_fp128 [[X]], [[X]]
 ; CHECK-NEXT:    [[E:%.*]] = call ppc_fp128 @llvm.round.ppcf128(ppc_fp128 [[A]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une ppc_fp128 [[E]], 0xM7FF00000000000000000000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une ppc_fp128 [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = fadd ninf ppc_fp128 %x, %x
@@ -514,7 +514,7 @@ define i1 @isKnownNeverInfinity_roundeven_ppcf128(ppc_fp128 %x) {
 ; CHECK-SAME: (ppc_fp128 [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = fadd ninf ppc_fp128 [[X]], [[X]]
 ; CHECK-NEXT:    [[E:%.*]] = call ppc_fp128 @llvm.roundeven.ppcf128(ppc_fp128 [[A]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une ppc_fp128 [[E]], 0xM7FF00000000000000000000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une ppc_fp128 [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = fadd ninf ppc_fp128 %x, %x
@@ -562,7 +562,7 @@ define i1 @isNotKnownNeverInfinity_minnum_lhs(double %x, double %y) {
 ; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]]) {
 ; CHECK-NEXT:    [[NINF_Y:%.*]] = fadd ninf double [[Y]], 1.000000e+00
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.minnum.f64(double [[X]], double [[NINF_Y]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.y = fadd ninf double %y, 1.0
@@ -576,7 +576,7 @@ define i1 @isNotKnownNeverInfinity_minnum_rhs(double %x, double %y) {
 ; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]]) {
 ; CHECK-NEXT:    [[NINF_X:%.*]] = fadd ninf double [[X]], 1.000000e+00
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.minnum.f64(double [[NINF_X]], double [[Y]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.x = fadd ninf double %x, 1.0
@@ -602,7 +602,7 @@ define i1 @isNotKnownNeverInfinity_maxnum_lhs(double %x, double %y) {
 ; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]]) {
 ; CHECK-NEXT:    [[NINF_Y:%.*]] = fadd ninf double [[Y]], 1.000000e+00
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.maxnum.f64(double [[X]], double [[NINF_Y]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.y = fadd ninf double %y, 1.0
@@ -616,7 +616,7 @@ define i1 @isNotKnownNeverInfinity_maxnum_rhs(double %x, double %y) {
 ; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]]) {
 ; CHECK-NEXT:    [[NINF_X:%.*]] = fadd ninf double [[X]], 1.000000e+00
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.maxnum.f64(double [[NINF_X]], double [[Y]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.x = fadd ninf double %x, 1.0
@@ -642,7 +642,7 @@ define i1 @isNotKnownNeverInfinity_minimum_lhs(double %x, double %y) {
 ; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]]) {
 ; CHECK-NEXT:    [[NINF_Y:%.*]] = fadd ninf double [[Y]], 1.000000e+00
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.minimum.f64(double [[X]], double [[NINF_Y]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.y = fadd ninf double %y, 1.0
@@ -656,7 +656,7 @@ define i1 @isNotKnownNeverInfinity_minimum_rhs(double %x, double %y) {
 ; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]]) {
 ; CHECK-NEXT:    [[NINF_X:%.*]] = fadd ninf double [[X]], 1.000000e+00
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.minimum.f64(double [[NINF_X]], double [[Y]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.x = fadd ninf double %x, 1.0
@@ -682,7 +682,7 @@ define i1 @isNotKnownNeverInfinity_maximum_lhs(double %x, double %y) {
 ; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]]) {
 ; CHECK-NEXT:    [[NINF_Y:%.*]] = fadd ninf double [[Y]], 1.000000e+00
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.maximum.f64(double [[X]], double [[NINF_Y]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.y = fadd ninf double %y, 1.0
@@ -696,7 +696,7 @@ define i1 @isNotKnownNeverInfinity_maximum_rhs(double %x, double %y) {
 ; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]]) {
 ; CHECK-NEXT:    [[NINF_X:%.*]] = fadd ninf double [[X]], 1.000000e+00
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.maximum.f64(double [[NINF_X]], double [[Y]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.x = fadd ninf double %x, 1.0
@@ -720,7 +720,7 @@ define i1 @isNotKnownNeverInfinity_sqrt(double %x) {
 ; CHECK-LABEL: define i1 @isNotKnownNeverInfinity_sqrt
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.sqrt.f64(double [[X]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %e = call double @llvm.sqrt.f64(double %x)
@@ -779,7 +779,7 @@ define i1 @isNotKnownNeverInfinity_log_maybe_inf(double %x) {
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[X_CLAMP_ZERO:%.*]] = call double @llvm.maxnum.f64(double [[X]], double 0.000000e+00)
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.log.f64(double [[X_CLAMP_ZERO]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %x.clamp.zero = call double @llvm.maxnum.f64(double %x, double 0.0)
@@ -793,7 +793,7 @@ define i1 @isKnownNeverNegInfinity_log_maybe_0(double %x) {
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = call ninf double @llvm.sqrt.f64(double [[X]])
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.log.f64(double [[A]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0xFFF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], ninf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = call ninf double @llvm.sqrt.f64(double %x) ; could be 0.0
@@ -831,7 +831,7 @@ define i1 @isNotKnownNeverInfinity_log10_maybe_inf(double %x) {
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[X_CLAMP_ZERO:%.*]] = call double @llvm.maxnum.f64(double [[X]], double 0.000000e+00)
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.log10.f64(double [[X_CLAMP_ZERO]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %x.clamp.zero = call double @llvm.maxnum.f64(double %x, double 0.0)
@@ -845,7 +845,7 @@ define i1 @isKnownNeverNegInfinity_log10_maybe_0(double %x) {
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = call ninf double @llvm.sqrt.f64(double [[X]])
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.log10.f64(double [[A]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0xFFF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], ninf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = call ninf double @llvm.sqrt.f64(double %x) ; could be 0.0
@@ -883,7 +883,7 @@ define i1 @isNotKnownNeverInfinity_log2_maybe_inf(double %x) {
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[X_CLAMP_ZERO:%.*]] = call double @llvm.maxnum.f64(double [[X]], double 0.000000e+00)
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.log2.f64(double [[X_CLAMP_ZERO]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %x.clamp.zero = call double @llvm.maxnum.f64(double %x, double 0.0)
@@ -897,7 +897,7 @@ define i1 @isKnownNeverNegInfinity_log2_maybe_0(double %x) {
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = call ninf double @llvm.sqrt.f64(double [[X]])
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.log2.f64(double [[A]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0xFFF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], ninf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = call ninf double @llvm.sqrt.f64(double %x) ; could be 0.0
@@ -912,7 +912,7 @@ define i1 @isNotKnownNeverInfinity_pow(double %x, double %y) {
 ; CHECK-NEXT:    [[NINF_X:%.*]] = fadd ninf double [[X]], 1.000000e+00
 ; CHECK-NEXT:    [[NINF_Y:%.*]] = fadd ninf double [[Y]], 1.000000e+00
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.pow.f64(double [[NINF_X]], double [[NINF_Y]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.x = fadd ninf double %x, 1.0
@@ -927,7 +927,7 @@ define i1 @isNotKnownNeverInfinity_powi(double %x) {
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[NINF_X:%.*]] = fadd ninf double [[X]], 1.000000e+00
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.powi.f64.i32(double [[NINF_X]], i32 2)
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.x = fadd ninf double %x, 1.0
@@ -941,7 +941,7 @@ define i1 @isNotKnownNeverInfinity_exp(double %x) {
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = fadd ninf double [[X]], 1.000000e+00
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.exp.f64(double [[A]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = fadd ninf double %x, 1.0
@@ -955,7 +955,7 @@ define i1 @isNotKnownNeverInfinity_exp2(double %x) {
 ; CHECK-SAME: (double [[X:%.*]]) {
 ; CHECK-NEXT:    [[A:%.*]] = fadd ninf double [[X]], 1.000000e+00
 ; CHECK-NEXT:    [[E:%.*]] = call double @llvm.exp2.f64(double [[A]])
-; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], 0x7FF0000000000000
+; CHECK-NEXT:    [[R:%.*]] = fcmp une double [[E]], pinf
 ; CHECK-NEXT:    ret i1 [[R]]
 ;
   %a = fadd ninf double %x, 1.0
@@ -971,7 +971,7 @@ define i1 @isNotKnownNeverInfinity_fma(double %x, double %y, double %z) {
 ; CHECK-NEXT:    [[NINF_Y:%.*]] = fadd ninf double [[Y]], 1.000000e+00
 ; CHECK-NEXT:    [[NINF_Z:%.*]] = fadd ninf double [[Z]], 1.000000e+00
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.fma.f64(double [[NINF_X]], double [[NINF_Y]], double [[NINF_Z]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.x = fadd ninf double %x, 1.0
@@ -989,7 +989,7 @@ define i1 @isNotKnownNeverInfinity_fmuladd(double %x, double %y, double %z) {
 ; CHECK-NEXT:    [[NINF_Y:%.*]] = fadd ninf double [[Y]], 1.000000e+00
 ; CHECK-NEXT:    [[NINF_Z:%.*]] = fadd ninf double [[Z]], 1.000000e+00
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.fmuladd.f64(double [[NINF_X]], double [[NINF_Y]], double [[NINF_Z]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.x = fadd ninf double %x, 1.0
@@ -1004,9 +1004,9 @@ define i1 @not_inf_fabs_select_pzero_or_ninf(i1 %cond) {
 ; CHECK-LABEL: define i1 @not_inf_fabs_select_pzero_or_ninf
 ; CHECK-SAME: (i1 [[COND:%.*]]) {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float 0.000000e+00, float 0xFFF0000000000000
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float 0.000000e+00, float ninf
 ; CHECK-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[SELECT]])
-; CHECK-NEXT:    [[ONE:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[ONE:%.*]] = fcmp one float [[FABS]], pinf
 ; CHECK-NEXT:    ret i1 [[ONE]]
 ;
 entry:
@@ -1020,9 +1020,9 @@ define i1 @not_inf_fabs_select_nzero_or_pinf(i1 %cond) {
 ; CHECK-LABEL: define i1 @not_inf_fabs_select_nzero_or_pinf
 ; CHECK-SAME: (i1 [[COND:%.*]]) {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float -0.000000e+00, float 0x7FF0000000000000
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float -0.000000e+00, float pinf
 ; CHECK-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[SELECT]])
-; CHECK-NEXT:    [[ONE:%.*]] = fcmp one float [[FABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[ONE:%.*]] = fcmp one float [[FABS]], pinf
 ; CHECK-NEXT:    ret i1 [[ONE]]
 ;
 entry:
@@ -1049,10 +1049,10 @@ define i1 @not_ninf_fneg_fabs_select_nzero_or_pinf(i1 %cond) {
 ; CHECK-LABEL: define i1 @not_ninf_fneg_fabs_select_nzero_or_pinf
 ; CHECK-SAME: (i1 [[COND:%.*]]) {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float -0.000000e+00, float 0x7FF0000000000000
+; CHECK-NEXT:    [[SELECT:%.*]] = select i1 [[COND]], float -0.000000e+00, float pinf
 ; CHECK-NEXT:    [[FABS:%.*]] = call float @llvm.fabs.f32(float [[SELECT]])
 ; CHECK-NEXT:    [[FNEG_FABS:%.*]] = fneg float [[FABS]]
-; CHECK-NEXT:    [[ONE:%.*]] = fcmp one float [[FNEG_FABS]], 0xFFF0000000000000
+; CHECK-NEXT:    [[ONE:%.*]] = fcmp one float [[FNEG_FABS]], ninf
 ; CHECK-NEXT:    ret i1 [[ONE]]
 ;
 entry:
@@ -1125,7 +1125,7 @@ define i1 @isKnownNeverInfinity_vector_reduce_maximum_fail(<4 x double> %x) {
 ; CHECK-SAME: (<4 x double> [[X:%.*]]) {
 ; CHECK-NEXT:    [[NINF_X:%.*]] = fadd <4 x double> [[X]], <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.vector.reduce.fmaximum.v4f64(<4 x double> [[NINF_X]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.x = fadd <4 x double> %x, <double 1.0, double 1.0, double 1.0, double 1.0>
@@ -1150,7 +1150,7 @@ define i1 @isKnownNeverInfinity_vector_reduce_minimum_fail(<4 x double> %x) {
 ; CHECK-SAME: (<4 x double> [[X:%.*]]) {
 ; CHECK-NEXT:    [[NINF_X:%.*]] = fadd <4 x double> [[X]], <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.vector.reduce.fminimum.v4f64(<4 x double> [[NINF_X]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.x = fadd <4 x double> %x, <double 1.0, double 1.0, double 1.0, double 1.0>
@@ -1175,7 +1175,7 @@ define i1 @isKnownNeverInfinity_vector_reduce_fmax_fail(<4 x double> %x) {
 ; CHECK-SAME: (<4 x double> [[X:%.*]]) {
 ; CHECK-NEXT:    [[NINF_X:%.*]] = fadd <4 x double> [[X]], <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.vector.reduce.fmax.v4f64(<4 x double> [[NINF_X]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.x = fadd <4 x double> %x, <double 1.0, double 1.0, double 1.0, double 1.0>
@@ -1200,7 +1200,7 @@ define i1 @isKnownNeverInfinity_vector_reduce_fmin_fail(<4 x double> %x) {
 ; CHECK-SAME: (<4 x double> [[X:%.*]]) {
 ; CHECK-NEXT:    [[NINF_X:%.*]] = fadd <4 x double> [[X]], <double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00>
 ; CHECK-NEXT:    [[OP:%.*]] = call double @llvm.vector.reduce.fmin.v4f64(<4 x double> [[NINF_X]])
-; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[CMP:%.*]] = fcmp une double [[OP]], pinf
 ; CHECK-NEXT:    ret i1 [[CMP]]
 ;
   %ninf.x = fadd <4 x double> %x, <double 1.0, double 1.0, double 1.0, double 1.0>
diff --git a/llvm/test/Transforms/InstSimplify/known-never-nan.ll b/llvm/test/Transforms/InstSimplify/known-never-nan.ll
index 907eca0a856a81..25461321c30c9a 100644
--- a/llvm/test/Transforms/InstSimplify/known-never-nan.ll
+++ b/llvm/test/Transforms/InstSimplify/known-never-nan.ll
@@ -535,12 +535,12 @@ define i1 @isKnownNeverNaN_nofpclass_indirect_callsite(ptr %fptr) {
 define i1 @isKnownNeverNaN_invoke_callsite(ptr %ptr) personality i8 1 {
 ; CHECK-LABEL: @isKnownNeverNaN_invoke_callsite(
 ; CHECK-NEXT:    [[INVOKE:%.*]] = invoke nofpclass(nan) float [[PTR:%.*]]()
-; CHECK-NEXT:    to label [[NORMAL:%.*]] unwind label [[UNWIND:%.*]]
+; CHECK-NEXT:            to label [[NORMAL:%.*]] unwind label [[UNWIND:%.*]]
 ; CHECK:       normal:
 ; CHECK-NEXT:    ret i1 true
 ; CHECK:       unwind:
 ; CHECK-NEXT:    [[TMP1:%.*]] = landingpad ptr
-; CHECK-NEXT:    cleanup
+; CHECK-NEXT:            cleanup
 ; CHECK-NEXT:    resume ptr null
 ;
   %invoke = invoke nofpclass(nan) float %ptr() to label %normal unwind label %unwind
@@ -558,7 +558,7 @@ unwind:
 define i1 @issue63316(i64 %arg) {
 ; CHECK-LABEL: @issue63316(
 ; CHECK-NEXT:    [[SITOFP:%.*]] = sitofp i64 [[ARG:%.*]] to float
-; CHECK-NEXT:    [[FMUL:%.*]] = fmul float [[SITOFP]], 0x7FF0000000000000
+; CHECK-NEXT:    [[FMUL:%.*]] = fmul float [[SITOFP]], pinf
 ; CHECK-NEXT:    [[FCMP:%.*]] = fcmp uno float [[FMUL]], 0.000000e+00
 ; CHECK-NEXT:    ret i1 [[FCMP]]
 ;
@@ -571,7 +571,7 @@ define i1 @issue63316(i64 %arg) {
 define i1 @issue63316_commute(i64 %arg) {
 ; CHECK-LABEL: @issue63316_commute(
 ; CHECK-NEXT:    [[SITOFP:%.*]] = sitofp i64 [[ARG:%.*]] to float
-; CHECK-NEXT:    [[FMUL:%.*]] = fmul float 0x7FF0000000000000, [[SITOFP]]
+; CHECK-NEXT:    [[FMUL:%.*]] = fmul float pinf, [[SITOFP]]
 ; CHECK-NEXT:    [[FCMP:%.*]] = fcmp uno float [[FMUL]], 0.000000e+00
 ; CHECK-NEXT:    ret i1 [[FCMP]]
 ;
diff --git a/llvm/test/Transforms/InstSimplify/ldexp.ll b/llvm/test/Transforms/InstSimplify/ldexp.ll
index d39f6a1e49673f..e8fc3dc86b16d6 100644
--- a/llvm/test/Transforms/InstSimplify/ldexp.ll
+++ b/llvm/test/Transforms/InstSimplify/ldexp.ll
@@ -3,7 +3,7 @@
 
 define float @ldexp_f32_undef_undef() {
 ; CHECK-LABEL: @ldexp_f32_undef_undef(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %call = call float @llvm.ldexp.f32.i32(float undef, i32 undef)
   ret float %call
@@ -78,7 +78,7 @@ define void @ldexp_f32_val0(i32 %y) {
 ; CHECK-LABEL: @ldexp_f32_val0(
 ; CHECK-NEXT:    store volatile float 0.000000e+00, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float -0.000000e+00, ptr addrspace(1) undef, align 4
-; CHECK-NEXT:    store volatile float 0x7FF8000000000000, ptr addrspace(1) undef, align 4
+; CHECK-NEXT:    store volatile float nan, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    ret void
 ;
   %zero = call float @llvm.ldexp.f32.i32(float 0.0, i32 %y)
@@ -94,10 +94,10 @@ define void @ldexp_f32_val0(i32 %y) {
 
 define void @ldexp_f32_val_infinity(i32 %y) {
 ; CHECK-LABEL: @ldexp_f32_val_infinity(
-; CHECK-NEXT:    store volatile float 0x7FF0000000000000, ptr addrspace(1) undef, align 4
-; CHECK-NEXT:    store volatile float 0xFFF0000000000000, ptr addrspace(1) undef, align 4
-; CHECK-NEXT:    store volatile float 0x7FF0000000000000, ptr addrspace(1) undef, align 4
-; CHECK-NEXT:    store volatile float 0xFFF0000000000000, ptr addrspace(1) undef, align 4
+; CHECK-NEXT:    store volatile float pinf, ptr addrspace(1) undef, align 4
+; CHECK-NEXT:    store volatile float ninf, ptr addrspace(1) undef, align 4
+; CHECK-NEXT:    store volatile float pinf, ptr addrspace(1) undef, align 4
+; CHECK-NEXT:    store volatile float ninf, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    ret void
 ;
   %inf = call float @llvm.ldexp.f32.i32(float 0x7ff0000000000000, i32 %y)
@@ -150,7 +150,7 @@ define void @ldexp_f32_val_nan_strictfp_maytrap(i32 %y) #0 {
 ; CHECK-NEXT:    store volatile float [[PLUS_SNAN]], ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    [[NEG_SNAN:%.*]] = call float @llvm.experimental.constrained.ldexp.f32.i32(float 0xFFF7FFFFE0000000, i32 [[Y]], metadata !"round.dynamic", metadata !"fpexcept.maytrap") #[[ATTR0]]
 ; CHECK-NEXT:    store volatile float [[NEG_SNAN]], ptr addrspace(1) undef, align 4
-; CHECK-NEXT:    store volatile float 0x7FF8000000000000, ptr addrspace(1) undef, align 4
+; CHECK-NEXT:    store volatile float nan, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    ret void
 ;
   %plus.qnan = call float @llvm.experimental.constrained.ldexp.f32.i32(float 0x7ff0001000000000, i32 %y, metadata !"round.dynamic", metadata !"fpexcept.maytrap") #0
@@ -183,7 +183,7 @@ define void @ldexp_f32_val_nan_strictfp_strict(i32 %y) #0 {
 ; CHECK-NEXT:    [[NEG_SNAN:%.*]] = call float @llvm.experimental.constrained.ldexp.f32.i32(float 0xFFF7FFFFE0000000, i32 [[Y]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR0]]
 ; CHECK-NEXT:    store volatile float [[NEG_SNAN]], ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    [[UNDEF:%.*]] = call float @llvm.experimental.constrained.ldexp.f32.i32(float undef, i32 [[Y]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR0]]
-; CHECK-NEXT:    store volatile float 0x7FF8000000000000, ptr addrspace(1) undef, align 4
+; CHECK-NEXT:    store volatile float nan, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    ret void
 ;
   %plus.qnan = call float @llvm.experimental.constrained.ldexp.f32.i32(float 0x7ff0001000000000, i32 %y, metadata !"round.dynamic", metadata !"fpexcept.strict") #0
@@ -244,7 +244,7 @@ define void @ldexp_f32_undef_strictfp(float %x, i32 %y) #0 {
 ; CHECK-NEXT:    [[UNDEF_EXP:%.*]] = call float @llvm.experimental.constrained.ldexp.f32.i32(float [[X:%.*]], i32 undef, metadata !"round.dynamic", metadata !"fpexcept.maytrap") #[[ATTR0]]
 ; CHECK-NEXT:    store volatile float [[UNDEF_EXP]], ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float [[X]], ptr addrspace(1) undef, align 4
-; CHECK-NEXT:    store volatile float 0x7FF8000000000000, ptr addrspace(1) undef, align 4
+; CHECK-NEXT:    store volatile float nan, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float poison, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float poison, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float undef, ptr addrspace(1) undef, align 4
@@ -314,7 +314,7 @@ define void @ldexp_f32() {
 ; CHECK-NEXT:    store volatile float 0x3810000000000000, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float 0x3800000000000000, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float 0x47E0000000000000, ptr addrspace(1) undef, align 4
-; CHECK-NEXT:    store volatile float 0x7FF0000000000000, ptr addrspace(1) undef, align 4
+; CHECK-NEXT:    store volatile float pinf, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float -2.000000e+00, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float -4.000000e+00, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float -8.000000e+00, ptr addrspace(1) undef, align 4
@@ -322,7 +322,7 @@ define void @ldexp_f32() {
 ; CHECK-NEXT:    store volatile float 0xB810000000000000, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float 0xB800000000000000, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float 0xC7E0000000000000, ptr addrspace(1) undef, align 4
-; CHECK-NEXT:    store volatile float 0xFFF0000000000000, ptr addrspace(1) undef, align 4
+; CHECK-NEXT:    store volatile float ninf, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    store volatile float 0x44D5000000000000, ptr addrspace(1) undef, align 4
 ; CHECK-NEXT:    ret void
 ;
@@ -421,7 +421,7 @@ define void @ldexp_f16() {
 ; CHECK-LABEL: @ldexp_f16(
 ; CHECK-NEXT:    store volatile half 0xH4000, ptr addrspace(1) undef, align 2
 ; CHECK-NEXT:    store volatile half 0xH4400, ptr addrspace(1) undef, align 2
-; CHECK-NEXT:    store volatile half 0xH7C00, ptr addrspace(1) undef, align 2
+; CHECK-NEXT:    store volatile half pinf, ptr addrspace(1) undef, align 2
 ; CHECK-NEXT:    ret void
 ;
   %one.one = call half @llvm.ldexp.f16.i32(half 1.0, i32 1)
@@ -438,7 +438,7 @@ define void @ldexp_f16() {
 
 define void @ldexp_ppcf128() {
 ; CHECK-LABEL: @ldexp_ppcf128(
-; CHECK-NEXT:    store volatile ppc_fp128 0xMFFF00000000000000000000000000000, ptr addrspace(1) undef, align 16
+; CHECK-NEXT:    store volatile ppc_fp128 ninf, ptr addrspace(1) undef, align 16
 ; CHECK-NEXT:    store volatile ppc_fp128 0xMFFFC0000000000000000000000000000, ptr addrspace(1) undef, align 16
 ; CHECK-NEXT:    store volatile ppc_fp128 0xM3FD00000000000000000000000000000, ptr addrspace(1) undef, align 16
 ; CHECK-NEXT:    store volatile ppc_fp128 0xM41700000000000000000000000000000, ptr addrspace(1) undef, align 16
diff --git a/llvm/test/Transforms/InstSimplify/strictfp-fadd.ll b/llvm/test/Transforms/InstSimplify/strictfp-fadd.ll
index 98422706f653bf..f27f897b8b5bc1 100644
--- a/llvm/test/Transforms/InstSimplify/strictfp-fadd.ll
+++ b/llvm/test/Transforms/InstSimplify/strictfp-fadd.ll
@@ -355,7 +355,7 @@ define <2 x float> @fold_fadd_vec_nsz_0_x_ebmaytrap(<2 x float> %a) #0 {
 
 define float @fold_fadd_qnan_qnan_ebmaytrap() #0 {
 ; CHECK-LABEL: @fold_fadd_qnan_qnan_ebmaytrap(
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    ret float nan
 ;
   %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff8000000000000, float 0x7ff8000000000000, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
   ret float %add
@@ -363,8 +363,8 @@ define float @fold_fadd_qnan_qnan_ebmaytrap() #0 {
 
 define float @fold_fadd_qnan_qnan_ebstrict() #0 {
 ; CHECK-LABEL: @fold_fadd_qnan_qnan_ebstrict(
-; CHECK-NEXT:    [[ADD:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF8000000000000, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
-; CHECK-NEXT:    ret float 0x7FF8000000000000
+; CHECK-NEXT:    [[ADD:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float nan, float nan, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
+; CHECK-NEXT:    ret float nan
 ;
   %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff8000000000000, float 0x7ff8000000000000, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
   ret float %add
@@ -449,7 +449,7 @@ define float @fold_fadd_snan_qnan_ebmaytrap() #0 {
 
 define float @fold_fadd_snan_qnan_ebstrict() #0 {
 ; CHECK-LABEL: @fold_fadd_snan_qnan_ebstrict(
-; CHECK-NEXT:    [[ADD:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF4000000000000, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
+; CHECK-NEXT:    [[ADD:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF4000000000000, float nan, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
 ; CHECK-NEXT:    ret float [[ADD]]
 ;
   %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff4000000000000, float 0x7ff8000000000000, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/scalable-reduction-inloop-cond.ll b/llvm/test/Transforms/LoopVectorize/AArch64/scalable-reduction-inloop-cond.ll
index 23160c13b821d5..82520fec8c2c78 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/scalable-reduction-inloop-cond.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/scalable-reduction-inloop-cond.ll
@@ -115,7 +115,7 @@ define float @cond_cmp_sel(ptr noalias %a, ptr noalias %cond, i64 %N) {
 ; CHECK-NEXT:    [[TMP10:%.*]] = getelementptr float, ptr [[A:%.*]], i64 [[TMP6]]
 ; CHECK-NEXT:    [[TMP11:%.*]] = getelementptr float, ptr [[TMP10]], i32 0
 ; CHECK-NEXT:    [[WIDE_MASKED_LOAD:%.*]] = call <vscale x 4 x float> @llvm.masked.load.nxv4f32.p0(ptr [[TMP11]], i32 4, <vscale x 4 x i1> [[TMP9]], <vscale x 4 x float> poison)
-; CHECK-NEXT:    [[TMP12:%.*]] = select fast <vscale x 4 x i1> [[TMP9]], <vscale x 4 x float> [[WIDE_MASKED_LOAD]], <vscale x 4 x float> shufflevector (<vscale x 4 x float> insertelement (<vscale x 4 x float> poison, float 0x7FF0000000000000, i64 0), <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer)
+; CHECK-NEXT:    [[TMP12:%.*]] = select fast <vscale x 4 x i1> [[TMP9]], <vscale x 4 x float> [[WIDE_MASKED_LOAD]], <vscale x 4 x float> shufflevector (<vscale x 4 x float> insertelement (<vscale x 4 x float> poison, float pinf, i64 0), <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer)
 ; CHECK-NEXT:    [[TMP13:%.*]] = call fast float @llvm.vector.reduce.fmin.nxv4f32(<vscale x 4 x float> [[TMP12]])
 ; CHECK-NEXT:    [[RDX_MINMAX_CMP:%.*]] = fcmp fast olt float [[TMP13]], [[VEC_PHI]]
 ; CHECK-NEXT:    [[RDX_MINMAX_SELECT]] = select fast i1 [[RDX_MINMAX_CMP]], float [[TMP13]], float [[VEC_PHI]]
diff --git a/llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-inloop-reduction.ll b/llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-inloop-reduction.ll
index 73dc3e4313a651..84c84f5be8ea20 100644
--- a/llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-inloop-reduction.ll
+++ b/llvm/test/Transforms/LoopVectorize/RISCV/vectorize-force-tail-with-evl-inloop-reduction.ll
@@ -1270,7 +1270,7 @@ define float @fmin(ptr %a, i64 %n, float %start) #0 {
 ; IF-EVL-NEXT:    [[TMP12:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 [[TMP11]]
 ; IF-EVL-NEXT:    [[TMP13:%.*]] = getelementptr inbounds float, ptr [[TMP12]], i32 0
 ; IF-EVL-NEXT:    [[VP_OP_LOAD:%.*]] = call <vscale x 4 x float> @llvm.vp.load.nxv4f32.p0(ptr align 4 [[TMP13]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP10]])
-; IF-EVL-NEXT:    [[TMP14:%.*]] = call fast float @llvm.vp.reduce.fmin.nxv4f32(float 0x7FF0000000000000, <vscale x 4 x float> [[VP_OP_LOAD]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP10]])
+; IF-EVL-NEXT:    [[TMP14:%.*]] = call fast float @llvm.vp.reduce.fmin.nxv4f32(float pinf, <vscale x 4 x float> [[VP_OP_LOAD]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP10]])
 ; IF-EVL-NEXT:    [[RDX_MINMAX_CMP:%.*]] = fcmp fast olt float [[TMP14]], [[VEC_PHI]]
 ; IF-EVL-NEXT:    [[RDX_MINMAX_SELECT]] = select fast i1 [[RDX_MINMAX_CMP]], float [[TMP14]], float [[VEC_PHI]]
 ; IF-EVL-NEXT:    [[TMP15:%.*]] = zext i32 [[TMP10]] to i64
@@ -1392,7 +1392,7 @@ define float @fmax(ptr %a, i64 %n, float %start) #0 {
 ; IF-EVL-NEXT:    [[TMP12:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 [[TMP11]]
 ; IF-EVL-NEXT:    [[TMP13:%.*]] = getelementptr inbounds float, ptr [[TMP12]], i32 0
 ; IF-EVL-NEXT:    [[VP_OP_LOAD:%.*]] = call <vscale x 4 x float> @llvm.vp.load.nxv4f32.p0(ptr align 4 [[TMP13]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP10]])
-; IF-EVL-NEXT:    [[TMP14:%.*]] = call fast float @llvm.vp.reduce.fmax.nxv4f32(float 0xFFF0000000000000, <vscale x 4 x float> [[VP_OP_LOAD]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP10]])
+; IF-EVL-NEXT:    [[TMP14:%.*]] = call fast float @llvm.vp.reduce.fmax.nxv4f32(float ninf, <vscale x 4 x float> [[VP_OP_LOAD]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP10]])
 ; IF-EVL-NEXT:    [[RDX_MINMAX_CMP:%.*]] = fcmp fast ogt float [[TMP14]], [[VEC_PHI]]
 ; IF-EVL-NEXT:    [[RDX_MINMAX_SELECT]] = select fast i1 [[RDX_MINMAX_CMP]], float [[TMP14]], float [[VEC_PHI]]
 ; IF-EVL-NEXT:    [[TMP15:%.*]] = zext i32 [[TMP10]] to i64
diff --git a/llvm/test/Transforms/LoopVectorize/reduction-inloop-cond.ll b/llvm/test/Transforms/LoopVectorize/reduction-inloop-cond.ll
index 873f6364f82811..654ae46766d484 100644
--- a/llvm/test/Transforms/LoopVectorize/reduction-inloop-cond.ll
+++ b/llvm/test/Transforms/LoopVectorize/reduction-inloop-cond.ll
@@ -169,7 +169,7 @@ define float @cond_cmp_sel(ptr noalias %a, ptr noalias %cond, i64 %N) {
 ; CHECK-NEXT:    br label [[PRED_LOAD_CONTINUE6]]
 ; CHECK:       pred.load.continue6:
 ; CHECK-NEXT:    [[TMP24:%.*]] = phi <4 x float> [ [[TMP18]], [[PRED_LOAD_CONTINUE4]] ], [ [[TMP23]], [[PRED_LOAD_IF5]] ]
-; CHECK-NEXT:    [[TMP25:%.*]] = select fast <4 x i1> [[TMP1]], <4 x float> [[TMP24]], <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000>
+; CHECK-NEXT:    [[TMP25:%.*]] = select fast <4 x i1> [[TMP1]], <4 x float> [[TMP24]], <4 x float> <float pinf, float pinf, float pinf, float pinf>
 ; CHECK-NEXT:    [[TMP26:%.*]] = call fast float @llvm.vector.reduce.fmin.v4f32(<4 x float> [[TMP25]])
 ; CHECK-NEXT:    [[RDX_MINMAX_SELECT]] = call fast float @llvm.minnum.f32(float [[TMP26]], float [[VEC_PHI]])
 ; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
diff --git a/llvm/test/Transforms/LoopVectorize/select-cmp-multiuse.ll b/llvm/test/Transforms/LoopVectorize/select-cmp-multiuse.ll
index 9eb90099214e1c..7145623c08d8fb 100644
--- a/llvm/test/Transforms/LoopVectorize/select-cmp-multiuse.ll
+++ b/llvm/test/Transforms/LoopVectorize/select-cmp-multiuse.ll
@@ -1138,7 +1138,7 @@ define i32 @multi_user_cmp_fmax(ptr readonly %a, i64 noundef %n) {
 ; CHECK-VF4-IC1-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ]
 ; CHECK-VF4-IC1-NEXT:    [[ALL_0_OFF010:%.*]] = phi i1 [ true, [[ENTRY]] ], [ [[ALL_0_OFF0_:%.*]], [[FOR_BODY]] ]
 ; CHECK-VF4-IC1-NEXT:    [[ANY_0_OFF09:%.*]] = phi i1 [ false, [[ENTRY]] ], [ [[DOTANY_0_OFF0:%.*]], [[FOR_BODY]] ]
-; CHECK-VF4-IC1-NEXT:    [[MAX_015:%.*]] = phi float [ 0xFFF0000000000000, [[ENTRY]] ], [ [[DOTMAX_0:%.*]], [[FOR_BODY]] ]
+; CHECK-VF4-IC1-NEXT:    [[MAX_015:%.*]] = phi float [ ninf, [[ENTRY]] ], [ [[DOTMAX_0:%.*]], [[FOR_BODY]] ]
 ; CHECK-VF4-IC1-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[INDVARS_IV]]
 ; CHECK-VF4-IC1-NEXT:    [[LOAD1:%.*]] = load float, ptr [[ARRAYIDX]], align 4
 ; CHECK-VF4-IC1-NEXT:    [[CMP1:%.*]] = fcmp ogt float [[LOAD1]], [[MAX_015]]
@@ -1163,7 +1163,7 @@ define i32 @multi_user_cmp_fmax(ptr readonly %a, i64 noundef %n) {
 ; CHECK-VF4-IC2-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ]
 ; CHECK-VF4-IC2-NEXT:    [[ALL_0_OFF010:%.*]] = phi i1 [ true, [[ENTRY]] ], [ [[ALL_0_OFF0_:%.*]], [[FOR_BODY]] ]
 ; CHECK-VF4-IC2-NEXT:    [[ANY_0_OFF09:%.*]] = phi i1 [ false, [[ENTRY]] ], [ [[DOTANY_0_OFF0:%.*]], [[FOR_BODY]] ]
-; CHECK-VF4-IC2-NEXT:    [[MAX_015:%.*]] = phi float [ 0xFFF0000000000000, [[ENTRY]] ], [ [[DOTMAX_0:%.*]], [[FOR_BODY]] ]
+; CHECK-VF4-IC2-NEXT:    [[MAX_015:%.*]] = phi float [ ninf, [[ENTRY]] ], [ [[DOTMAX_0:%.*]], [[FOR_BODY]] ]
 ; CHECK-VF4-IC2-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[INDVARS_IV]]
 ; CHECK-VF4-IC2-NEXT:    [[LOAD1:%.*]] = load float, ptr [[ARRAYIDX]], align 4
 ; CHECK-VF4-IC2-NEXT:    [[CMP1:%.*]] = fcmp ogt float [[LOAD1]], [[MAX_015]]
@@ -1188,7 +1188,7 @@ define i32 @multi_user_cmp_fmax(ptr readonly %a, i64 noundef %n) {
 ; CHECK-VF1-IC2-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ]
 ; CHECK-VF1-IC2-NEXT:    [[ALL_0_OFF010:%.*]] = phi i1 [ true, [[ENTRY]] ], [ [[ALL_0_OFF0_:%.*]], [[FOR_BODY]] ]
 ; CHECK-VF1-IC2-NEXT:    [[ANY_0_OFF09:%.*]] = phi i1 [ false, [[ENTRY]] ], [ [[DOTANY_0_OFF0:%.*]], [[FOR_BODY]] ]
-; CHECK-VF1-IC2-NEXT:    [[MAX_015:%.*]] = phi float [ 0xFFF0000000000000, [[ENTRY]] ], [ [[DOTMAX_0:%.*]], [[FOR_BODY]] ]
+; CHECK-VF1-IC2-NEXT:    [[MAX_015:%.*]] = phi float [ ninf, [[ENTRY]] ], [ [[DOTMAX_0:%.*]], [[FOR_BODY]] ]
 ; CHECK-VF1-IC2-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[INDVARS_IV]]
 ; CHECK-VF1-IC2-NEXT:    [[LOAD1:%.*]] = load float, ptr [[ARRAYIDX]], align 4
 ; CHECK-VF1-IC2-NEXT:    [[CMP1:%.*]] = fcmp ogt float [[LOAD1]], [[MAX_015]]
diff --git a/llvm/test/Transforms/PreISelIntrinsicLowering/expand-vp.ll b/llvm/test/Transforms/PreISelIntrinsicLowering/expand-vp.ll
index 92b36054356b20..6a37fe17f0a690 100644
--- a/llvm/test/Transforms/PreISelIntrinsicLowering/expand-vp.ll
+++ b/llvm/test/Transforms/PreISelIntrinsicLowering/expand-vp.ll
@@ -244,10 +244,10 @@ define void @test_vp_cmp_v8(<8 x i32> %i0, <8 x i32> %i1, <8 x float> %f0, <8 x
 ; ALL-CONVERT-NEXT:  [[NSPLAT:%.+]] = shufflevector <4 x i32> [[NINS]], <4 x i32> poison, <4 x i32> zeroinitializer
 ; ALL-CONVERT-NEXT:  [[EVLM:%.+]] = icmp ult <4 x i32> <i32 0, i32 1, i32 2, i32 3>, [[NSPLAT]]
 ; ALL-CONVERT-NEXT:  [[NEWM:%.+]] = and <4 x i1> [[EVLM]], %m
-; ALL-CONVERT-NEXT:  [[FMIN:%.+]] = select <4 x i1> [[NEWM]], <4 x float> %vf, <4 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000>
+; ALL-CONVERT-NEXT:  [[FMIN:%.+]] = select <4 x i1> [[NEWM]], <4 x float> %vf, <4 x float> <float nan, float nan, float nan, float nan>
 ; ALL-CONVERT-NEXT:  [[RED:%.+]] = call float @llvm.vector.reduce.fmin.v4f32(<4 x float> [[FMIN]])
 ; ALL-CONVERT-NEXT:  %{{.+}} = call float @llvm.minnum.f32(float [[RED]], float %f)
-; ALL-CONVERT:       [[FMIN_NNAN:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000>
+; ALL-CONVERT:       [[FMIN_NNAN:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float pinf, float pinf, float pinf, float pinf>
 ; ALL-CONVERT-NEXT:  [[RED:%.+]] = call nnan float @llvm.vector.reduce.fmin.v4f32(<4 x float> [[FMIN_NNAN]])
 ; ALL-CONVERT-NEXT:  %{{.+}} = call nnan float @llvm.minnum.f32(float [[RED]], float %f)
 ; ALL-CONVERT:       [[FMIN_NNAN_NINF:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float 0x47EFFFFFE0000000, float 0x47EFFFFFE0000000, float 0x47EFFFFFE0000000, float 0x47EFFFFFE0000000>
@@ -256,27 +256,27 @@ define void @test_vp_cmp_v8(<8 x i32> %i0, <8 x i32> %i1, <8 x float> %f0, <8 x
 ; ALL-CONVERT:  [[FMAX:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float 0xFFF8000000000000, float 0xFFF8000000000000, float 0xFFF8000000000000, float 0xFFF8000000000000>
 ; ALL-CONVERT-NEXT:  [[RED:%.+]] = call float @llvm.vector.reduce.fmax.v4f32(<4 x float> [[FMAX]])
 ; ALL-CONVERT-NEXT:  %{{.+}} = call float @llvm.maxnum.f32(float [[RED]], float %f)
-; ALL-CONVERT:  [[FMAX_NNAN:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float 0xFFF0000000000000, float 0xFFF0000000000000, float 0xFFF0000000000000, float 0xFFF0000000000000>
+; ALL-CONVERT:  [[FMAX_NNAN:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float ninf, float ninf, float ninf, float ninf>
 ; ALL-CONVERT-NEXT:  [[RED:%.+]] = call nnan float @llvm.vector.reduce.fmax.v4f32(<4 x float> [[FMAX_NNAN]])
 ; ALL-CONVERT-NEXT:  %{{.+}} = call nnan float @llvm.maxnum.f32(float [[RED]], float %f)
 ; ALL-CONVERT:  [[FMAX_NNAN_NINF:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float 0xC7EFFFFFE0000000, float 0xC7EFFFFFE0000000, float 0xC7EFFFFFE0000000, float 0xC7EFFFFFE0000000>
 ; ALL-CONVERT-NEXT:  [[RED:%.+]] = call nnan ninf float @llvm.vector.reduce.fmax.v4f32(<4 x float> [[FMAX_NNAN_NINF]])
 ; ALL-CONVERT-NEXT:  %{{.+}} = call nnan ninf float @llvm.maxnum.f32(float [[RED]], float %f)
 
-; ALL-CONVERT:       [[FMINIMUM:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000>
+; ALL-CONVERT:       [[FMINIMUM:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float pinf, float pinf, float pinf, float pinf>
 ; ALL-CONVERT-NEXT:  [[RED:%.+]] = call float @llvm.vector.reduce.fminimum.v4f32(<4 x float> [[FMINIMUM]])
 ; ALL-CONVERT-NEXT:  %{{.+}} = call float @llvm.minimum.f32(float [[RED]], float %f)
-; ALL-CONVERT:       [[FMINIMUM_NNAN:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000>
+; ALL-CONVERT:       [[FMINIMUM_NNAN:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float pinf, float pinf, float pinf, float pinf>
 ; ALL-CONVERT-NEXT:  [[RED:%.+]] = call nnan float @llvm.vector.reduce.fminimum.v4f32(<4 x float> [[FMINIMUM_NNAN]])
 ; ALL-CONVERT-NEXT:  %{{.+}} = call nnan float @llvm.minimum.f32(float [[RED]], float %f)
 ; ALL-CONVERT:       [[FMINIMUM_NNAN_NINF:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float 0x47EFFFFFE0000000, float 0x47EFFFFFE0000000, float 0x47EFFFFFE0000000, float 0x47EFFFFFE0000000>
 ; ALL-CONVERT-NEXT:  [[RED:%.+]] = call nnan ninf float @llvm.vector.reduce.fminimum.v4f32(<4 x float> [[FMINIMUM_NNAN_NINF]])
 ; ALL-CONVERT-NEXT:  %{{.+}} = call nnan ninf float @llvm.minimum.f32(float [[RED]], float %f)
 
-; ALL-CONVERT:  [[FMAXIMUM:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float 0xFFF0000000000000, float 0xFFF0000000000000, float 0xFFF0000000000000, float 0xFFF0000000000000>
+; ALL-CONVERT:  [[FMAXIMUM:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float ninf, float ninf, float ninf, float ninf>
 ; ALL-CONVERT-NEXT:  [[RED:%.+]] = call float @llvm.vector.reduce.fmaximum.v4f32(<4 x float> [[FMAXIMUM]])
 ; ALL-CONVERT-NEXT:  %{{.+}} = call float @llvm.maximum.f32(float [[RED]], float %f)
-; ALL-CONVERT:  [[FMAXIMUM_NNAN:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float 0xFFF0000000000000, float 0xFFF0000000000000, float 0xFFF0000000000000, float 0xFFF0000000000000>
+; ALL-CONVERT:  [[FMAXIMUM_NNAN:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float ninf, float ninf, float ninf, float ninf>
 ; ALL-CONVERT-NEXT:  [[RED:%.+]] = call nnan float @llvm.vector.reduce.fmaximum.v4f32(<4 x float> [[FMAXIMUM_NNAN]])
 ; ALL-CONVERT-NEXT:  %{{.+}} = call nnan float @llvm.maximum.f32(float [[RED]], float %f)
 ; ALL-CONVERT:  [[FMAXIMUM_NNAN_NINF:%.+]] = select <4 x i1> %{{.+}}, <4 x float> %vf, <4 x float> <float 0xC7EFFFFFE0000000, float 0xC7EFFFFFE0000000, float 0xC7EFFFFFE0000000, float 0xC7EFFFFFE0000000>
diff --git a/llvm/test/Transforms/Reassociate/pr42349.ll b/llvm/test/Transforms/Reassociate/pr42349.ll
index 3bed0598a377c5..08026dbd5c4dee 100644
--- a/llvm/test/Transforms/Reassociate/pr42349.ll
+++ b/llvm/test/Transforms/Reassociate/pr42349.ll
@@ -5,7 +5,7 @@ define  float @wibble(float %tmp6) #0 {
 ; CHECK-LABEL: @wibble(
 ; CHECK-NEXT:  bb:
 ; CHECK-NEXT:    [[TMP7:%.*]] = fmul float [[TMP6:%.*]], -1.000000e+00
-; CHECK-NEXT:    [[TMP9:%.*]] = fmul fast float [[TMP6]], 0xFFF0000000000000
+; CHECK-NEXT:    [[TMP9:%.*]] = fmul fast float [[TMP6]], ninf
 ; CHECK-NEXT:    ret float [[TMP9]]
 ;
 bb:
diff --git a/llvm/test/Transforms/SCCP/float-nan-simplification.ll b/llvm/test/Transforms/SCCP/float-nan-simplification.ll
index 5a97518b8d137f..ed64f9584a6a8f 100644
--- a/llvm/test/Transforms/SCCP/float-nan-simplification.ll
+++ b/llvm/test/Transforms/SCCP/float-nan-simplification.ll
@@ -15,7 +15,7 @@ define float @test1(float %a, i1 %bc) {
 ; CHECK:       bb2:
 ; CHECK-NEXT:    br label [[EXIT]]
 ; CHECK:       exit:
-; CHECK-NEXT:    [[P:%.*]] = phi float [ [[A:%.*]], [[BB1]] ], [ 0x7FF8000000000000, [[BB2]] ]
+; CHECK-NEXT:    [[P:%.*]] = phi float [ [[A:%.*]], [[BB1]] ], [ nan, [[BB2]] ]
 ; CHECK-NEXT:    [[V_1:%.*]] = fmul float [[P]], 0.000000e+00
 ; CHECK-NEXT:    [[V_2:%.*]] = fadd float [[V_1]], 0xFFF8000000000000
 ; CHECK-NEXT:    ret float [[V_2]]
@@ -46,7 +46,7 @@ define float @test2(float %a, i1 %bc) {
 ; CHECK:       bb2:
 ; CHECK-NEXT:    br label [[EXIT]]
 ; CHECK:       exit:
-; CHECK-NEXT:    [[P:%.*]] = phi float [ 0x7FF8000000000000, [[BB1]] ], [ [[A:%.*]], [[BB2]] ]
+; CHECK-NEXT:    [[P:%.*]] = phi float [ nan, [[BB1]] ], [ [[A:%.*]], [[BB2]] ]
 ; CHECK-NEXT:    [[V_1:%.*]] = fmul float [[P]], 0.000000e+00
 ; CHECK-NEXT:    ret float 0xFFF8000000000000
 ;
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/buildvector-shuffle.ll b/llvm/test/Transforms/SLPVectorizer/X86/buildvector-shuffle.ll
index f8522bc546e6b0..b91d9eff98e77f 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/buildvector-shuffle.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/buildvector-shuffle.ll
@@ -4,9 +4,9 @@
 define void @b() {
 ; CHECK-LABEL: @b(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <4 x float> poison, float 0x7FF8000000000000, i32 0
+; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <4 x float> poison, float nan, i32 0
 ; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <4 x float> [[TMP0]], <4 x float> <float 0xFFF8000000000000, float 0xFFF8000000000000, float undef, float undef>, <4 x i32> <i32 0, i32 4, i32 5, i32 poison>
-; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <4 x float> [[TMP1]], float 0x7FF8000000000000, i32 3
+; CHECK-NEXT:    [[TMP2:%.*]] = insertelement <4 x float> [[TMP1]], float nan, i32 3
 ; CHECK-NEXT:    [[TMP3:%.*]] = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> [[TMP2]], <4 x float> zeroinitializer, <4 x float> zeroinitializer)
 ; CHECK-NEXT:    [[TMP4:%.*]] = fmul <4 x float> [[TMP3]], <float undef, float undef, float undef, float 2.000000e+00>
 ; CHECK-NEXT:    [[TMP5:%.*]] = fdiv <4 x float> [[TMP4]], zeroinitializer
@@ -46,11 +46,11 @@ define void @test(float %a) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <2 x float> poison, float [[A:%.*]], i32 0
-; CHECK-NEXT:    [[SHUFFLE:%.*]] = shufflevector <2 x float> [[TMP0]], <2 x float> poison, <2 x i32> zeroinitializer
+; CHECK-NEXT:    [[TMP1:%.*]] = shufflevector <2 x float> [[TMP0]], <2 x float> poison, <2 x i32> zeroinitializer
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
 ; CHECK:       loop:
-; CHECK-NEXT:    [[TMP1:%.*]] = fadd <2 x float> zeroinitializer, [[SHUFFLE]]
-; CHECK-NEXT:    [[TMP2:%.*]] = shufflevector <2 x float> [[TMP1]], <2 x float> poison, <2 x i32> zeroinitializer
+; CHECK-NEXT:    [[TMP2:%.*]] = fadd <2 x float> zeroinitializer, [[TMP1]]
+; CHECK-NEXT:    [[TMP3:%.*]] = shufflevector <2 x float> [[TMP2]], <2 x float> poison, <2 x i32> zeroinitializer
 ; CHECK-NEXT:    br label [[LOOP]]
 ;
 entry:
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/catchswitch.ll b/llvm/test/Transforms/SLPVectorizer/X86/catchswitch.ll
index f8a7a9503ca52f..a29286c07b57ac 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/catchswitch.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/catchswitch.ll
@@ -18,26 +18,26 @@ define void @important_func() personality ptr @__CxxFrameHandler3 {
 ; CHECK-NEXT:    br label [[LABELB:%.*]]
 ; CHECK:       labelB:
 ; CHECK-NEXT:    invoke void @funcA()
-; CHECK-NEXT:    to label [[LABELC:%.*]] unwind label [[LABELD:%.*]]
+; CHECK-NEXT:            to label [[LABELC:%.*]] unwind label [[LABELD:%.*]]
 ; CHECK:       labelC:
 ; CHECK-NEXT:    invoke void @funcA()
-; CHECK-NEXT:    to label [[LABELE:%.*]] unwind label [[LABELF:%.*]]
+; CHECK-NEXT:            to label [[LABELE:%.*]] unwind label [[LABELF:%.*]]
 ; CHECK:       labelD:
 ; CHECK-NEXT:    [[TMP0:%.*]] = cleanuppad within none []
 ; CHECK-NEXT:    unreachable
 ; CHECK:       labelE:
-; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0xFFF0000000000000>, i64 1
-; CHECK-NEXT:    [[F:%.*]] = extractelement <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0xFFF0000000000000>, i64 2
+; CHECK-NEXT:    [[TMP1:%.*]] = extractelement <4 x float> <float pinf, float pinf, float pinf, float ninf>, i64 1
+; CHECK-NEXT:    [[F:%.*]] = extractelement <4 x float> <float pinf, float pinf, float pinf, float ninf>, i64 2
 ; CHECK-NEXT:    invoke void @funcA()
-; CHECK-NEXT:    to label [[LABELG:%.*]] unwind label [[CATCH_DISPATCH:%.*]]
+; CHECK-NEXT:            to label [[LABELG:%.*]] unwind label [[CATCH_DISPATCH:%.*]]
 ; CHECK:       labelF:
 ; CHECK-NEXT:    [[TMP2:%.*]] = cleanuppad within none []
 ; CHECK-NEXT:    cleanupret from [[TMP2]] unwind to caller
 ; CHECK:       labelG:
-; CHECK-NEXT:    [[G:%.*]] = extractelement <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0xFFF0000000000000>, i64 0
-; CHECK-NEXT:    [[H:%.*]] = extractelement <4 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000, float 0x7FF0000000000000, float 0xFFF0000000000000>, i64 3
+; CHECK-NEXT:    [[G:%.*]] = extractelement <4 x float> <float pinf, float pinf, float pinf, float ninf>, i64 0
+; CHECK-NEXT:    [[H:%.*]] = extractelement <4 x float> <float pinf, float pinf, float pinf, float ninf>, i64 3
 ; CHECK-NEXT:    invoke void @funcA()
-; CHECK-NEXT:    to label [[LABELH:%.*]] unwind label [[CATCH_DISPATCH]]
+; CHECK-NEXT:            to label [[LABELH:%.*]] unwind label [[CATCH_DISPATCH]]
 ; CHECK:       labelH:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       catch.dispatch:
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/fabs-cost-softfp.ll b/llvm/test/Transforms/SLPVectorizer/X86/fabs-cost-softfp.ll
index 12deea6a262ce4..d64dd92fabdec8 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/fabs-cost-softfp.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/fabs-cost-softfp.ll
@@ -14,7 +14,7 @@ define void @vectorize_fp128(fp128 %c, fp128 %d) #0 {
 ; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <2 x fp128> poison, fp128 [[C:%.*]], i32 0
 ; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <2 x fp128> [[TMP0]], fp128 [[D:%.*]], i32 1
 ; CHECK-NEXT:    [[TMP2:%.*]] = call <2 x fp128> @llvm.fabs.v2f128(<2 x fp128> [[TMP1]])
-; CHECK-NEXT:    [[TMP3:%.*]] = fcmp oeq <2 x fp128> [[TMP2]], <fp128 0xL00000000000000007FFF000000000000, fp128 0xL00000000000000007FFF000000000000>
+; CHECK-NEXT:    [[TMP3:%.*]] = fcmp oeq <2 x fp128> [[TMP2]], <fp128 pinf, fp128 pinf>
 ; CHECK-NEXT:    [[TMP4:%.*]] = extractelement <2 x i1> [[TMP3]], i32 0
 ; CHECK-NEXT:    [[TMP5:%.*]] = extractelement <2 x i1> [[TMP3]], i32 1
 ; CHECK-NEXT:    [[OR_COND39:%.*]] = or i1 [[TMP4]], [[TMP5]]
diff --git a/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll b/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
index bd63e6658c9a61..f323ff864541fa 100644
--- a/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
+++ b/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
@@ -1128,7 +1128,7 @@ define i32 @test_builtin_fpclassify(float %x) {
 ; CHECK-NEXT:    br i1 [[CMP]], label [[FPCLASSIFY_END]], label [[FPCLASSIFY_NOT_NAN]]
 ; CHECK:       fpclassify_not_nan:
 ; CHECK-NEXT:    [[X_ABS:%.*]] = tail call float @llvm.fabs.f32(float [[X]])
-; CHECK-NEXT:    [[ISINF:%.*]] = fcmp oeq float [[X_ABS]], 0x7FF0000000000000
+; CHECK-NEXT:    [[ISINF:%.*]] = fcmp oeq float [[X_ABS]], pinf
 ; CHECK-NEXT:    br i1 [[ISINF]], label [[FPCLASSIFY_END]], label [[FPCLASSIFY_NOT_INF]]
 ; CHECK:       fpclassify_not_inf:
 ; CHECK-NEXT:    [[ISNORMAL:%.*]] = fcmp uge float [[X_ABS]], 0x3810000000000000
diff --git a/llvm/test/Transforms/SimplifyCFG/speculate-math.ll b/llvm/test/Transforms/SimplifyCFG/speculate-math.ll
index f6f50c303206b0..ac33fdfffa6b9c 100644
--- a/llvm/test/Transforms/SimplifyCFG/speculate-math.ll
+++ b/llvm/test/Transforms/SimplifyCFG/speculate-math.ll
@@ -37,7 +37,7 @@ define void @sqrt_test(ptr addrspace(1) noalias nocapture %out, float %a) nounwi
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
 ; CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.sqrt.f32(float [[A]]) #[[ATTR2:[0-9]+]]
-; CHECK-NEXT:    [[COND_I:%.*]] = select afn i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
+; CHECK-NEXT:    [[COND_I:%.*]] = select afn i1 [[CMP_I]], float nan, float [[TMP0]]
 ; CHECK-NEXT:    store float [[COND_I]], ptr addrspace(1) [[OUT:%.*]], align 4
 ; CHECK-NEXT:    ret void
 ;
@@ -60,7 +60,7 @@ define void @fabs_test(ptr addrspace(1) noalias nocapture %out, float %a) nounwi
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
 ; CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.fabs.f32(float [[A]]) #[[ATTR2]]
-; CHECK-NEXT:    [[COND_I:%.*]] = select reassoc i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
+; CHECK-NEXT:    [[COND_I:%.*]] = select reassoc i1 [[CMP_I]], float nan, float [[TMP0]]
 ; CHECK-NEXT:    store float [[COND_I]], ptr addrspace(1) [[OUT:%.*]], align 4
 ; CHECK-NEXT:    ret void
 ;
@@ -83,7 +83,7 @@ define void @fma_test(ptr addrspace(1) noalias nocapture %out, float %a, float %
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
 ; CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.fma.f32(float [[A]], float [[B:%.*]], float [[C:%.*]]) #[[ATTR2]]
-; CHECK-NEXT:    [[COND_I:%.*]] = select reassoc nsz i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
+; CHECK-NEXT:    [[COND_I:%.*]] = select reassoc nsz i1 [[CMP_I]], float nan, float [[TMP0]]
 ; CHECK-NEXT:    store float [[COND_I]], ptr addrspace(1) [[OUT:%.*]], align 4
 ; CHECK-NEXT:    ret void
 ;
@@ -106,7 +106,7 @@ define void @fmuladd_test(ptr addrspace(1) noalias nocapture %out, float %a, flo
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
 ; CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.fmuladd.f32(float [[A]], float [[B:%.*]], float [[C:%.*]]) #[[ATTR2]]
-; CHECK-NEXT:    [[COND_I:%.*]] = select ninf i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
+; CHECK-NEXT:    [[COND_I:%.*]] = select ninf i1 [[CMP_I]], float nan, float [[TMP0]]
 ; CHECK-NEXT:    store float [[COND_I]], ptr addrspace(1) [[OUT:%.*]], align 4
 ; CHECK-NEXT:    ret void
 ;
@@ -129,7 +129,7 @@ define void @minnum_test(ptr addrspace(1) noalias nocapture %out, float %a, floa
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
 ; CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.minnum.f32(float [[A]], float [[B:%.*]]) #[[ATTR2]]
-; CHECK-NEXT:    [[COND_I:%.*]] = select i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
+; CHECK-NEXT:    [[COND_I:%.*]] = select i1 [[CMP_I]], float nan, float [[TMP0]]
 ; CHECK-NEXT:    store float [[COND_I]], ptr addrspace(1) [[OUT:%.*]], align 4
 ; CHECK-NEXT:    ret void
 ;
@@ -152,7 +152,7 @@ define void @maxnum_test(ptr addrspace(1) noalias nocapture %out, float %a, floa
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
 ; CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.maxnum.f32(float [[A]], float [[B:%.*]]) #[[ATTR2]]
-; CHECK-NEXT:    [[COND_I:%.*]] = select ninf nsz i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
+; CHECK-NEXT:    [[COND_I:%.*]] = select ninf nsz i1 [[CMP_I]], float nan, float [[TMP0]]
 ; CHECK-NEXT:    store float [[COND_I]], ptr addrspace(1) [[OUT:%.*]], align 4
 ; CHECK-NEXT:    ret void
 ;
@@ -175,7 +175,7 @@ define void @minimum_test(ptr addrspace(1) noalias nocapture %out, float %a, flo
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
 ; CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.minimum.f32(float [[A]], float [[B:%.*]]) #[[ATTR2]]
-; CHECK-NEXT:    [[COND_I:%.*]] = select reassoc i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
+; CHECK-NEXT:    [[COND_I:%.*]] = select reassoc i1 [[CMP_I]], float nan, float [[TMP0]]
 ; CHECK-NEXT:    store float [[COND_I]], ptr addrspace(1) [[OUT:%.*]], align 4
 ; CHECK-NEXT:    ret void
 ;
@@ -198,7 +198,7 @@ define void @maximum_test(ptr addrspace(1) noalias nocapture %out, float %a, flo
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
 ; CHECK-NEXT:    [[TMP0:%.*]] = tail call float @llvm.maximum.f32(float [[A]], float [[B:%.*]]) #[[ATTR2]]
-; CHECK-NEXT:    [[COND_I:%.*]] = select nsz i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
+; CHECK-NEXT:    [[COND_I:%.*]] = select nsz i1 [[CMP_I]], float nan, float [[TMP0]]
 ; CHECK-NEXT:    store float [[COND_I]], ptr addrspace(1) [[OUT:%.*]], align 4
 ; CHECK-NEXT:    ret void
 ;
diff --git a/llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll b/llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll
index 4ac216f85c74c0..a2e585cf3bb5ab 100644
--- a/llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll
+++ b/llvm/test/Transforms/Util/libcalls-shrinkwrap-double.ll
@@ -138,8 +138,8 @@ entry:
 ; CHECK: [[END_LABEL]]:
 
   %call_02 = call double @cos(double %value)
-; CHECK: [[COND1:%[0-9]+]] = fcmp oeq double %value, 0xFFF0000000000000
-; CHECK: [[COND2:%[0-9]+]] = fcmp oeq double %value, 0x7FF0000000000000
+; CHECK: [[COND1:%[0-9]+]] = fcmp oeq double %value, ninf
+; CHECK: [[COND2:%[0-9]+]] = fcmp oeq double %value, pinf
 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
 ; CHECK: [[CALL_LABEL]]:
@@ -148,8 +148,8 @@ entry:
 ; CHECK: [[END_LABEL]]:
 
   %call_03 = call double @sin(double %value)
-; CHECK: [[COND1:%[0-9]+]] = fcmp oeq double %value, 0xFFF0000000000000
-; CHECK: [[COND2:%[0-9]+]] = fcmp oeq double %value, 0x7FF0000000000000
+; CHECK: [[COND1:%[0-9]+]] = fcmp oeq double %value, ninf
+; CHECK: [[COND2:%[0-9]+]] = fcmp oeq double %value, pinf
 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
 ; CHECK: [[CALL_LABEL]]:
@@ -249,8 +249,8 @@ entry:
 ; CHECK: [[END_LABEL]]:
 
   %call_02 = call double @cos(double %value) strictfp
-; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0xFFF0000000000000, metadata !"oeq", metadata !"fpexcept.strict")
-; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0x7FF0000000000000, metadata !"oeq", metadata !"fpexcept.strict")
+; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double ninf, metadata !"oeq", metadata !"fpexcept.strict")
+; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double pinf, metadata !"oeq", metadata !"fpexcept.strict")
 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
 ; CHECK: [[CALL_LABEL]]:
@@ -259,8 +259,8 @@ entry:
 ; CHECK: [[END_LABEL]]:
 
   %call_03 = call double @sin(double %value) strictfp
-; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0xFFF0000000000000, metadata !"oeq", metadata !"fpexcept.strict")
-; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double 0x7FF0000000000000, metadata !"oeq", metadata !"fpexcept.strict")
+; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double ninf, metadata !"oeq", metadata !"fpexcept.strict")
+; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f64(double %value, double pinf, metadata !"oeq", metadata !"fpexcept.strict")
 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
 ; CHECK: [[CALL_LABEL]]:
diff --git a/llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll b/llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll
index f4dc79759d17ed..fe1463f888deb2 100644
--- a/llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll
+++ b/llvm/test/Transforms/Util/libcalls-shrinkwrap-float.ll
@@ -139,8 +139,8 @@ entry:
 ; CHECK: [[END_LABEL]]:
 
   %call_02 = call float @cosf(float %value)
-; CHECK: [[COND1:%[0-9]+]] = fcmp oeq float %value, 0xFFF0000000000000
-; CHECK: [[COND2:%[0-9]+]] = fcmp oeq float %value, 0x7FF0000000000000
+; CHECK: [[COND1:%[0-9]+]] = fcmp oeq float %value, ninf
+; CHECK: [[COND2:%[0-9]+]] = fcmp oeq float %value, pinf
 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
 ; CHECK: [[CALL_LABEL]]:
@@ -149,8 +149,8 @@ entry:
 ; CHECK: [[END_LABEL]]:
 
   %call_03 = call float @sinf(float %value)
-; CHECK: [[COND1:%[0-9]+]] = fcmp oeq float %value, 0xFFF0000000000000
-; CHECK: [[COND2:%[0-9]+]] = fcmp oeq float %value, 0x7FF0000000000000
+; CHECK: [[COND1:%[0-9]+]] = fcmp oeq float %value, ninf
+; CHECK: [[COND2:%[0-9]+]] = fcmp oeq float %value, pinf
 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
 ; CHECK: [[CALL_LABEL]]:
@@ -250,8 +250,8 @@ entry:
 ; CHECK: [[END_LABEL]]:
 
   %call_02 = call float @cosf(float %value) strictfp
-; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f32(float [[VALUE]], float 0xFFF0000000000000, metadata !"oeq", metadata !"fpexcept.strict")
-; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f32(float [[VALUE]], float 0x7FF0000000000000, metadata !"oeq", metadata !"fpexcept.strict")
+; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f32(float [[VALUE]], float ninf, metadata !"oeq", metadata !"fpexcept.strict")
+; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f32(float [[VALUE]], float pinf, metadata !"oeq", metadata !"fpexcept.strict")
 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
 ; CHECK: [[CALL_LABEL]]:
@@ -260,8 +260,8 @@ entry:
 ; CHECK: [[END_LABEL]]:
 
   %call_03 = call float @sinf(float %value) strictfp
-; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f32(float [[VALUE]], float 0xFFF0000000000000, metadata !"oeq", metadata !"fpexcept.strict")
-; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f32(float [[VALUE]], float 0x7FF0000000000000, metadata !"oeq", metadata !"fpexcept.strict")
+; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f32(float [[VALUE]], float ninf, metadata !"oeq", metadata !"fpexcept.strict")
+; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f32(float [[VALUE]], float pinf, metadata !"oeq", metadata !"fpexcept.strict")
 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
 ; CHECK: [[CALL_LABEL]]:
diff --git a/llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll b/llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll
index c2b981c81c75d7..c2bdb0cd40e2be 100644
--- a/llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll
+++ b/llvm/test/Transforms/Util/libcalls-shrinkwrap-long-double.ll
@@ -139,8 +139,8 @@ entry:
 ; CHECK: [[END_LABEL]]:
 
   %call_02 = call x86_fp80 @cosl(x86_fp80 %value)
-; CHECK: [[COND1:%[0-9]+]] = fcmp oeq x86_fp80 %value, 0xKFFFF8000000000000000
-; CHECK: [[COND2:%[0-9]+]] = fcmp oeq x86_fp80 %value, 0xK7FFF8000000000000000
+; CHECK: [[COND1:%[0-9]+]] = fcmp oeq x86_fp80 %value, ninf
+; CHECK: [[COND2:%[0-9]+]] = fcmp oeq x86_fp80 %value, pinf
 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
 ; CHECK: [[CALL_LABEL]]:
@@ -149,8 +149,8 @@ entry:
 ; CHECK: [[END_LABEL]]:
 
   %call_03 = call x86_fp80 @sinl(x86_fp80 %value)
-; CHECK: [[COND1:%[0-9]+]] = fcmp oeq x86_fp80 %value, 0xKFFFF8000000000000000
-; CHECK: [[COND2:%[0-9]+]] = fcmp oeq x86_fp80 %value, 0xK7FFF8000000000000000
+; CHECK: [[COND1:%[0-9]+]] = fcmp oeq x86_fp80 %value, ninf
+; CHECK: [[COND2:%[0-9]+]] = fcmp oeq x86_fp80 %value, pinf
 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
 ; CHECK: [[CALL_LABEL]]:
@@ -250,8 +250,8 @@ entry:
 ; CHECK: [[END_LABEL]]:
 
   %call_02 = call x86_fp80 @cosl(x86_fp80 %value) strictfp
-; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f80(x86_fp80 [[VALUE]], x86_fp80 0xKFFFF8000000000000000, metadata !"oeq", metadata !"fpexcept.strict")
-; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f80(x86_fp80 [[VALUE]], x86_fp80 0xK7FFF8000000000000000, metadata !"oeq", metadata !"fpexcept.strict")
+; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f80(x86_fp80 [[VALUE]], x86_fp80 ninf, metadata !"oeq", metadata !"fpexcept.strict")
+; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f80(x86_fp80 [[VALUE]], x86_fp80 pinf, metadata !"oeq", metadata !"fpexcept.strict")
 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
 ; CHECK: [[CALL_LABEL]]:
@@ -260,8 +260,8 @@ entry:
 ; CHECK: [[END_LABEL]]:
 
   %call_03 = call x86_fp80 @sinl(x86_fp80 %value) strictfp
-; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f80(x86_fp80 [[VALUE]], x86_fp80 0xKFFFF8000000000000000, metadata !"oeq", metadata !"fpexcept.strict")
-; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f80(x86_fp80 [[VALUE]], x86_fp80 0xK7FFF8000000000000000, metadata !"oeq", metadata !"fpexcept.strict")
+; CHECK: [[COND1:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f80(x86_fp80 [[VALUE]], x86_fp80 ninf, metadata !"oeq", metadata !"fpexcept.strict")
+; CHECK: [[COND2:%[0-9]+]] = call i1 @llvm.experimental.constrained.fcmp.f80(x86_fp80 [[VALUE]], x86_fp80 pinf, metadata !"oeq", metadata !"fpexcept.strict")
 ; CHECK: [[COND:%[0-9]+]] = or i1 [[COND2]], [[COND1]]
 ; CHECK: br i1 [[COND]], label %[[CALL_LABEL:cdce.call[0-9]*]], label %[[END_LABEL:cdce.end[0-9]*]], !prof ![[BRANCH_WEIGHT]]
 ; CHECK: [[CALL_LABEL]]:
diff --git a/llvm/test/Transforms/VectorCombine/X86/insert-binop-with-constant.ll b/llvm/test/Transforms/VectorCombine/X86/insert-binop-with-constant.ll
index 21adcdfd29b826..915f0061a7f3e9 100644
--- a/llvm/test/Transforms/VectorCombine/X86/insert-binop-with-constant.ll
+++ b/llvm/test/Transforms/VectorCombine/X86/insert-binop-with-constant.ll
@@ -547,7 +547,7 @@ define <2 x i64> @xor_constant_not_undef_lane(i64 %x) {
 define <2 x double> @fadd_constant(double %x) {
 ; CHECK-LABEL: @fadd_constant(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = fadd double [[X:%.*]], 4.200000e+01
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double undef>, double [[BO_SCALAR]], i64 0
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double undef>, double [[BO_SCALAR]], i64 0
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 0
@@ -558,7 +558,7 @@ define <2 x double> @fadd_constant(double %x) {
 define <2 x double> @fadd_constant_not_undef_lane(double %x) {
 ; CHECK-LABEL: @fadd_constant_not_undef_lane(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = fadd double [[X:%.*]], -4.200000e+01
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, double [[BO_SCALAR]], i64 1
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double nan>, double [[BO_SCALAR]], i64 1
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 1
@@ -569,7 +569,7 @@ define <2 x double> @fadd_constant_not_undef_lane(double %x) {
 define <2 x double> @fsub_constant_op0(double %x) {
 ; CHECK-LABEL: @fsub_constant_op0(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = fsub fast double 4.200000e+01, [[X:%.*]]
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double undef>, double [[BO_SCALAR]], i64 0
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double undef>, double [[BO_SCALAR]], i64 0
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 0
@@ -580,7 +580,7 @@ define <2 x double> @fsub_constant_op0(double %x) {
 define <2 x double> @fsub_constant_op0_not_undef_lane(double %x) {
 ; CHECK-LABEL: @fsub_constant_op0_not_undef_lane(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = fsub nsz double -4.200000e+01, [[X:%.*]]
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, double [[BO_SCALAR]], i64 1
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double nan>, double [[BO_SCALAR]], i64 1
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 1
@@ -591,7 +591,7 @@ define <2 x double> @fsub_constant_op0_not_undef_lane(double %x) {
 define <2 x double> @fsub_constant_op1(double %x) {
 ; CHECK-LABEL: @fsub_constant_op1(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = fsub double [[X:%.*]], 4.200000e+01
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double undef, double 0x7FF8000000000000>, double [[BO_SCALAR]], i64 1
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double undef, double nan>, double [[BO_SCALAR]], i64 1
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 1
@@ -602,7 +602,7 @@ define <2 x double> @fsub_constant_op1(double %x) {
 define <2 x double> @fsub_constant_op1_not_undef_lane(double %x) {
 ; CHECK-LABEL: @fsub_constant_op1_not_undef_lane(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = fsub double [[X:%.*]], 4.200000e+01
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, double [[BO_SCALAR]], i64 0
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double nan>, double [[BO_SCALAR]], i64 0
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 0
@@ -613,7 +613,7 @@ define <2 x double> @fsub_constant_op1_not_undef_lane(double %x) {
 define <2 x double> @fmul_constant(double %x) {
 ; CHECK-LABEL: @fmul_constant(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = fmul reassoc double [[X:%.*]], 4.200000e+01
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double undef>, double [[BO_SCALAR]], i64 0
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double undef>, double [[BO_SCALAR]], i64 0
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 0
@@ -624,7 +624,7 @@ define <2 x double> @fmul_constant(double %x) {
 define <2 x double> @fmul_constant_not_undef_lane(double %x) {
 ; CHECK-LABEL: @fmul_constant_not_undef_lane(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = fmul double [[X:%.*]], -4.200000e+01
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, double [[BO_SCALAR]], i64 1
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double nan>, double [[BO_SCALAR]], i64 1
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 1
@@ -635,7 +635,7 @@ define <2 x double> @fmul_constant_not_undef_lane(double %x) {
 define <2 x double> @fdiv_constant_op0(double %x) {
 ; CHECK-LABEL: @fdiv_constant_op0(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = fdiv nnan double 4.200000e+01, [[X:%.*]]
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double undef, double 0x7FF8000000000000>, double [[BO_SCALAR]], i64 1
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double undef, double nan>, double [[BO_SCALAR]], i64 1
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 1
@@ -646,7 +646,7 @@ define <2 x double> @fdiv_constant_op0(double %x) {
 define <2 x double> @fdiv_constant_op0_not_undef_lane(double %x) {
 ; CHECK-LABEL: @fdiv_constant_op0_not_undef_lane(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = fdiv ninf double 4.200000e+01, [[X:%.*]]
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, double [[BO_SCALAR]], i64 0
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double nan>, double [[BO_SCALAR]], i64 0
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 0
@@ -657,7 +657,7 @@ define <2 x double> @fdiv_constant_op0_not_undef_lane(double %x) {
 define <2 x double> @fdiv_constant_op1(double %x) {
 ; CHECK-LABEL: @fdiv_constant_op1(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = fdiv double [[X:%.*]], 4.200000e+01
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double undef>, double [[BO_SCALAR]], i64 0
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double undef>, double [[BO_SCALAR]], i64 0
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 0
@@ -668,7 +668,7 @@ define <2 x double> @fdiv_constant_op1(double %x) {
 define <2 x double> @fdiv_constant_op1_not_undef_lane(double %x) {
 ; CHECK-LABEL: @fdiv_constant_op1_not_undef_lane(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = fdiv double [[X:%.*]], 4.200000e+01
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, double [[BO_SCALAR]], i64 0
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double nan>, double [[BO_SCALAR]], i64 0
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 0
@@ -679,7 +679,7 @@ define <2 x double> @fdiv_constant_op1_not_undef_lane(double %x) {
 define <2 x double> @frem_constant_op0(double %x) {
 ; CHECK-LABEL: @frem_constant_op0(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = frem fast double 4.200000e+01, [[X:%.*]]
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double undef>, double [[BO_SCALAR]], i64 0
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double undef>, double [[BO_SCALAR]], i64 0
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 0
@@ -690,7 +690,7 @@ define <2 x double> @frem_constant_op0(double %x) {
 define <2 x double> @frem_constant_op0_not_undef_lane(double %x) {
 ; CHECK-LABEL: @frem_constant_op0_not_undef_lane(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = frem double -4.200000e+01, [[X:%.*]]
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, double [[BO_SCALAR]], i64 1
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double nan>, double [[BO_SCALAR]], i64 1
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 1
@@ -701,7 +701,7 @@ define <2 x double> @frem_constant_op0_not_undef_lane(double %x) {
 define <2 x double> @frem_constant_op1(double %x) {
 ; CHECK-LABEL: @frem_constant_op1(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = frem ninf double [[X:%.*]], 4.200000e+01
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double undef, double 0x7FF8000000000000>, double [[BO_SCALAR]], i64 1
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double undef, double nan>, double [[BO_SCALAR]], i64 1
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 1
@@ -712,7 +712,7 @@ define <2 x double> @frem_constant_op1(double %x) {
 define <2 x double> @frem_constant_op1_not_undef_lane(double %x) {
 ; CHECK-LABEL: @frem_constant_op1_not_undef_lane(
 ; CHECK-NEXT:    [[BO_SCALAR:%.*]] = frem nnan double [[X:%.*]], 4.200000e+01
-; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>, double [[BO_SCALAR]], i64 0
+; CHECK-NEXT:    [[BO:%.*]] = insertelement <2 x double> <double nan, double nan>, double [[BO_SCALAR]], i64 0
 ; CHECK-NEXT:    ret <2 x double> [[BO]]
 ;
   %ins = insertelement <2 x double> undef, double %x, i32 0
diff --git a/llvm/test/tools/llvm-reduce/reduce-operands-fp.ll b/llvm/test/tools/llvm-reduce/reduce-operands-fp.ll
index 2ceebd7a5a86ac..02067f37039f15 100644
--- a/llvm/test/tools/llvm-reduce/reduce-operands-fp.ll
+++ b/llvm/test/tools/llvm-reduce/reduce-operands-fp.ll
@@ -60,19 +60,19 @@
 ; ZERO: %fadd12 = fadd <2 x float> zeroinitializer, zeroinitializer
 
 
-; NAN: %fadd0 = fadd float %arg0, 0x7FF8000000000000
-; NAN: %fadd1 = fadd float 0x7FF8000000000000, 0x7FF8000000000000
-; NAN: %fadd2 = fadd float 0x7FF8000000000000, 0.000000e+00
-; NAN: %fadd3 = fadd float 0x7FF8000000000000, 1.000000e+00
-; NAN: %fadd4 = fadd float 0x7FF8000000000000, 0x7FF8000000000000
-; NAN: %fadd5 = fadd float 0x7FF8000000000000, 0x7FF8000000000000
-; NAN: %fadd6 = fadd <2 x float> %arg2, <float 0x7FF8000000000000, float 0x7FF8000000000000>
-; NAN: %fadd7 = fadd <2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>, <float 0x7FF8000000000000, float 0x7FF8000000000000>
-; NAN: %fadd8 = fadd <2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>, zeroinitializer
-; NAN: %fadd9 = fadd <2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>, <float 1.000000e+00, float 1.000000e+00>
-; NAN: %fadd10 = fadd <2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>, <float 0x7FF8000000000000, float 0x7FF8000000000000>
-; NAN: %fadd11 = fadd <2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>, <float 0x7FF8000000000000, float 0x7FF8000000000000>
-; NAN: %fadd12 = fadd <2 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000>, <float 0x7FF8000000000000, float 0x7FF8000000000000>
+; NAN: %fadd0 = fadd float %arg0, nan
+; NAN: %fadd1 = fadd float nan, nan
+; NAN: %fadd2 = fadd float nan, 0.000000e+00
+; NAN: %fadd3 = fadd float nan, 1.000000e+00
+; NAN: %fadd4 = fadd float nan, nan
+; NAN: %fadd5 = fadd float nan, nan
+; NAN: %fadd6 = fadd <2 x float> %arg2, <float nan, float nan>
+; NAN: %fadd7 = fadd <2 x float> <float nan, float nan>, <float nan, float nan>
+; NAN: %fadd8 = fadd <2 x float> <float nan, float nan>, zeroinitializer
+; NAN: %fadd9 = fadd <2 x float> <float nan, float nan>, <float 1.000000e+00, float 1.000000e+00>
+; NAN: %fadd10 = fadd <2 x float> <float nan, float nan>, <float nan, float nan>
+; NAN: %fadd11 = fadd <2 x float> <float nan, float nan>, <float nan, float nan>
+; NAN: %fadd12 = fadd <2 x float> <float nan, float nan>, <float nan, float nan>
 
 define void @foo(float %arg0, float %arg1, <2 x float> %arg2, <2 x float> %arg3) {
 bb0:
@@ -80,14 +80,14 @@ bb0:
   %fadd1 = fadd float %arg0, %arg1
   %fadd2 = fadd float %arg0, 0.0
   %fadd3 = fadd float %arg0, 1.0
-  %fadd4 = fadd float %arg0, 0x7FF8000000000000
+  %fadd4 = fadd float %arg0, nan
   %fadd5 = fadd float %arg0, undef
   %fadd6 = fadd <2 x float> %arg2, %arg3
   %fadd7 = fadd <2 x float> %arg2, %arg3
   %fadd8 = fadd <2 x float> %arg2, zeroinitializer
   %fadd9 = fadd <2 x float> %arg2, <float 1.0, float 1.0>
   %fadd10 = fadd <2 x float> %arg2, undef
-  %fadd11 = fadd <2 x float> %arg2, <float 0x7FF8000000000000, float 0x7FF8000000000000>
-  %fadd12 = fadd <2 x float> %arg2, <float 0x7FF8000000000000, float 2.0>
+  %fadd11 = fadd <2 x float> %arg2, <float nan, float nan>
+  %fadd12 = fadd <2 x float> %arg2, <float nan, float 2.0>
   ret void
 }



More information about the llvm-commits mailing list