[cfe-commits] r54048 - /cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Nate Begeman
natebegeman at mac.com
Fri Jul 25 13:16:05 PDT 2008
Author: sampo
Date: Fri Jul 25 15:16:05 2008
New Revision: 54048
URL: http://llvm.org/viewvc/llvm-project?rev=54048&view=rev
Log:
Generate vector compares in codegen
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=54048&r1=54047&r2=54048&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri Jul 25 15:16:05 2008
@@ -911,12 +911,12 @@
unsigned SICmpOpc, unsigned FCmpOpc) {
Value *Result;
QualType LHSTy = E->getLHS()->getType();
- if (!LHSTy->isAnyComplexType()) {
+ if (!LHSTy->isAnyComplexType() && !LHSTy->isVectorType()) {
Value *LHS = Visit(E->getLHS());
Value *RHS = Visit(E->getRHS());
if (LHS->getType()->isFloatingPoint()) {
- Result = Builder.CreateFCmp((llvm::FCmpInst::Predicate)FCmpOpc,
+ Result = Builder.CreateFCmp((llvm::CmpInst::Predicate)FCmpOpc,
LHS, RHS, "cmp");
} else if (LHSTy->isSignedIntegerType()) {
Result = Builder.CreateICmp((llvm::ICmpInst::Predicate)SICmpOpc,
@@ -926,6 +926,22 @@
Result = Builder.CreateICmp((llvm::ICmpInst::Predicate)UICmpOpc,
LHS, RHS, "cmp");
}
+ } else if (LHSTy->isVectorType()) {
+ Value *LHS = Visit(E->getLHS());
+ Value *RHS = Visit(E->getRHS());
+
+ if (LHS->getType()->isFPOrFPVector()) {
+ Result = Builder.CreateVFCmp((llvm::CmpInst::Predicate)FCmpOpc,
+ LHS, RHS, "cmp");
+ } else if (LHSTy->isUnsignedIntegerType()) {
+ Result = Builder.CreateVICmp((llvm::CmpInst::Predicate)UICmpOpc,
+ LHS, RHS, "cmp");
+ } else {
+ // Signed integers and pointers.
+ Result = Builder.CreateVICmp((llvm::CmpInst::Predicate)SICmpOpc,
+ LHS, RHS, "cmp");
+ }
+ return Result;
} else {
// Complex Comparison: can only be an equality comparison.
CodeGenFunction::ComplexPairTy LHS = CGF.EmitComplexExpr(E->getLHS());
More information about the cfe-commits
mailing list