mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-11 17:08:42 +00:00
ADT: Replace FPClassTest fabs with inverse_fabs and unknown_sign (#66390)
This commit is contained in:
parent
0d0ab7600f
commit
07acfe3a4d
@ -269,8 +269,12 @@ LLVM_DECLARE_ENUM_AS_BITMASK(FPClassTest, /* LargestValue */ fcPosInf);
|
||||
/// Return the test mask which returns true if the value's sign bit is flipped.
|
||||
FPClassTest fneg(FPClassTest Mask);
|
||||
|
||||
/// Return the test mask which returns true if the value's sign bit is cleared.
|
||||
FPClassTest fabs(FPClassTest Mask);
|
||||
/// Return the test mask which returns true after fabs is applied to the value.
|
||||
FPClassTest inverse_fabs(FPClassTest Mask);
|
||||
|
||||
/// Return the test mask which returns true if the value could have the same set
|
||||
/// of classes, but with a different sign.
|
||||
FPClassTest unknown_sign(FPClassTest Mask);
|
||||
|
||||
/// Write a human readable form of \p Mask to \p OS
|
||||
raw_ostream &operator<<(raw_ostream &OS, FPClassTest Mask);
|
||||
|
@ -32,7 +32,7 @@ FPClassTest llvm::fneg(FPClassTest Mask) {
|
||||
return NewMask;
|
||||
}
|
||||
|
||||
FPClassTest llvm::fabs(FPClassTest Mask) {
|
||||
FPClassTest llvm::inverse_fabs(FPClassTest Mask) {
|
||||
FPClassTest NewMask = Mask & fcNan;
|
||||
if (Mask & fcPosZero)
|
||||
NewMask |= fcZero;
|
||||
@ -45,6 +45,19 @@ FPClassTest llvm::fabs(FPClassTest Mask) {
|
||||
return NewMask;
|
||||
}
|
||||
|
||||
FPClassTest llvm::unknown_sign(FPClassTest Mask) {
|
||||
FPClassTest NewMask = Mask & fcNan;
|
||||
if (Mask & fcZero)
|
||||
NewMask |= fcZero;
|
||||
if (Mask & fcSubnormal)
|
||||
NewMask |= fcSubnormal;
|
||||
if (Mask & fcNormal)
|
||||
NewMask |= fcNormal;
|
||||
if (Mask & fcInf)
|
||||
NewMask |= fcInf;
|
||||
return NewMask;
|
||||
}
|
||||
|
||||
// Every bitfield has a unique name and one or more aliasing names that cover
|
||||
// multiple bits. Names should be listed in order of preference, with higher
|
||||
// popcounts listed first.
|
||||
|
@ -899,7 +899,7 @@ Instruction *InstCombinerImpl::foldIntrinsicIsFPClass(IntrinsicInst &II) {
|
||||
|
||||
Value *FAbsSrc;
|
||||
if (match(Src0, m_FAbs(m_Value(FAbsSrc)))) {
|
||||
II.setArgOperand(1, ConstantInt::get(Src1->getType(), fabs(Mask)));
|
||||
II.setArgOperand(1, ConstantInt::get(Src1->getType(), inverse_fabs(Mask)));
|
||||
return replaceOperand(II, 0, FAbsSrc);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user