mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[PatternMatch] enhance m_NaN() to ignore undef elements in vectors
llvm-svn: 327339
This commit is contained in:
parent
6bf371c84a
commit
db7886716e
@ -157,17 +157,6 @@ struct match_any_zero {
|
||||
/// floating point constants, this will match negative zero and positive zero
|
||||
inline match_any_zero m_AnyZero() { return match_any_zero(); }
|
||||
|
||||
struct match_nan {
|
||||
template <typename ITy> bool match(ITy *V) {
|
||||
if (const auto *C = dyn_cast<Constant>(V))
|
||||
return C->isNaN();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/// Match an arbitrary NaN constant. This includes quiet and signalling nans.
|
||||
inline match_nan m_NaN() { return match_nan(); }
|
||||
|
||||
struct apint_match {
|
||||
const APInt *&Res;
|
||||
|
||||
@ -422,6 +411,14 @@ inline cstfp_pred_ty<is_neg_zero> m_NegZero() {
|
||||
return cstfp_pred_ty<is_neg_zero>();
|
||||
}
|
||||
|
||||
struct is_nan {
|
||||
bool isValue(const APFloat &C) { return C.isNaN(); }
|
||||
};
|
||||
// Match an arbitrary NaN constant. This includes quiet and signalling nans.
|
||||
inline cstfp_pred_ty<is_nan> m_NaN() {
|
||||
return cstfp_pred_ty<is_nan>();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename Class> struct bind_ty {
|
||||
|
@ -356,8 +356,7 @@ define <2 x i1> @orderedCompareWithNaNVector(<2 x double> %A) {
|
||||
|
||||
define <2 x i1> @orderedCompareWithNaNVector_undef_elt(<2 x double> %A) {
|
||||
; CHECK-LABEL: @orderedCompareWithNaNVector_undef_elt(
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <2 x double> [[A:%.*]], <double 0xFFFFFFFFFFFFFFFF, double undef>
|
||||
; CHECK-NEXT: ret <2 x i1> [[CMP]]
|
||||
; CHECK-NEXT: ret <2 x i1> zeroinitializer
|
||||
;
|
||||
%cmp = fcmp olt <2 x double> %A, <double 0xFFFFFFFFFFFFFFFF, double undef>
|
||||
ret <2 x i1> %cmp
|
||||
@ -365,8 +364,7 @@ define <2 x i1> @orderedCompareWithNaNVector_undef_elt(<2 x double> %A) {
|
||||
|
||||
define <2 x i1> @unorderedCompareWithNaNVector_undef_elt(<2 x double> %A) {
|
||||
; CHECK-LABEL: @unorderedCompareWithNaNVector_undef_elt(
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp ult <2 x double> [[A:%.*]], <double undef, double 0xFFFFFFFFFFFFFFFF>
|
||||
; CHECK-NEXT: ret <2 x i1> [[CMP]]
|
||||
; CHECK-NEXT: ret <2 x i1> <i1 true, i1 true>
|
||||
;
|
||||
%cmp = fcmp ult <2 x double> %A, <double undef, double 0xFFFFFFFFFFFFFFFF>
|
||||
ret <2 x i1> %cmp
|
||||
|
Loading…
x
Reference in New Issue
Block a user