Make vectorized floating-point comparisons work without crashing.

llvm-svn: 76726
This commit is contained in:
Eli Friedman 2009-07-22 06:07:16 +00:00
parent 2e1d66847c
commit 5ac69057c0
2 changed files with 15 additions and 1 deletions

View File

@ -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()) {

View File

@ -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;
}