summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-07-22 06:07:16 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-07-22 06:07:16 +0000
commit5ac69057c000cd3d3f7f8a834c2aef537894956f (patch)
tree3d5ef32753d0787c319b369f361882b138646e90 /clang
parent2e1d66847cf0682790c7cf14c6ced58c67c83667 (diff)
downloadbcm5719-llvm-5ac69057c000cd3d3f7f8a834c2aef537894956f.tar.gz
bcm5719-llvm-5ac69057c000cd3d3f7f8a834c2aef537894956f.zip
Make vectorized floating-point comparisons work without crashing.
llvm-svn: 76726
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp2
-rw-r--r--clang/test/CodeGen/ext-vector.c14
2 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index e58693a8d66..4d31f99e3a2 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -1215,7 +1215,7 @@ Value *ScalarExprEmitter::EmitCompare(const BinaryOperator *E,unsigned UICmpOpc,
Value *LHS = Visit(E->getLHS());
Value *RHS = Visit(E->getRHS());
- if (LHS->getType()->isFloatingPoint()) {
+ if (LHS->getType()->isFPOrFPVector()) {
Result = Builder.CreateFCmp((llvm::CmpInst::Predicate)FCmpOpc,
LHS, RHS, "cmp");
} else if (LHSTy->isSignedIntegerType()) {
diff --git a/clang/test/CodeGen/ext-vector.c b/clang/test/CodeGen/ext-vector.c
index 4739a661cc0..6a246db6351 100644
--- a/clang/test/CodeGen/ext-vector.c
+++ b/clang/test/CodeGen/ext-vector.c
@@ -124,3 +124,17 @@ void test7(int4 *ap, int4 *bp, int c) {
cmp = a == b;
cmp = a != b;
}
+
+void test8(float4 *ap, float4 *bp, int c) {
+ float4 a = *ap;
+ float4 b = *bp;
+
+ // Vector comparisons.
+ int4 cmp;
+ cmp = a < b;
+ cmp = a <= b;
+ cmp = a < b;
+ cmp = a >= b;
+ cmp = a == b;
+ cmp = a != b;
+}
OpenPOWER on IntegriCloud