[llvm-commits] [dragonegg] r141669 - in /dragonegg/trunk: include/dragonegg/Internals.h src/Convert.cpp
Duncan Sands
baldrick at free.fr
Tue Oct 11 08:29:20 PDT 2011
Author: baldrick
Date: Tue Oct 11 10:29:20 2011
New Revision: 141669
URL: http://llvm.org/viewvc/llvm-project?rev=141669&view=rev
Log:
Add support for scalar widening multiplies. Codegen does a good
job on these. While there, fix some sign tests that were checking
the vector type rather than the vector element type.
Modified:
dragonegg/trunk/include/dragonegg/Internals.h
dragonegg/trunk/src/Convert.cpp
Modified: dragonegg/trunk/include/dragonegg/Internals.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Internals.h?rev=141669&r1=141668&r2=141669&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Internals.h (original)
+++ dragonegg/trunk/include/dragonegg/Internals.h Tue Oct 11 10:29:20 2011
@@ -589,6 +589,8 @@
tree_node *op1);
Value *EmitReg_VEC_WIDEN_MULT_LO_EXPR(tree_node *type, tree_node *op0,
tree_node *op1);
+ Value *EmitReg_WIDEN_MULT_EXPR(tree_node *type, tree_node *op0,
+ tree_node *op1);
Value *EmitLoadOfLValue(tree_node *exp);
Value *EmitOBJ_TYPE_REF(tree_node *exp);
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=141669&r1=141668&r2=141669&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Tue Oct 11 10:29:20 2011
@@ -6952,9 +6952,9 @@
// -> <2 x float>.
unsigned Length = TYPE_VECTOR_SUBPARTS(TREE_TYPE(op0));
Type *DestTy = VectorType::get(getRegType(TREE_TYPE(type)), Length);
- LHS = CastToAnyType(LHS, !TYPE_UNSIGNED(TREE_TYPE(op0)), DestTy,
+ LHS = CastToAnyType(LHS, !TYPE_UNSIGNED(TREE_TYPE(TREE_TYPE(op0))), DestTy,
!TYPE_UNSIGNED(TREE_TYPE(type)));
- RHS = CastToAnyType(RHS, !TYPE_UNSIGNED(TREE_TYPE(op0)), DestTy,
+ RHS = CastToAnyType(RHS, !TYPE_UNSIGNED(TREE_TYPE(TREE_TYPE(op0))), DestTy,
!TYPE_UNSIGNED(TREE_TYPE(type)));
// Concatenate the truncated inputs into one vector of twice the length,
@@ -6976,7 +6976,7 @@
// Extend the input elements to the output element type, eg: <2 x float>
// -> <2 x double>.
Type *DestTy = getRegType(type);
- return CastToAnyType(Op, !TYPE_UNSIGNED(TREE_TYPE(op0)), DestTy,
+ return CastToAnyType(Op, !TYPE_UNSIGNED(TREE_TYPE(TREE_TYPE(op0))), DestTy,
!TYPE_UNSIGNED(TREE_TYPE(type)));
}
@@ -6990,7 +6990,7 @@
// Extend the input elements to the output element type, eg: <2 x float>
// -> <2 x double>.
Type *DestTy = getRegType(type);
- return CastToAnyType(Op, !TYPE_UNSIGNED(TREE_TYPE(op0)), DestTy,
+ return CastToAnyType(Op, !TYPE_UNSIGNED(TREE_TYPE(TREE_TYPE(op0))), DestTy,
!TYPE_UNSIGNED(TREE_TYPE(type)));
}
@@ -7008,6 +7008,17 @@
return Builder.CreateMul(Lo0, Lo1);
}
+Value *TreeToLLVM::EmitReg_WIDEN_MULT_EXPR(tree type, tree op0, tree op1) {
+ Value *LHS = EmitRegister(op0);
+ Value *RHS = EmitRegister(op1);
+ Type *DestTy = getRegType(type);
+ LHS = CastToAnyType(LHS, !TYPE_UNSIGNED(TREE_TYPE(op0)), DestTy,
+ !TYPE_UNSIGNED(type));
+ RHS = CastToAnyType(RHS, !TYPE_UNSIGNED(TREE_TYPE(op0)), DestTy,
+ !TYPE_UNSIGNED(type));
+ return Builder.CreateMul(LHS, RHS);
+}
+
//===----------------------------------------------------------------------===//
// ... Exception Handling ...
@@ -8002,6 +8013,8 @@
RHS = EmitReg_VEC_WIDEN_MULT_HI_EXPR(type, rhs1, rhs2); break;
case VEC_WIDEN_MULT_LO_EXPR:
RHS = EmitReg_VEC_WIDEN_MULT_LO_EXPR(type, rhs1, rhs2); break;
+ case WIDEN_MULT_EXPR:
+ RHS = EmitReg_WIDEN_MULT_EXPR(type, rhs1, rhs2); break;
}
return TriviallyTypeConvert(RHS, getRegType(type));
More information about the llvm-commits
mailing list