Optimize fptrunc(x)>=C1 --> x>=C2 (#99475)
Fix https://github.com/llvm/llvm-project/issues/85265#issue-2186848949
This commit is contained in:
parent
224e221f1b
commit
baf2953097
@ -11,6 +11,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "InstCombineInternal.h"
|
#include "InstCombineInternal.h"
|
||||||
|
#include "llvm/ADT/APFloat.h"
|
||||||
#include "llvm/ADT/APSInt.h"
|
#include "llvm/ADT/APSInt.h"
|
||||||
#include "llvm/ADT/SetVector.h"
|
#include "llvm/ADT/SetVector.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
@ -21,8 +22,10 @@
|
|||||||
#include "llvm/Analysis/Utils/Local.h"
|
#include "llvm/Analysis/Utils/Local.h"
|
||||||
#include "llvm/Analysis/VectorUtils.h"
|
#include "llvm/Analysis/VectorUtils.h"
|
||||||
#include "llvm/IR/ConstantRange.h"
|
#include "llvm/IR/ConstantRange.h"
|
||||||
|
#include "llvm/IR/Constants.h"
|
||||||
#include "llvm/IR/DataLayout.h"
|
#include "llvm/IR/DataLayout.h"
|
||||||
#include "llvm/IR/InstrTypes.h"
|
#include "llvm/IR/InstrTypes.h"
|
||||||
|
#include "llvm/IR/Instructions.h"
|
||||||
#include "llvm/IR/IntrinsicInst.h"
|
#include "llvm/IR/IntrinsicInst.h"
|
||||||
#include "llvm/IR/PatternMatch.h"
|
#include "llvm/IR/PatternMatch.h"
|
||||||
#include "llvm/Support/KnownBits.h"
|
#include "llvm/Support/KnownBits.h"
|
||||||
@ -8222,6 +8225,98 @@ static Instruction *foldFCmpReciprocalAndZero(FCmpInst &I, Instruction *LHSI,
|
|||||||
return new FCmpInst(Pred, LHSI->getOperand(1), RHSC, "", &I);
|
return new FCmpInst(Pred, LHSI->getOperand(1), RHSC, "", &I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Transform 'fptrunc(x) cmp C' to 'x cmp ext(C)' if possible.
|
||||||
|
// Patterns include:
|
||||||
|
// fptrunc(x) < C --> x < ext(C)
|
||||||
|
// fptrunc(x) <= C --> x <= ext(C)
|
||||||
|
// fptrunc(x) > C --> x > ext(C)
|
||||||
|
// fptrunc(x) >= C --> x >= ext(C)
|
||||||
|
// where 'ext(C)' is the extension of 'C' to the type of 'x' with a small bias
|
||||||
|
// due to precision loss.
|
||||||
|
static Instruction *foldFCmpFpTrunc(FCmpInst &I, const Instruction &FPTrunc,
|
||||||
|
const Constant &C) {
|
||||||
|
FCmpInst::Predicate Pred = I.getPredicate();
|
||||||
|
bool RoundDown = false;
|
||||||
|
|
||||||
|
if (Pred == FCmpInst::FCMP_OGE || Pred == FCmpInst::FCMP_UGE ||
|
||||||
|
Pred == FCmpInst::FCMP_OLT || Pred == FCmpInst::FCMP_ULT)
|
||||||
|
RoundDown = true;
|
||||||
|
else if (Pred == FCmpInst::FCMP_OGT || Pred == FCmpInst::FCMP_UGT ||
|
||||||
|
Pred == FCmpInst::FCMP_OLE || Pred == FCmpInst::FCMP_ULE)
|
||||||
|
RoundDown = false;
|
||||||
|
else
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
const APFloat *CValue;
|
||||||
|
if (!match(&C, m_APFloat(CValue)))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
if (CValue->isNaN() || CValue->isInfinity())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
auto ConvertFltSema = [](const APFloat &Src, const fltSemantics &Sema) {
|
||||||
|
bool LosesInfo;
|
||||||
|
APFloat Dest = Src;
|
||||||
|
Dest.convert(Sema, APFloat::rmNearestTiesToEven, &LosesInfo);
|
||||||
|
return Dest;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto NextValue = [](const APFloat &Value, bool RoundDown) {
|
||||||
|
APFloat NextValue = Value;
|
||||||
|
NextValue.next(RoundDown);
|
||||||
|
return NextValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
APFloat NextCValue = NextValue(*CValue, RoundDown);
|
||||||
|
|
||||||
|
Type *DestType = FPTrunc.getOperand(0)->getType();
|
||||||
|
const fltSemantics &DestFltSema =
|
||||||
|
DestType->getScalarType()->getFltSemantics();
|
||||||
|
|
||||||
|
APFloat ExtCValue = ConvertFltSema(*CValue, DestFltSema);
|
||||||
|
APFloat ExtNextCValue = ConvertFltSema(NextCValue, DestFltSema);
|
||||||
|
|
||||||
|
// When 'NextCValue' is infinity, use an imaged 'NextCValue' that equals
|
||||||
|
// 'CValue + bias' to avoid the infinity after conversion. The bias is
|
||||||
|
// estimated as 'CValue - PrevCValue', where 'PrevCValue' is the previous
|
||||||
|
// value of 'CValue'.
|
||||||
|
if (NextCValue.isInfinity()) {
|
||||||
|
APFloat PrevCValue = NextValue(*CValue, !RoundDown);
|
||||||
|
APFloat Bias = ConvertFltSema(*CValue - PrevCValue, DestFltSema);
|
||||||
|
|
||||||
|
ExtNextCValue = ExtCValue + Bias;
|
||||||
|
}
|
||||||
|
|
||||||
|
APFloat ExtMidValue =
|
||||||
|
scalbn(ExtCValue + ExtNextCValue, -1, APFloat::rmNearestTiesToEven);
|
||||||
|
|
||||||
|
const fltSemantics &SrcFltSema =
|
||||||
|
C.getType()->getScalarType()->getFltSemantics();
|
||||||
|
|
||||||
|
// 'MidValue' might be rounded to 'NextCValue'. Correct it here.
|
||||||
|
APFloat MidValue = ConvertFltSema(ExtMidValue, SrcFltSema);
|
||||||
|
if (MidValue != *CValue)
|
||||||
|
ExtMidValue.next(!RoundDown);
|
||||||
|
|
||||||
|
// Check whether 'ExtMidValue' is a valid result since the assumption on
|
||||||
|
// imaged 'NextCValue' might not hold for new float types.
|
||||||
|
// ppc_fp128 can't pass here when converting from max float because of
|
||||||
|
// APFloat implementation.
|
||||||
|
if (NextCValue.isInfinity()) {
|
||||||
|
// ExtMidValue --- narrowed ---> Finite
|
||||||
|
if (ConvertFltSema(ExtMidValue, SrcFltSema).isInfinity())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
// NextExtMidValue --- narrowed ---> Infinity
|
||||||
|
APFloat NextExtMidValue = NextValue(ExtMidValue, RoundDown);
|
||||||
|
if (ConvertFltSema(NextExtMidValue, SrcFltSema).isFinite())
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new FCmpInst(Pred, FPTrunc.getOperand(0),
|
||||||
|
ConstantFP::get(DestType, ExtMidValue), "", &I);
|
||||||
|
}
|
||||||
|
|
||||||
/// Optimize fabs(X) compared with zero.
|
/// Optimize fabs(X) compared with zero.
|
||||||
static Instruction *foldFabsWithFcmpZero(FCmpInst &I, InstCombinerImpl &IC) {
|
static Instruction *foldFabsWithFcmpZero(FCmpInst &I, InstCombinerImpl &IC) {
|
||||||
Value *X;
|
Value *X;
|
||||||
@ -8712,6 +8807,10 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) {
|
|||||||
cast<LoadInst>(LHSI), GEP, GV, I))
|
cast<LoadInst>(LHSI), GEP, GV, I))
|
||||||
return Res;
|
return Res;
|
||||||
break;
|
break;
|
||||||
|
case Instruction::FPTrunc:
|
||||||
|
if (Instruction *NV = foldFCmpFpTrunc(I, *LHSI, *RHSC))
|
||||||
|
return NV;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
674
llvm/test/Transforms/InstCombine/fold-fcmp-trunc.ll
Normal file
674
llvm/test/Transforms/InstCombine/fold-fcmp-trunc.ll
Normal file
@ -0,0 +1,674 @@
|
|||||||
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
|
||||||
|
; RUN: opt -passes=instcombine -S < %s | FileCheck %s
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp oge double [[TMP0]], 0x4058FFFFF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp oge float %trunc, 1.000000e+02
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_ult(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_ult(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ult double [[TMP0]], 0x4068FFFFF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ult float %trunc, 2.000000e+02
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_ole(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_ole(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ole double [[TMP0]], 0x4072C00010000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ole float %trunc, 3.000000e+02
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_ogt(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_ogt(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ogt double [[TMP0]], 0x4079000010000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ogt float %trunc, 4.000000e+02
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_zero(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_zero(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp oge double [[TMP0]], 0xB690000000000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp oge float %trunc, 0.000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_with_nnan(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_with_nnan(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp nnan oge double [[TMP0]], 0x4058FFFFF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp nnan oge float %trunc, 1.000000e+02
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_with_ninf(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_with_ninf(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ninf oge double [[TMP0]], 0x4058FFFFF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ninf oge float %trunc, 1.000000e+02
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_with_nsz(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_with_nsz(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp nsz oge double [[TMP0]], 0x4058FFFFF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp nsz oge float %trunc, 1.000000e+02
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_with_reassoc(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_with_reassoc(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp reassoc oge double [[TMP0]], 0x4058FFFFF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp reassoc oge float %trunc, 1.000000e+02
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_with_fast(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_with_fast(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp fast oge double [[TMP0]], 0x4058FFFFF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp fast oge float %trunc, 1.000000e+02
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define <4 x i1> @fcmp_vec_trunc(<4 x double> %0) {
|
||||||
|
; CHECK-LABEL: define <4 x i1> @fcmp_vec_trunc(
|
||||||
|
; CHECK-SAME: <4 x double> [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <4 x double> [[TMP0]], splat (double 0x3FEFFFFFF0000000)
|
||||||
|
; CHECK-NEXT: ret <4 x i1> [[CMP]]
|
||||||
|
;
|
||||||
|
%vec = fptrunc <4 x double> %0 to <4 x float>
|
||||||
|
%cmp = fcmp olt <4 x float> %vec, <float 1.0, float 1.0, float 1.0, float 1.0>
|
||||||
|
ret <4 x i1> %cmp
|
||||||
|
}
|
||||||
|
|
||||||
|
define <1 x i1> @fcmp_vec_trunc_scalar(<1 x double> %0) {
|
||||||
|
; CHECK-LABEL: define <1 x i1> @fcmp_vec_trunc_scalar(
|
||||||
|
; CHECK-SAME: <1 x double> [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[CMP:%.*]] = fcmp fast olt <1 x double> [[TMP0]], splat (double 0x3FEFFFFFF0000000)
|
||||||
|
; CHECK-NEXT: ret <1 x i1> [[CMP]]
|
||||||
|
;
|
||||||
|
%vec = fptrunc <1 x double> %0 to <1 x float>
|
||||||
|
%cmp = fcmp fast olt <1 x float> %vec, <float 1.0>
|
||||||
|
ret <1 x i1> %cmp
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_fp128(fp128 %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_fp128(
|
||||||
|
; CHECK-SAME: fp128 [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp fast oge fp128 [[TMP0]], 0xL000000000000000040058FFFFF000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc fp128 %0 to float
|
||||||
|
%result = fcmp fast oge float %trunc, 1.000000e+02
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_x86_fp80(x86_fp80 %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_x86_fp80(
|
||||||
|
; CHECK-SAME: x86_fp80 [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp fast oge x86_fp80 [[TMP0]], 0xK4005C7FFFF8000000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc x86_fp80 %0 to float
|
||||||
|
%result = fcmp fast oge float %trunc, 1.000000e+02
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_ppc_fp128(ppc_fp128 %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_ppc_fp128(
|
||||||
|
; CHECK-SAME: ppc_fp128 [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp fast oge ppc_fp128 [[TMP0]], 0xM4058FFFFF00000000000000000000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc ppc_fp128 %0 to float
|
||||||
|
%result = fcmp fast oge float %trunc, 1.000000e+02
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_nan(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_nan(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: ret i1 false
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp oge float %trunc, 0x7FF8000000000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
; denomalized 0x00000001
|
||||||
|
define i1 @fcmp_trunc_d1(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_d1(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp oge double [[TMP0]], 0x3690000000000001
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp oge float %trunc, 1.40129846432481707092372958328991613128026194187651577175706828388979108268586060148663818836212158203125e-45
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
; denomalized 0x00000001 ole
|
||||||
|
define i1 @fcmp_trunc_d1_ole(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_d1_ole(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ole double [[TMP0]], 0x36A7FFFFFFFFFFFF
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ole float %trunc, 1.40129846432481707092372958328991613128026194187651577175706828388979108268586060148663818836212158203125e-45
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
; denomalized 0x00000002
|
||||||
|
define i1 @fcmp_trunc_d2(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_d2(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp oge double [[TMP0]], 0x36A8000000000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp oge float %trunc, 2.8025969286496341418474591665798322625605238837530315435141365677795821653717212029732763767242431640625e-45
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
; denomalized 0x7fffff
|
||||||
|
define i1 @fcmp_trunc_d3(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_d3(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ogt double [[TMP0]], 0x380FFFFFDFFFFFFF
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ogt float %trunc, 1.175494210692441075487029444849287348827052428745893333857174530571588870475618904265502351336181163787841796875e-38
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
; denomalized 0x80000001
|
||||||
|
define i1 @fcmp_trunc_d4(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_d4(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ogt double [[TMP0]], 0xB690000000000001
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ogt float %trunc, -1.40129846432481707092372958328991613128026194187651577175706828388979108268586060148663818836212158203125e-45
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
; denomalized 0x80000001
|
||||||
|
define i1 @fcmp_trunc_d5(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_d5(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp olt double [[TMP0]], 0xB80FFFFFDFFFFFFF
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp olt float %trunc, -1.175494210692441075487029444849287348827052428745893333857174530571588870475618904265502351336181163787841796875e-38
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; +0
|
||||||
|
define i1 @fcmp_trunc_p0(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_p0(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp oge double [[TMP0]], 0xB690000000000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp oge float %trunc, 0x00000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; -0
|
||||||
|
define i1 @fcmp_trunc_n0(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_n0(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ogt double [[TMP0]], 0x3690000000000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ogt float %trunc, 0x8000000000000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; max representable
|
||||||
|
define i1 @fcmp_trunc_mx(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_mx(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ogt double [[TMP0]], 0x47EFFFFFEFFFFFFF
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ogt float %trunc, 0x47EFFFFFE0000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
; negative max representable
|
||||||
|
define i1 @fcmp_trunc_mn(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_mn(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp olt double [[TMP0]], 0xC7EFFFFFEFFFFFFF
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp olt float %trunc, -3.4028234663852885981170418348451692544e38
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_literal_nan(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_literal_nan(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: ret i1 false
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp oge float %trunc, 0x7FF8000000000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_literal_positive_inf(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_literal_positive_inf(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[TRUNC:%.*]] = fptrunc double [[TMP0]] to float
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp oeq float [[TRUNC]], 0x7FF0000000000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp oge float %trunc, 0x7FF0000000000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_literal_negative_inf(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_literal_negative_inf(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[TRUNC:%.*]] = fptrunc double [[TMP0]] to float
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp uno float [[TRUNC]], 0.000000e+00
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ult float %trunc, 0xFFF0000000000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_nan_ugt(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_nan_ugt(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: ret i1 true
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ugt float %trunc, 0x7FF8000000000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_inf_uge(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_inf_uge(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[TRUNC:%.*]] = fptrunc double [[TMP0]] to float
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ueq float [[TRUNC]], 0x7FF0000000000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp uge float %trunc, 0x7FF0000000000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_ninf_olt(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_ninf_olt(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: ret i1 false
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp olt float %trunc, 0xFFF0000000000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_uge(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_uge(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp uge double [[TMP0]], 0x405EBFFFF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp uge float %trunc, 123.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_neg_uge(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_neg_uge(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp uge double [[TMP0]], 0xC05EC00010000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp uge float %trunc, -123.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_oge(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_oge(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp oge double [[TMP0]], 0x405EBFFFF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp oge float %trunc, 123.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_neg_oge(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_neg_oge(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp oge double [[TMP0]], 0xC05EC00010000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp oge float %trunc, -123.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_ugt(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_ugt(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ugt double [[TMP0]], 0x40FE0F3010000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ugt float %trunc, 123123.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_neg_ugt(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_neg_ugt(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ugt double [[TMP0]], 0xC0FE1B8FF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ugt float %trunc, -123321.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_neg_ogt(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_neg_ogt(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ogt double [[TMP0]], 0xC0FE1B8FF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ogt float %trunc, -123321.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_ule(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_ule(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ule double [[TMP0]], 0x408ED80010000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ule float %trunc, 987.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_neg_ule(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_neg_ule(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ule double [[TMP0]], 0xC088A7FFF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ule float %trunc, -789.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_neg_ole(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_neg_ole(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ole double [[TMP0]], 0xC088A7FFF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ole float %trunc, -789.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_neg_ult(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_neg_ult(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ult double [[TMP0]], 0xC088A80010000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp ult float %trunc, -789.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_olt(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_olt(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp olt double [[TMP0]], 0x408ED7FFF0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp olt float %trunc, 987.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_neg_olt(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_neg_olt(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp olt double [[TMP0]], 0xC088A80010000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp olt float %trunc, -789.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_neg_nsz_uge(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_neg_nsz_uge(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp nsz uge double [[TMP0]], 0xC05EC00010000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp nsz uge float %trunc, -123.0
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_reassoc_ugt(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_reassoc_ugt(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp reassoc ugt double [[TMP0]], 0x40889F8210000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp reassoc ugt float %trunc, 787.9384765625
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_neg_reassoc_ugt(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_neg_reassoc_ugt(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp reassoc ugt double [[TMP0]], 0xC0889F81F0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp reassoc ugt float %trunc, -787.9384765625
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_fast_ult(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_fast_ult(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp fast uge double [[TMP0]], 0x40F8E8E010000001
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp fast uge float %trunc, 102030.0078125
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define i1 @fcmp_trunc_neg_fast_ult(double %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_neg_fast_ult(
|
||||||
|
; CHECK-SAME: double [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp fast uge double [[TMP0]], 0xC0F8E8E02FFFFFFF
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc double %0 to float
|
||||||
|
%result = fcmp fast uge float %trunc, -102030.0078125
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; max representable float to fp128
|
||||||
|
define i1 @fcmp_trunc_mx_fp128(fp128 %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_mx_fp128(
|
||||||
|
; CHECK-SAME: fp128 [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ole fp128 [[TMP0]], 0xLFFFFFFFFFFFFFFFF407EFFFFFEFFFFFF
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc fp128 %0 to float
|
||||||
|
%result = fcmp ole float %trunc, 0x47EFFFFFE0000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; max representable float to x86_fp80
|
||||||
|
define i1 @fcmp_trunc_mx_x86_fp80(x86_fp80 %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_mx_x86_fp80(
|
||||||
|
; CHECK-SAME: x86_fp80 [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ule x86_fp80 [[TMP0]], 0xK407EFFFFFF7FFFFFFFFF
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc x86_fp80 %0 to float
|
||||||
|
%result = fcmp ule float %trunc, 0x47EFFFFFE0000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; max representable float to ppc_fp128
|
||||||
|
define i1 @fcmp_trunc_mx_ppc_fp128(ppc_fp128 %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_mx_ppc_fp128(
|
||||||
|
; CHECK-SAME: ppc_fp128 [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[TRUNC:%.*]] = fptrunc ppc_fp128 [[TMP0]] to float
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp ole float [[TRUNC]], 0x47EFFFFFE0000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc ppc_fp128 %0 to float
|
||||||
|
%result = fcmp ole float %trunc, 0x47EFFFFFE0000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; negative max representable float to fp128
|
||||||
|
define i1 @fcmp_trunc_mn_fp128(fp128 %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_mn_fp128(
|
||||||
|
; CHECK-SAME: fp128 [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp olt fp128 [[TMP0]], 0xL0000000000000000C07EFFFFF1000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc fp128 %0 to float
|
||||||
|
%result = fcmp olt float %trunc, 0xC7EFFFFF00000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; negative max representable float to x86_fp80
|
||||||
|
define i1 @fcmp_trunc_mn_x86_fp80(x86_fp80 %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_mn_x86_fp80(
|
||||||
|
; CHECK-SAME: x86_fp80 [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp oge x86_fp80 [[TMP0]], 0xKC07EFFFFF88000000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc x86_fp80 %0 to float
|
||||||
|
%result = fcmp oge float %trunc, 0xC7EFFFFF00000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; negative max representable float to ppc_fp128
|
||||||
|
define i1 @fcmp_trunc_mn_ppc_fp128(ppc_fp128 %0) {
|
||||||
|
; CHECK-LABEL: define i1 @fcmp_trunc_mn_ppc_fp128(
|
||||||
|
; CHECK-SAME: ppc_fp128 [[TMP0:%.*]]) {
|
||||||
|
; CHECK-NEXT: [[RESULT:%.*]] = fcmp uge ppc_fp128 [[TMP0]], 0xMC7EFFFFF100000000000000000000000
|
||||||
|
; CHECK-NEXT: ret i1 [[RESULT]]
|
||||||
|
;
|
||||||
|
%trunc = fptrunc ppc_fp128 %0 to float
|
||||||
|
%result = fcmp uge float %trunc, 0xC7EFFFFF00000000
|
||||||
|
ret i1 %result
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user