forked from OSchip/llvm-project
Make vectorized floating-point comparisons work without crashing.
llvm-svn: 76726
This commit is contained in:
parent
2e1d66847c
commit
5ac69057c0
|
@ -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()) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue