summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-02-20 23:29:05 +0000
committerSanjay Patel <spatel@rotateright.com>2018-02-20 23:29:05 +0000
commit3e569ac0cc711d8a9c7271243711f41dbb93d945 (patch)
tree5a9d1223d6b6994fae0a375533ac7d2c9ba5ade9
parent737fa40ffad15482801cc60271aed40dd5de9c95 (diff)
downloadbcm5719-llvm-3e569ac0cc711d8a9c7271243711f41dbb93d945.tar.gz
bcm5719-llvm-3e569ac0cc711d8a9c7271243711f41dbb93d945.zip
[PatternMatch] allow vector matches with m_FNeg
llvm-svn: 325642
-rw-r--r--llvm/include/llvm/IR/PatternMatch.h2
-rw-r--r--llvm/test/Transforms/InstCombine/cos-intrinsic.ll9
-rw-r--r--llvm/test/Transforms/InstCombine/fdiv.ll4
3 files changed, 4 insertions, 11 deletions
diff --git a/llvm/include/llvm/IR/PatternMatch.h b/llvm/include/llvm/IR/PatternMatch.h
index 99c6ff2dc91..e7e3303eaa3 100644
--- a/llvm/include/llvm/IR/PatternMatch.h
+++ b/llvm/include/llvm/IR/PatternMatch.h
@@ -1101,7 +1101,7 @@ template <typename LHS_t> struct fneg_match {
private:
bool matchIfFNeg(Value *LHS, Value *RHS) {
- if (const auto *C = dyn_cast<ConstantFP>(LHS))
+ if (const auto *C = dyn_cast<Constant>(LHS))
return C->isNegativeZeroValue() && L.match(RHS);
return false;
}
diff --git a/llvm/test/Transforms/InstCombine/cos-intrinsic.ll b/llvm/test/Transforms/InstCombine/cos-intrinsic.ll
index 7bd6283c6bd..d962a84176d 100644
--- a/llvm/test/Transforms/InstCombine/cos-intrinsic.ll
+++ b/llvm/test/Transforms/InstCombine/cos-intrinsic.ll
@@ -38,12 +38,9 @@ define float @fneg_f32(float %x) {
ret float %cos
}
-; FIXME: m_FNeg() doesn't handle vectors
-
define <2 x float> @fneg_v2f32(<2 x float> %x) {
; CHECK-LABEL: @fneg_v2f32(
-; CHECK-NEXT: [[X_FNEG:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
-; CHECK-NEXT: [[COS:%.*]] = call <2 x float> @llvm.cos.v2f32(<2 x float> [[X_FNEG]])
+; CHECK-NEXT: [[COS:%.*]] = call <2 x float> @llvm.cos.v2f32(<2 x float> [[X:%.*]])
; CHECK-NEXT: ret <2 x float> [[COS]]
;
%x.fneg = fsub <2 x float> <float -0.0, float -0.0>, %x
@@ -74,9 +71,7 @@ define float @fabs_fneg_f32(float %x) {
define <2 x float> @fabs_fneg_v2f32(<2 x float> %x) {
; CHECK-LABEL: @fabs_fneg_v2f32(
-; CHECK-NEXT: [[X_FABS:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[X:%.*]])
-; CHECK-NEXT: [[X_FABS_FNEG:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X_FABS]]
-; CHECK-NEXT: [[COS:%.*]] = call <2 x float> @llvm.cos.v2f32(<2 x float> [[X_FABS_FNEG]])
+; CHECK-NEXT: [[COS:%.*]] = call <2 x float> @llvm.cos.v2f32(<2 x float> [[X:%.*]])
; CHECK-NEXT: ret <2 x float> [[COS]]
;
%x.fabs = call <2 x float> @llvm.fabs.v2f32(<2 x float> %x)
diff --git a/llvm/test/Transforms/InstCombine/fdiv.ll b/llvm/test/Transforms/InstCombine/fdiv.ll
index c02b2b41a4b..02eb046d8ab 100644
--- a/llvm/test/Transforms/InstCombine/fdiv.ll
+++ b/llvm/test/Transforms/InstCombine/fdiv.ll
@@ -204,9 +204,7 @@ define float @fneg_fneg_fast(float %x, float %y) {
define <2 x float> @fneg_fneg_vec(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @fneg_fneg_vec(
-; CHECK-NEXT: [[XNEG:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
-; CHECK-NEXT: [[YNEG:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[Y:%.*]]
-; CHECK-NEXT: [[DIV:%.*]] = fdiv <2 x float> [[XNEG]], [[YNEG]]
+; CHECK-NEXT: [[DIV:%.*]] = fdiv <2 x float> [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: ret <2 x float> [[DIV]]
;
%xneg = fsub <2 x float> <float -0.0, float -0.0>, %x
OpenPOWER on IntegriCloud