[llvm-commits] CVS: llvm/docs/LangRef.html

2007-04-01 Thread Reid Spencer


Changes in directory llvm/docs:

LangRef.html updated: 1.219 -> 1.220
---
Log message:

For PR1297: http://llvm.org/PR1297 :
Document changes to bswap and bit counting intrinsics. bswap's name now
requires two types in the suffix per overloaded intrinsic naming rules.
The ctpop, cttz, and ctlz intrinsics were changed to always return i32.


---
Diffs of the changes:  (+50 -25)

 LangRef.html |   75 +++
 1 files changed, 50 insertions(+), 25 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.219 llvm/docs/LangRef.html:1.220
--- llvm/docs/LangRef.html:1.219Fri Mar 30 11:09:58 2007
+++ llvm/docs/LangRef.html  Sun Apr  1 03:04:23 2007
@@ -3580,10 +3580,10 @@
 
 
 LLVM supports the notion of an "intrinsic function".  These functions have
-well known names and semantics and are required to follow certain
-restrictions. Overall, these instructions represent an extension mechanism for
-the LLVM language that does not require changing all of the transformations in
-LLVM to add to the language (or the bytecode reader/writer, the parser,
+well known names and semantics and are required to follow certain restrictions.
+Overall, these intrinsics represent an extension mechanism for the LLVM 
+language that does not require changing all of the transformations in LLVM to 
+add to the language (or the bytecode reader/writer, the parser,
 etc...).
 
 Intrinsic function names must all start with an "llvm." prefix. 
This
@@ -3594,9 +3594,20 @@
 function.  Additionally, because intrinsic functions are part of the LLVM
 language, it is required that they all be documented here if any are added.
 
+Some intrinsic functions can be overloaded. That is, the intrinsic 
represents
+a family of functions that perform the same operation but on different data
+types. This is most frequent with the integer types. Since LLVM can represent
+over 8 million different integer types, there is a way to declare an intrinsic 
+that can be overloaded based on its arguments. Such intrinsics will have the
+names of the arbitrary types encoded into the intrinsic function name, each
+preceded by a period. For example, the llvm.ctpop function can take an
+integer of any width. This leads to a family of functions such as 
+i32 @llvm.ctpop.i8(i8 %val) and i32 @llvm.ctpop.i29(i29 
%val).
+
+
 
-To learn how to add an intrinsic function, please see the Extending LLVM Guide.
+To learn how to add an intrinsic function, please see the 
+Extending LLVM Guide.
 
 
 
@@ -4421,29 +4432,34 @@
 
 
 Syntax:
+This is an overloaded intrinsic function. You can use bswap on any integer
+type that is an even number of bytes (i.e. BitWidth % 16 == 0). Note the suffix
+that includes the type for the result and the operand.
 
-  declare i16 @llvm.bswap.i16(i16 )
-  declare i32 @llvm.bswap.i32(i32 )
-  declare i64 @llvm.bswap.i64(i64 )
+  declare i16 @llvm.bswap.i16.i16(i16 )
+  declare i32 @llvm.bswap.i32.i32(i32 )
+  declare i64 @llvm.bswap.i64.i32(i64 )
 
 
 Overview:
 
 
-The 'llvm.bwsap' family of intrinsics is used to byteswap a 16, 32 or
-64 bit quantity.  These are useful for performing operations on data that is 
not
-in the target's  native byte order.
+The 'llvm.bwsap' family of intrinsics is used to byteswap integer 
+values with an even number of bytes (positive multiple of 16 bits).  These are 
+useful for performing operations on data that is not in the target's native 
+byte order.
 
 
 Semantics:
 
 
-The llvm.bswap.16 intrinsic returns an i16 value that has the high 
+The llvm.bswap.16.i16 intrinsic returns an i16 value that has the 
high 
 and low byte of the input i16 swapped.  Similarly, the llvm.bswap.i32 
 intrinsic returns an i32 value that has the four bytes of the input i32 
 swapped, so that if the input bytes are numbered 0, 1, 2, 3 then the returned 
-i32 will have its bytes in 3, 2, 1, 0 order.  The llvm.bswap.i64 
-intrinsic extends this concept to 64 bits.
+i32 will have its bytes in 3, 2, 1, 0 order.  The llvm.bswap.i48.i48, 
+llvm.bswap.i64.i64 and other intrinsics extend this concept to
+additional even-byte lengths (6 bytes, 8 bytes and more, respectively).
 
 
 
@@ -4456,11 +4472,14 @@
 
 
 Syntax:
+This is an overloaded intrinsic. You can use llvm.ctpop on any integer bit
+width. Not all targets support all bit widths however.
 
-  declare i8  @llvm.ctpop.i8 (i8  )
-  declare i16 @llvm.ctpop.i16(i16 )
+  declare i32 @llvm.ctpop.i8 (i8  )
+  declare i32 @llvm.ctpop.i16(i16 )
   declare i32 @llvm.ctpop.i32(i32 )
-  declare i64 @llvm.ctpop.i64(i64 )
+  declare i32 @llvm.ctpop.i64(i64 )
+  declare i32 @llvm.ctpop.i256(i256 )
 
 
 Overview:
@@ -4492,11 +4511,14 @@
 
 
 Syntax:
+This is an overloaded intrinsic. You can use llvm.ctlz on any 
+integer bit width. Not all targets support all bit widths however.
 
-  declare i8  @llvm.ctlz.i8 (i8  )
-  declare i16 @llvm.ctlz.i16(i16 <

[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp

2007-04-01 Thread Evan Cheng


Changes in directory llvm/lib/Target/ARM:

ARMISelLowering.cpp updated: 1.33 -> 1.34
---
Log message:

Add i16 address mode.

---
Diffs of the changes:  (+7 -2)

 ARMISelLowering.cpp |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/ARM/ARMISelLowering.cpp
diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.33 
llvm/lib/Target/ARM/ARMISelLowering.cpp:1.34
--- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.33Fri Mar 30 18:15:24 2007
+++ llvm/lib/Target/ARM/ARMISelLowering.cpp Sun Apr  1 03:06:46 2007
@@ -1300,19 +1300,24 @@
   return false;
 
   default:
-// FIXME: verify.
 switch (getValueType(Ty)) {
 default: return false;
 case MVT::i1:
 case MVT::i8:
-// TODO: i16?  i64 should be i32, no?
 case MVT::i32:
+case MVT::i64:
+  // This assumes i64 is legalized to a pair of i32. If not (i.e.
+  // ldrd / strd are used, then its address mode is same as i16.
   // r + r
   if (AM.Scale == 2)
 return true;
   // r + r << imm
   if (!isPowerOf2_32(AM.Scale & ~1))
 return false;
+case MVT::i16:
+  // r + r
+  if (((unsigned)AM.HasBaseReg + AM.Scale) <= 2)
+return true;
 }
 break;
   }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/docs/LangRef.html

2007-04-01 Thread Reid Spencer


Changes in directory llvm/docs:

LangRef.html updated: 1.220 -> 1.221
---
Log message:

For PR1297: http://llvm.org/PR1297 :
Preview documentation for the llvm.bit.concat intrinsic (yet to be 
implemented).


---
Diffs of the changes:  (+47 -1)

 LangRef.html |   48 +++-
 1 files changed, 47 insertions(+), 1 deletion(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.220 llvm/docs/LangRef.html:1.221
--- llvm/docs/LangRef.html:1.220Sun Apr  1 03:04:23 2007
+++ llvm/docs/LangRef.html  Sun Apr  1 03:27:01 2007
@@ -4587,6 +4587,52 @@
 
 
 
+
+
+  'llvm.bit.concat.*' Intrinsic
+
+
+
+
+Syntax:
+This is an overloaded intrinsic. You can use llvm.bit.concat on 
any 
+integer bit width.
+
+  declare i32 @llvm.bit.concat.i32.i17.i15 (i17 %hi, i15 %lo)
+  declare i29 @llvm.bit.concat.i29(i16 %lo, i13 %lo)
+
+
+Overview:
+
+The 'llvm.bit.concat' family of intrinsic functions concatenates two
+integer values to produce a longer one.
+
+
+Arguments:
+
+
+The two arguments may be any bit width. The result must be an integer whose bit
+width is the sum of the arguments' bit widths. The first argument represents 
the
+bits that will occupy the high order bit locations in the concatenated result.
+THe second argument will occupy the lower order bit locations in the result.
+
+
+Semantics:
+
+
+The 'llvm.bit.concat' intrinsic is the equivalent of two zext
+instructions, a shl and an or. This sequence can be
+implemented in hardware so this intrinsic assists with recognizing the sequence
+for code generation purposes.  The operation proceeds as follows:
+
+  Each of the arguments is zext'd to the result bit width.
+  The %hi argument is shift left by the width of the %lo
+  argument (shifted into to high order bits).
+  The shifted %hi value and %lo are or'd 
together
+  to form the result.
+
+
+
 
 
   Debugger Intrinsics
@@ -4625,7 +4671,7 @@
 
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/04/01 08:04:23 $
+  Last modified: $Date: 2007/04/01 08:27:01 $
 
 
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] Patch for llvm-gcc for PR1297 (please apply)

2007-04-01 Thread Reid Spencer
Hi,

Please apply the attached patch to llvm-gcc. This is needed to make
llvm-gcc generate overloaded intrinsic functions correctly. This is part
of the PR1297 work.

Thanks,

Reid.
Index: gcc/llvm-convert.cpp
===
--- gcc/llvm-convert.cpp	(revision 299)
+++ gcc/llvm-convert.cpp	(working copy)
@@ -2754,9 +2754,9 @@
   Value *RetVal = RHS;
   RHS = CastToAnyType(RHS, Op1Signed, OldVal->getType(), Op0Signed);
   if (LV.BitStart)
-RHS = BinaryOperator::createShl(RHS,
-ConstantInt::get(RHS->getType(), LV.BitStart),
-"tmp", CurBB);
+RHS = BinaryOperator::createShl(RHS, ConstantInt::get(RHS->getType(), 
+LV.BitStart), "tmp", CurBB);
+
   // Next, if this doesn't touch the top bit, mask out any bits that shouldn't
   // be set in the result.
   uint64_t MaskVal = ((1ULL << LV.BitSize)-1) << LV.BitStart;
@@ -3915,11 +3915,6 @@
   case BUILT_IN_STACK_SAVE: return EmitBuiltinStackSave(exp, Result);
   case BUILT_IN_STACK_RESTORE:  return EmitBuiltinStackRestore(exp);
 
-#define HANDLE_UNARY_INT(I8, I16, I32, I64, V) \
-  EmitBuiltinUnaryIntOp(V, Result, \
-Intrinsic::I8, Intrinsic::I16, \
-Intrinsic::I32, Intrinsic::I64)
-
 #define HANDLE_UNARY_FP(F32, F64, V) \
 Result = EmitBuiltinUnaryFPOp(V, Intrinsic::F32, Intrinsic::F64)
 
@@ -3930,24 +3925,21 @@
   case BUILT_IN_CLZL:
   case BUILT_IN_CLZLL: {
 Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
-HANDLE_UNARY_INT(ctlz_i8, ctlz_i16,
- ctlz_i32, ctlz_i64, Amt);
+EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::ctlz); 
 return true;
   }
   case BUILT_IN_CTZ:   // These GCC builtins always return int.
   case BUILT_IN_CTZL:
   case BUILT_IN_CTZLL: {
 Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
-HANDLE_UNARY_INT(cttz_i8, cttz_i16,
- cttz_i32, cttz_i64, Amt);
+EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::cttz); 
 return true;
   }
   case BUILT_IN_POPCOUNT:  // These GCC builtins always return int.
   case BUILT_IN_POPCOUNTL:
   case BUILT_IN_POPCOUNTLL: {
 Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
-HANDLE_UNARY_INT(ctpop_i8, ctpop_i16,
- ctpop_i32, ctpop_i64, Amt);
+EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::ctpop); 
 return true;
   }
   case BUILT_IN_SQRT: 
@@ -3972,8 +3964,7 @@
 // The argument and return type of cttz should match the argument type of
 // the ffs, but should ignore the return type of ffs.
 Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
-HANDLE_UNARY_INT(cttz_i8, cttz_i16,
- cttz_i32, cttz_i64, Amt);
+EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::cttz); 
 Result = BinaryOperator::createAdd(Result, 
ConstantInt::get(Type::Int32Ty, 1),
"tmp", CurBB);
@@ -3989,6 +3980,8 @@
 Result, "tmp", CurBB);
 return true;
   }
+
+
 #undef HANDLE_UNARY_INT
 #undef HANDLE_UNARY_FP
 
@@ -4032,27 +4025,15 @@
 }
 
 bool TreeToLLVM::EmitBuiltinUnaryIntOp(Value *InVal, Value *&Result,
-   Intrinsic::ID I8ID, Intrinsic::ID I16ID,
-   Intrinsic::ID I32ID,
-   Intrinsic::ID I64ID) {
-  Intrinsic::ID Id = Intrinsic::not_intrinsic;
-  const IntegerType *ITy = cast(InVal->getType());
-
-  switch (ITy->getBitWidth()) {
-  default: assert(0 && "Unknown Integer type!");
-  case 8 : Id = I8ID;  break;
-  case 16: Id = I16ID; break;
-  case 32: Id = I32ID; break;
-  case 64: Id = I64ID; break;
-  }
+   Intrinsic::ID Id) {
+  const Type *Ty = InVal->getType();
   
-  Result = new CallInst(Intrinsic::getDeclaration(TheModule, Id),
+  const Type* Tys[2];
+  Tys[0] = 0;  // Result type is i32, not variable, signal so.
+  Tys[1] = Ty; // Parameter type is iAny so actual type must be specified here
+  Result = new CallInst(Intrinsic::getDeclaration(TheModule, Id, Tys, 2),
 InVal, "tmp", CurBB);
   
-  // The LLVM intrinsics for these return the same type as their operands.  The
-  // GCC version of these functions always returns int.  Cast to int for GCC.
-  Result = CastToSIntType(Result, Type::Int32Ty);
-  
   return true;
 }
 
Index: gcc/llvm-internal.h
===
--- gcc/llvm-internal.h	(revision 299)
+++ gcc/llvm-internal.h	(working copy)
@@ -483,9 +483,7 @@
Value *DestLoc, Value *&Result);
   bool EmitFrontendExpandedBuiltinCall(tree_node *exp, tree_node *fndecl,
Value *DestLoc, Value *&Result);
-  bool EmitBuiltinUnaryIntOp(Value *InVal, Value *&Result,
- 

[llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h

2007-04-01 Thread Zhou Sheng


Changes in directory llvm/include/llvm/ADT:

APInt.h updated: 1.59 -> 1.60
---
Log message:

Remove unused methods.


---
Diffs of the changes:  (+0 -18)

 APInt.h |   18 --
 1 files changed, 18 deletions(-)


Index: llvm/include/llvm/ADT/APInt.h
diff -u llvm/include/llvm/ADT/APInt.h:1.59 llvm/include/llvm/ADT/APInt.h:1.60
--- llvm/include/llvm/ADT/APInt.h:1.59  Fri Mar 30 01:39:42 2007
+++ llvm/include/llvm/ADT/APInt.h   Sun Apr  1 07:45:33 2007
@@ -396,15 +396,6 @@
 return &pVal[0];
   }
 
-  /// @brief Set a sepcific word in the value to a new value.
-  inline void setWordToValue(uint32_t idx, uint64_t Val) {
-assert(idx < getNumWords() && "Invalid word array index");
-if (isSingleWord())
-  VAL = Val;
-else
-  pVal[idx] = Val;
-  }
-
   /// @}
   /// @name Unary Operators
   /// @{
@@ -743,15 +734,6 @@
   /// @brief Zero extend or truncate to width
   APInt &zextOrTrunc(uint32_t width);
 
-  /// This is a help function for convenience. If the given \p width equals to
-  /// this APInt's BitWidth, just return this APInt, otherwise, just zero 
-  /// extend it.
-  inline APInt &zextOrCopy(uint32_t width) {
-if (width == BitWidth)
-  return *this;
-return zext(width);
-  }
-
   /// @}
   /// @name Bit Manipulation Operators
   /// @{



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/CFrontend/2007-03-26-ZeroWidthBitfield.c

2007-04-01 Thread Duncan Sands


Changes in directory llvm/test/CFrontend:

2007-03-26-ZeroWidthBitfield.c added (r1.1)
---
Log message:

Testcase for the problem worked around in
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070319/046204.html


---
Diffs of the changes:  (+2 -0)

 2007-03-26-ZeroWidthBitfield.c |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/test/CFrontend/2007-03-26-ZeroWidthBitfield.c
diff -c /dev/null llvm/test/CFrontend/2007-03-26-ZeroWidthBitfield.c:1.1
*** /dev/null   Sun Apr  1 10:29:12 2007
--- llvm/test/CFrontend/2007-03-26-ZeroWidthBitfield.c  Sun Apr  1 10:29:02 2007
***
*** 0 
--- 1,2 
+ // RUN: %llvmgcc %s -S -o -
+ struct Z { int :0; } z;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

2007-04-01 Thread Zhou Sheng


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.716 -> 1.717
---
Log message:

Avoid unnecessary APInt construction.


---
Diffs of the changes:  (+17 -18)

 InstructionCombining.cpp |   35 +--
 1 files changed, 17 insertions(+), 18 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.716 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.717
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.716   Sun Apr  1 
02:35:23 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sun Apr  1 12:13:37 2007
@@ -1870,7 +1870,7 @@
 
 if (ConstantInt *CI = dyn_cast(RHSC)) {
   // X + (signbit) --> X ^ signbit
-  APInt Val(CI->getValue());
+  const APInt& Val = CI->getValue();
   unsigned BitWidth = Val.getBitWidth();
   if (Val == APInt::getSignBit(BitWidth))
 return BinaryOperator::createXor(LHS, RHS);
@@ -1894,7 +1894,7 @@
 if (isa(RHSC) &&
 match(LHS, m_Xor(m_Value(XorLHS), m_ConstantInt(XorRHS {
   unsigned TySizeBits = I.getType()->getPrimitiveSizeInBits();
-  APInt RHSVal(cast(RHSC)->getValue());
+  const APInt& RHSVal = cast(RHSC)->getValue();
   
   unsigned Size = TySizeBits / 2;
   APInt C0080Val(APInt(TySizeBits, 1ULL).shl(Size - 1));
@@ -1999,14 +1999,13 @@
   if (Anded == CRHS) {
 // See if all bits from the first bit set in the Add RHS up are 
included
 // in the mask.  First, get the rightmost bit.
-APInt AddRHSV(CRHS->getValue());
+const APInt& AddRHSV = CRHS->getValue();
 
 // Form a mask of all bits from the lowest bit added through the top.
-APInt AddRHSHighBits = ~((AddRHSV & -AddRHSV)-1);
-AddRHSHighBits &= C2->getType()->getMask();
+APInt AddRHSHighBits(~((AddRHSV & -AddRHSV)-1));
 
 // See if the and mask includes all of these bits.
-APInt AddRHSHighBitsAnd = AddRHSHighBits & C2->getValue();
+APInt AddRHSHighBitsAnd(AddRHSHighBits & C2->getValue());
 
 if (AddRHSHighBits == AddRHSHighBitsAnd) {
   // Okay, the xform is safe.  Insert the new add pronto.
@@ -2451,7 +2450,7 @@
   if (BinaryOperator *RHSI = dyn_cast(I.getOperand(1))) {
 if (RHSI->getOpcode() == Instruction::Shl &&
 isa(RHSI->getOperand(0))) {
-  APInt C1(cast(RHSI->getOperand(0))->getValue());
+  const APInt& C1 = cast(RHSI->getOperand(0))->getValue();
   if (C1.isPowerOf2()) {
 Value *N = RHSI->getOperand(1);
 const Type *NTy = N->getType();
@@ -2469,7 +2468,7 @@
   if (SelectInst *SI = dyn_cast(Op1)) 
 if (ConstantInt *STO = dyn_cast(SI->getOperand(1)))
   if (ConstantInt *SFO = dyn_cast(SI->getOperand(2)))  {
-APInt TVA(STO->getValue()), FVA(SFO->getValue());
+const APInt &TVA = STO->getValue(), &FVA = SFO->getValue();
 if (TVA.isPowerOf2() && FVA.isPowerOf2()) {
   // Compute the shift amounts
   uint32_t TSA = TVA.logBase2(), FSA = FVA.logBase2();
@@ -2934,14 +2933,14 @@
   // Adding a one to a single bit bit-field should be turned into an XOR
   // of the bit.  First thing to check is to see if this AND is with a
   // single bit constant.
-  APInt AndRHSV(cast(AndRHS)->getValue());
+  const APInt& AndRHSV = cast(AndRHS)->getValue();
 
   // If there is only one bit set...
   if (isOneBitSet(cast(AndRHS))) {
 // Ok, at this point, we know that we are masking the result of the
 // ADD down to exactly one bit.  If the constant we are adding has
 // no bits set below this bit, then we can eliminate the ADD.
-APInt AddRHS(cast(OpRHS)->getValue());
+const APInt& AddRHS = cast(OpRHS)->getValue();
 
 // Check to see if any bits below the one bit set in AndRHSV are set.
 if ((AddRHS & (AndRHSV-1)) == 0) {
@@ -3083,7 +3082,7 @@
 // MSB, so 0x000FFF0, 0x, and 0xFFFF are all runs.  0x0F0F is
 // not, since all 1s are not contiguous.
 static bool isRunOfOnes(ConstantInt *Val, unsigned &MB, unsigned &ME) {
-  APInt V = Val->getValue();
+  const APInt& V = Val->getValue();
   uint32_t BitWidth = Val->getType()->getBitWidth();
   if (!APIntOps::isShiftedMask(BitWidth, V)) return false;
 
@@ -3180,9 +3179,8 @@
   }
   
   if (ConstantInt *AndRHS = dyn_cast(Op1)) {
-APInt AndRHSMask(AndRHS->getValue());
-APInt TypeMask(cast(Op0->getType())->getMask());
-APInt NotAndRHS = AndRHSMask^TypeMask;
+const APInt& AndRHSMask = AndRHS->getValue();
+APInt NotAndRHS(~AndRHSMask);
 
 // Optimize a variety of ((val OP C1) & C2) combinations...
 if (isa(Op0)) {
@@ -4675,7 +4673,8 @@
 if ((KnownOne | KnownZero) != 0) {
   // Compute the Min, Max and RHS values based on the known bits. For the
   // EQ and NE we use unsigned values.
-  APInt Min(BitWidth, 0), Max(BitWidth, 0), RHSVal(CI->

[llvm-commits] CVS: llvm-www/DevMtgMay2007.html

2007-04-01 Thread Reid Spencer


Changes in directory llvm-www:

DevMtgMay2007.html updated: 1.19 -> 1.20
---
Log message:

Add Owen's suggestions for Session 4 issues and discussion topics.


---
Diffs of the changes:  (+19 -1)

 DevMtgMay2007.html |   20 +++-
 1 files changed, 19 insertions(+), 1 deletion(-)


Index: llvm-www/DevMtgMay2007.html
diff -u llvm-www/DevMtgMay2007.html:1.19 llvm-www/DevMtgMay2007.html:1.20
--- llvm-www/DevMtgMay2007.html:1.19Sun Apr  1 02:38:26 2007
+++ llvm-www/DevMtgMay2007.html Sun Apr  1 13:20:25 2007
@@ -134,6 +134,24 @@
   from here? This session will consist of a 5 minute presentation by the issue 
   originator followed by 10 minutes of discussion. This will allow 6 issues to 
   be discussed in this time slot.
+
+  Suggested ByIssue or Discussion Topic
+  Owen AndersonIntegration of HLVM into LLVM - its 
+  future as an LLVM subproject, and plans for making LLVM more accessible 
+  to scripting and higher level language front ends.
+  Owen AndersonFuture development practices: with a
+  burgeoning number of clients and wider adoption, do we want more orgnized
+  development practices? i.e. release focuses or something?
+  Owen AndersonAdoption Goals: while our adoption has
+  increased greatly recently, we're still tiny compared to GCC. What are 
our
+  goals in this respect, adn how do we plan to address them? Do we
+  want to compete against GCC? Or, are we targeting a different
+  audience?
+  Owen AndersonProject Management: We have an oversight
+  group right now. Do we want more organization? Corporate interest have
+  given us some great things, but sometimes their secrecy makes things
+  difficult; should ther be an LLVM Foundation in our future?
+
 
 
 
@@ -211,6 +229,6 @@
   src="http://jigsaw.w3.org/css-validator/images/vcss"; alt="Valid CSS!">
   http://validator.w3.org/check/referer";>http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!">
-Last modified: $Date: 2007/04/01 07:38:26 $
+Last modified: $Date: 2007/04/01 18:20:25 $
 
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Analysis/ConstantFolding.cpp

2007-04-01 Thread Reid Spencer


Changes in directory llvm/lib/Analysis:

ConstantFolding.cpp updated: 1.21 -> 1.22
---
Log message:

The bit counting intrinsics return i32 not the operand type. This fixes
last night's regression in SingleSource/UnitTests/2005-05-11-Popcount-ffs-fls


---
Diffs of the changes:  (+3 -4)

 ConstantFolding.cpp |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)


Index: llvm/lib/Analysis/ConstantFolding.cpp
diff -u llvm/lib/Analysis/ConstantFolding.cpp:1.21 
llvm/lib/Analysis/ConstantFolding.cpp:1.22
--- llvm/lib/Analysis/ConstantFolding.cpp:1.21  Sun Apr  1 02:35:23 2007
+++ llvm/lib/Analysis/ConstantFolding.cpp   Sun Apr  1 13:42:20 2007
@@ -433,18 +433,17 @@
   break;
   }
 } else if (ConstantInt *Op = dyn_cast(Operands[0])) {
-  const IntegerType *OpTy = cast(Op->getType());
   if (Name.size() > 11 && !memcmp(&Name[0], "llvm.bswap", 10)) {
 return ConstantInt::get(Op->getValue().byteSwap());
   } else if (Name.size() > 11 && !memcmp(&Name[0],"llvm.ctpop",10)) {
 uint64_t ctpop = Op->getValue().countPopulation();
-return ConstantInt::get(OpTy, ctpop);
+return ConstantInt::get(Type::Int32Ty, ctpop);
   } else if (Name.size() > 10 && !memcmp(&Name[0], "llvm.cttz", 9)) {
 uint64_t cttz = Op->getValue().countTrailingZeros();
-return ConstantInt::get(OpTy, cttz);
+return ConstantInt::get(Type::Int32Ty, cttz);
   } else if (Name.size() > 10 && !memcmp(&Name[0], "llvm.ctlz", 9)) {
 uint64_t ctlz = Op->getValue().countLeadingZeros();
-return ConstantInt::get(OpTy, ctlz);
+return ConstantInt::get(Type::Int32Ty, ctlz);
   }
 }
   } else if (NumOperands == 2) {



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/win32/Transforms/Transforms.vcproj

2007-04-01 Thread Jeff Cohen


Changes in directory llvm/win32/Transforms:

Transforms.vcproj updated: 1.25 -> 1.26
---
Log message:

Unbreak VC++ build.

---
Diffs of the changes:  (+3 -0)

 Transforms.vcproj |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/win32/Transforms/Transforms.vcproj
diff -u llvm/win32/Transforms/Transforms.vcproj:1.25 
llvm/win32/Transforms/Transforms.vcproj:1.26
--- llvm/win32/Transforms/Transforms.vcproj:1.25Sun Mar  4 18:00:42 2007
+++ llvm/win32/Transforms/Transforms.vcproj Sun Apr  1 13:58:22 2007
@@ -204,6 +204,9 @@

RelativePath="..\..\lib\Transforms\Scalar\BasicBlockPlacement.cpp">


+   
+   

http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/docs/LangRef.html

2007-04-01 Thread Reid Spencer


Changes in directory llvm/docs:

LangRef.html updated: 1.221 -> 1.222
---
Log message:

Preview documentation for additional intrinsic functions.


---
Diffs of the changes:  (+343 -18)

 LangRef.html |  361 ---
 1 files changed, 343 insertions(+), 18 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.221 llvm/docs/LangRef.html:1.222
--- llvm/docs/LangRef.html:1.221Sun Apr  1 03:27:01 2007
+++ llvm/docs/LangRef.html  Sun Apr  1 14:00:37 2007
@@ -4589,41 +4589,289 @@
 
 
 
-  'llvm.bit.concat.*' Intrinsic
+  'llvm.bit.and.reduce.*' Intrinsic
 
 
 
+Syntax:
+This is an overloaded intrinsic. You can use llvm.bit.and.reduce on
+any integer bit width.
+
+  declare i1 @llvm.bit.and.reduce.i32(i32 %val)
+  declare i1 @llvm.bit.and.reduce.i97(i97 %val)
+
+Overview:
+The 'llvm.bit.and.reduce' family of intrinsic functions applies the
+AND operator bitwise to each bit in %val until it yields the result.
+
+
+Arguments:
+The argument may be any bit width. The result is always a 1-bit integer.
+
+Semantics:
+The 'llvm.bit.and.reduce' intrinsic is the equivalent of a test
+against -1. Only if all bits in %val are set will the result
+be 1, otherwise 0.
+
+
+
+
+  'llvm.bit.or.reduce.*' Intrinsic
+
 
+
 Syntax:
-This is an overloaded intrinsic. You can use llvm.bit.concat on 
any 
-integer bit width.
+This is an overloaded intrinsic. You can use llvm.bit.or.reduce on
+any integer bit width.
 
-  declare i32 @llvm.bit.concat.i32.i17.i15 (i17 %hi, i15 %lo)
-  declare i29 @llvm.bit.concat.i29(i16 %lo, i13 %lo)
+  declare i1 @llvm.bit.or.reduce.i32(i32 %val)
+  declare i1 @llvm.bit.or.reduce.i97(i97 %val)
 
+Overview:
+The 'llvm.bit.or.reduce' family of intrinsic functions applies the
+OR operator bitwise to each bit in %val until it yields the result.
+
+
+Arguments:
+The argument may be any bit width. The result is always a 1-bit integer.
 
+Semantics:
+The 'llvm.bit.or.reduce' intrinsic is the equivalent of a test
+against 0. Only if all bits in %val are clear will the result
+be 0, otherwise 1.
+
+
+
+
+  'llvm.bit.xor.reduce.*' Intrinsic
+
+
+
+Syntax:
+This is an overloaded intrinsic. You can use llvm.bit.xor.reduce on
+any integer bit width.
+
+  declare i1 @llvm.bit.xor.reduce.i32(i32 %val)
+  declare i1 @llvm.bit.xor.reduce.i97(i97 %val)
+
 Overview:
-
-The 'llvm.bit.concat' family of intrinsic functions concatenates two
-integer values to produce a longer one.
+The 'llvm.bit.xor.reduce' family of intrinsic functions applies the
+XOR operator bitwise to each bit in %val until it yields the result.
 
 
 Arguments:
+The argument may be any bit width. The result is always a 1-bit integer.
 
-
-The two arguments may be any bit width. The result must be an integer whose bit
-width is the sum of the arguments' bit widths. The first argument represents 
the
-bits that will occupy the high order bit locations in the concatenated result.
-THe second argument will occupy the lower order bit locations in the result.
+Semantics:
+The 'llvm.bit.xor.reduce' computes its result by performing an XOR
+operation on the two lowest order bits in %val. That result is then
+XOR'd with the next bit in %val and this process continues until all
+bits in %val have been XOR'd with the result of the previous XORs. The
+resulting bit is returned.
+
+
+
+
+  'llvm.bit.nand.reduce.*' Intrinsic
+
+
+
+Syntax:
+This is an overloaded intrinsic. You can use llvm.bit.nand.reduce 
on
+any integer bit width.
+
+  declare i1 @llvm.bit.nand.reduce.i32(i32 %val)
+  declare i1 @llvm.bit.nand.reduce.i97(i97 %val)
+
+Overview:
+The 'llvm.bit.nand.reduce' family of intrinsic functions applies 
the
+NAND operator bitwise to each bit in %val until it yields the result.
 
 
+Arguments:
+The argument may be any bit width. The result is always a 1-bit integer.
+
 Semantics:
+The 'llvm.bit.nand.reduce' intrinsic is the equivalent of taking 
the
+complement of the llvm.bit.and.reduce intrinsic. That is, it returns 0
+if %val is all ones (-1) and 1 otherwise.
+
+
+
+
+  'llvm.bit.nor.reduce.*' Intrinsic
+
+
+
+Syntax:
+This is an overloaded intrinsic. You can use llvm.bit.nor.reduce on
+any integer bit width.
+
+  declare i1 @llvm.bit.nor.reduce.i32(i32 %val)
+  declare i1 @llvm.bit.nor.reduce.i97(i97 %val)
+
+Overview:
+The 'llvm.bit.nor.reduce' family of intrinsic functions applies the
+NOR operator bitwise to each bit in %val until it yields the result.
+
+
+Arguments:
+The argument may be any bit width. The result is always a 1-bit integer.
+
+Semantics:
+The 'llvm.bit.nor.reduce' intrinsic is equivalent to the complement
+of the llvm.bit.or.reduce intrinsic. That is, it returns 1 if all bits
+in %val are 0, and 1 otherwise.
+
+
+
+
+  'llvm.bit.nxor.reduce.*' Intrinsic
+
+
+
+Syntax:
+This is an overloaded intrinsic. You can use llvm.bit.nxor.reduce 
on
+any integer bit width.
+
+  declare i1 @llvm.bit.nxor.reduce.i32(i32 %val)
+  declare i1 @llvm.bit.nxor.reduce.i97

[llvm-commits] CVS: llvm/docs/GettingStarted.html

2007-04-01 Thread Chris Lattner


Changes in directory llvm/docs:

GettingStarted.html updated: 1.156 -> 1.157
---
Log message:

gcc 3.4.4 is known-bad on x86-64


---
Diffs of the changes:  (+3 -1)

 GettingStarted.html |4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/docs/GettingStarted.html
diff -u llvm/docs/GettingStarted.html:1.156 llvm/docs/GettingStarted.html:1.157
--- llvm/docs/GettingStarted.html:1.156 Tue Mar  6 00:27:34 2007
+++ llvm/docs/GettingStarted.html   Sun Apr  1 15:14:46 2007
@@ -525,6 +525,8 @@
possibly others) does not compile LLVM correctly (it appears that exception 
handling is broken in some cases).  Please download the FSF 3.3.3 or upgrade
to a newer version of GCC.
+GCC 3.4.x on X86-64/amd64: GCC http://llvm.org/PR1056";>
+   miscompiles portions of LLVM.
 IA-64 GCC 4.0.0: The IA-64 version of GCC 4.0.0 is known to
miscompile LLVM.
 Apple Xcode 2.3: GCC crashes when compiling LLVM at -O3 (which is the
@@ -1611,7 +1613,7 @@
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.x10sys.com/rspencer/";>Reid Spencer
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/03/06 06:27:34 $
+  Last modified: $Date: 2007/04/01 20:14:46 $
 
 
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [125595] Apply reid's patch for PR1297

2007-04-01 Thread clattner
Revision: 125595
Author:   clattner
Date: 2007-04-01 13:30:32 -0700 (Sun, 01 Apr 2007)

Log Message:
---
Apply reid's patch for PR1297

Modified Paths:
--
apple-local/branches/llvm/gcc/llvm-convert.cpp
apple-local/branches/llvm/gcc/llvm-internal.h

Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===
--- apple-local/branches/llvm/gcc/llvm-convert.cpp  2007-04-01 11:23:54 UTC 
(rev 125594)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp  2007-04-01 20:30:32 UTC 
(rev 125595)
@@ -2754,9 +2754,9 @@
   Value *RetVal = RHS;
   RHS = CastToAnyType(RHS, Op1Signed, OldVal->getType(), Op0Signed);
   if (LV.BitStart)
-RHS = BinaryOperator::createShl(RHS,
-ConstantInt::get(RHS->getType(), LV.BitStart),
-"tmp", CurBB);
+RHS = BinaryOperator::createShl(RHS, ConstantInt::get(RHS->getType(), 
+LV.BitStart), "tmp", CurBB);
+
   // Next, if this doesn't touch the top bit, mask out any bits that shouldn't
   // be set in the result.
   uint64_t MaskVal = ((1ULL << LV.BitSize)-1) << LV.BitStart;
@@ -3915,11 +3915,6 @@
   case BUILT_IN_STACK_SAVE: return EmitBuiltinStackSave(exp, Result);
   case BUILT_IN_STACK_RESTORE:  return EmitBuiltinStackRestore(exp);
 
-#define HANDLE_UNARY_INT(I8, I16, I32, I64, V) \
-  EmitBuiltinUnaryIntOp(V, Result, \
-Intrinsic::I8, Intrinsic::I16, \
-Intrinsic::I32, Intrinsic::I64)
-
 #define HANDLE_UNARY_FP(F32, F64, V) \
 Result = EmitBuiltinUnaryFPOp(V, Intrinsic::F32, Intrinsic::F64)
 
@@ -3930,24 +3925,21 @@
   case BUILT_IN_CLZL:
   case BUILT_IN_CLZLL: {
 Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
-HANDLE_UNARY_INT(ctlz_i8, ctlz_i16,
- ctlz_i32, ctlz_i64, Amt);
+EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::ctlz); 
 return true;
   }
   case BUILT_IN_CTZ:   // These GCC builtins always return int.
   case BUILT_IN_CTZL:
   case BUILT_IN_CTZLL: {
 Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
-HANDLE_UNARY_INT(cttz_i8, cttz_i16,
- cttz_i32, cttz_i64, Amt);
+EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::cttz); 
 return true;
   }
   case BUILT_IN_POPCOUNT:  // These GCC builtins always return int.
   case BUILT_IN_POPCOUNTL:
   case BUILT_IN_POPCOUNTLL: {
 Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
-HANDLE_UNARY_INT(ctpop_i8, ctpop_i16,
- ctpop_i32, ctpop_i64, Amt);
+EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::ctpop); 
 return true;
   }
   case BUILT_IN_SQRT: 
@@ -3972,8 +3964,7 @@
 // The argument and return type of cttz should match the argument type of
 // the ffs, but should ignore the return type of ffs.
 Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
-HANDLE_UNARY_INT(cttz_i8, cttz_i16,
- cttz_i32, cttz_i64, Amt);
+EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::cttz); 
 Result = BinaryOperator::createAdd(Result, 
ConstantInt::get(Type::Int32Ty, 1),
"tmp", CurBB);
@@ -3989,6 +3980,8 @@
 Result, "tmp", CurBB);
 return true;
   }
+
+
 #undef HANDLE_UNARY_INT
 #undef HANDLE_UNARY_FP
 
@@ -4032,27 +4025,15 @@
 }
 
 bool TreeToLLVM::EmitBuiltinUnaryIntOp(Value *InVal, Value *&Result,
-   Intrinsic::ID I8ID, Intrinsic::ID I16ID,
-   Intrinsic::ID I32ID,
-   Intrinsic::ID I64ID) {
-  Intrinsic::ID Id = Intrinsic::not_intrinsic;
-  const IntegerType *ITy = cast(InVal->getType());
-
-  switch (ITy->getBitWidth()) {
-  default: assert(0 && "Unknown Integer type!");
-  case 8 : Id = I8ID;  break;
-  case 16: Id = I16ID; break;
-  case 32: Id = I32ID; break;
-  case 64: Id = I64ID; break;
-  }
+   Intrinsic::ID Id) {
+  const Type *Ty = InVal->getType();
   
-  Result = new CallInst(Intrinsic::getDeclaration(TheModule, Id),
+  const Type* Tys[2];
+  Tys[0] = 0;  // Result type is i32, not variable, signal so.
+  Tys[1] = Ty; // Parameter type is iAny so actual type must be specified here
+  Result = new CallInst(Intrinsic::getDeclaration(TheModule, Id, Tys, 2),
 InVal, "tmp", CurBB);
   
-  // The LLVM intrinsics for these return the same type as their operands.  The
-  // GCC version of these functions always returns int.  Cast to int for GCC.
-  Result = CastToSIntType(Result, Type::Int32Ty);
-  
   return true;
 }
 

Modified: apple-local/branches/llvm/gcc/llvm-internal.h
===
--- apple-local/branches/llvm/gcc/llvm-internal.h   2007-04-01 11:23:54 UTC 
(rev 125594)
+++ apple-loc

[llvm-commits] [125596] remove dead #undef

2007-04-01 Thread clattner
Revision: 125596
Author:   clattner
Date: 2007-04-01 13:33:33 -0700 (Sun, 01 Apr 2007)

Log Message:
---
remove dead #undef

Modified Paths:
--
apple-local/branches/llvm/gcc/llvm-convert.cpp

Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===
--- apple-local/branches/llvm/gcc/llvm-convert.cpp  2007-04-01 20:30:32 UTC 
(rev 125595)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp  2007-04-01 20:33:33 UTC 
(rev 125596)
@@ -3982,7 +3982,6 @@
   }
 
 
-#undef HANDLE_UNARY_INT
 #undef HANDLE_UNARY_FP
 
 #if 1  // FIXME: Should handle these GCC extensions eventually.


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/X86/X86TargetAsmInfo.cpp

2007-04-01 Thread Chris Lattner


Changes in directory llvm/lib/Target/X86:

X86TargetAsmInfo.cpp updated: 1.34 -> 1.35
---
Log message:

fix breakage from last night, simplify code.


---
Diffs of the changes:  (+6 -15)

 X86TargetAsmInfo.cpp |   21 ++---
 1 files changed, 6 insertions(+), 15 deletions(-)


Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.34 
llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.35
--- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.34   Wed Mar  7 19:07:07 2007
+++ llvm/lib/Target/X86/X86TargetAsmInfo.cppSun Apr  1 15:49:36 2007
@@ -17,6 +17,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/InlineAsm.h"
 #include "llvm/Instructions.h"
+#include "llvm/Intrinsics.h"
 #include "llvm/Module.h"
 #include "llvm/ADT/StringExtras.h"
 using namespace llvm;
@@ -199,24 +200,14 @@
   !CI->getType()->isInteger())
 return false;
   
-  const Type *Ty = CI->getType();
-  const char *IntName;
-  if (const IntegerType *ITy = dyn_cast(Ty)) {
-unsigned BitWidth = ITy->getBitWidth();
-if (BitWidth == 16)
-  IntName = "llvm.bswap.i16";
-else if (BitWidth == 32)
-  IntName = "llvm.bswap.i32";
-else if (BitWidth == 64)
-  IntName = "llvm.bswap.i64";
-else
-  return false;
-  } else
+  const IntegerType *Ty = dyn_cast(CI->getType());
+  if (!Ty || Ty->getBitWidth() % 16 != 0)
 return false;
-
+  
   // Okay, we can do this xform, do so now.
+  const Type *Tys[] = { Ty, Ty };
   Module *M = CI->getParent()->getParent()->getParent();
-  Constant *Int = M->getOrInsertFunction(IntName, Ty, Ty, (Type*)0);
+  Constant *Int = Intrinsic::getDeclaration(M, Intrinsic::bswap, Tys, 2);
   
   Value *Op = CI->getOperand(1);
   Op = new CallInst(Int, Op, CI->getName(), CI);



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/docs/LangRef.html

2007-04-01 Thread Chris Lattner
> +This is an overloaded intrinsic function. You can use bswap on  
> any integer
> +type that is an even number of bytes (i.e. BitWidth % 16 == 0).  
> Note the suffix
> +that includes the type for the result and the operand.
>  
> +  declare i16 @llvm.bswap.i16.i16(i16 )
> +  declare i32 @llvm.bswap.i32.i32(i32 )
> +  declare i64 @llvm.bswap.i64.i32(i64 )

Typo for i64.

>  
> +The 'llvm.bwsap' family of intrinsics is used to byteswap  
> integer

Typo.

> +values with an even number of bytes (positive multiple of 16  
> bits).  These are
> +useful for performing operations on data that is not in the  
> target's native
> +byte order.
>  


Also, doesn't llvm-upgrade need to do something for these intrinsics?

-Chris
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/test/Transforms/InstCombine/bswap-fold.ll

2007-04-01 Thread Chris Lattner

This is being run through llvm-upgrade: llvm-upgrade should upgrade  
it, so this should be reverted.

-Chris

On Apr 1, 2007, at 12:36 AM, Reid Spencer wrote:

>
>
> Changes in directory llvm/test/Transforms/InstCombine:
>
> bswap-fold.ll updated: 1.2 -> 1.3
> ---
> Log message:
>
> For PR1297: http://llvm.org/PR1297 :
> Update these test cases to use proper signatures for bswap which is  
> now
> and overloaded intrinsic. Its name must be of the form  
> llvm.bswap.i32.i32
> since both the parameter and the result or of type "iAny". Also, the
> bit counting intrinsics changed to always return i32.
>
>
> ---
> Diffs of the changes:  (+7 -7)
>
>  bswap-fold.ll |   14 +++---
>  1 files changed, 7 insertions(+), 7 deletions(-)
>
>
> Index: llvm/test/Transforms/InstCombine/bswap-fold.ll
> diff -u llvm/test/Transforms/InstCombine/bswap-fold.ll:1.2 llvm/ 
> test/Transforms/InstCombine/bswap-fold.ll:1.3
> --- llvm/test/Transforms/InstCombine/bswap-fold.ll:1.2Fri Dec  1  
> 22:23:09 2006
> +++ llvm/test/Transforms/InstCombine/bswap-fold.llSun Apr  1  
> 02:36:28 2007
> @@ -2,25 +2,25 @@
>  ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis |  
> not grep 'call.*bswap'
>
>  bool %test1(ushort %tmp2) {
> - %tmp10 = call ushort %llvm.bswap.i16( ushort %tmp2 )
> + %tmp10 = call ushort %llvm.bswap.i16.i16( ushort %tmp2 )
>   %tmp = seteq ushort %tmp10, 1   
>   ret bool %tmp
>  }
>
>  bool %test2(uint %tmp) {
> - %tmp34 = tail call uint %llvm.bswap.i32( uint %tmp )
> + %tmp34 = tail call uint %llvm.bswap.i32.i32( uint %tmp )
>   %tmp = seteq uint %tmp34, 1 
>   ret bool %tmp
>  }
>
> -declare uint %llvm.bswap.i32(uint)
> -
>  bool %test3(ulong %tmp) {
> - %tmp34 = tail call ulong %llvm.bswap.i64( ulong %tmp )  
> + %tmp34 = tail call ulong %llvm.bswap.i64.i64( ulong %tmp )  
>   %tmp = seteq ulong %tmp34, 1
>   ret bool %tmp
>  }
>
> -declare ulong %llvm.bswap.i64(ulong)
> +declare ulong %llvm.bswap.i64.i64(ulong)
> +
> +declare ushort %llvm.bswap.i16.i16(ushort)
>
> -declare ushort %llvm.bswap.i16(ushort)
> +declare uint %llvm.bswap.i32.i32(uint)
>
>
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/test/CodeGen/Generic/llvm-ct-intrinsics.ll

2007-04-01 Thread Chris Lattner
Likewise, llvm-upgrade should do this.  Please revert this commit  
when safe.

-Chris

On Apr 1, 2007, at 12:36 AM, Reid Spencer wrote:

>
>
> Changes in directory llvm/test/CodeGen/Generic:
>
> llvm-ct-intrinsics.ll updated: 1.4 -> 1.5
> ---
> Log message:
>
> For PR1297: http://llvm.org/PR1297 :
> Update these test cases to use proper signatures for bswap which is  
> now
> and overloaded intrinsic. Its name must be of the form  
> llvm.bswap.i32.i32
> since both the parameter and the result or of type "iAny". Also, the
> bit counting intrinsics changed to always return i32.
>
>
> ---
> Diffs of the changes:  (+33 -33)
>
>  llvm-ct-intrinsics.ll |   66  
> +-
>  1 files changed, 33 insertions(+), 33 deletions(-)
>
>
> Index: llvm/test/CodeGen/Generic/llvm-ct-intrinsics.ll
> diff -u llvm/test/CodeGen/Generic/llvm-ct-intrinsics.ll:1.4 llvm/ 
> test/CodeGen/Generic/llvm-ct-intrinsics.ll:1.5
> --- llvm/test/CodeGen/Generic/llvm-ct-intrinsics.ll:1.4   Sat Dec  2  
> 14:38:10 2006
> +++ llvm/test/CodeGen/Generic/llvm-ct-intrinsics.ll   Sun Apr  1  
> 02:36:28 2007
> @@ -1,59 +1,59 @@
>  ; Make sure this testcase is supported by all code generators
>  ; RUN: llvm-upgrade < %s | llvm-as | llc
>
> -declare ulong %llvm.ctpop.i64(ulong)
> +declare uint %llvm.ctpop.i64(ulong)
>  declare uint %llvm.ctpop.i32(uint)
> -declare ushort %llvm.ctpop.i16(ushort)
> -declare ubyte %llvm.ctpop.i8(ubyte)
> +declare uint %llvm.ctpop.i16(ushort)
> +declare uint %llvm.ctpop.i8(ubyte)
>
>  void %ctpoptest(ubyte %A, ushort %B, uint %C, ulong %D,
> -ubyte *%AP, ushort* %BP, uint* %CP, ulong* %DP) {
> - %a = call ubyte %llvm.ctpop.i8(ubyte %A)
> - %b = call ushort %llvm.ctpop.i16(ushort %B)
> +uint *%AP, uint* %BP, uint* %CP, uint* %DP) {
> + %a = call uint %llvm.ctpop.i8(ubyte %A)
> + %b = call uint %llvm.ctpop.i16(ushort %B)
>   %c = call uint %llvm.ctpop.i32(uint %C)
> - %d = call ulong %llvm.ctpop.i64(ulong %D)
> + %d = call uint %llvm.ctpop.i64(ulong %D)
>
> - store ubyte %a, ubyte* %AP
> - store ushort %b, ushort* %BP
> - store uint   %c, uint* %CP
> - store ulong  %d, ulong* %DP
> + store uint %a, uint* %AP
> + store uint %b, uint* %BP
> + store uint %c, uint* %CP
> + store uint %d, uint* %DP
>   ret void
>  }
>
> -declare ulong %llvm.ctlz.i64(ulong)
> +declare uint %llvm.ctlz.i64(ulong)
>  declare uint %llvm.ctlz.i32(uint)
> -declare ushort %llvm.ctlz.i16(ushort)
> -declare ubyte %llvm.ctlz.i8(ubyte)
> +declare uint %llvm.ctlz.i16(ushort)
> +declare uint %llvm.ctlz.i8(ubyte)
>
>  void %ctlztest(ubyte %A, ushort %B, uint %C, ulong %D,
> -   ubyte *%AP, ushort* %BP, uint* %CP, ulong* %DP) {
> - %a = call ubyte %llvm.ctlz.i8(ubyte %A)
> - %b = call ushort %llvm.ctlz.i16(ushort %B)
> +   uint *%AP, uint* %BP, uint* %CP, uint* %DP) {
> + %a = call uint %llvm.ctlz.i8(ubyte %A)
> + %b = call uint %llvm.ctlz.i16(ushort %B)
>   %c = call uint %llvm.ctlz.i32(uint %C)
> - %d = call ulong %llvm.ctlz.i64(ulong %D)
> + %d = call uint %llvm.ctlz.i64(ulong %D)
>
> - store ubyte %a, ubyte* %AP
> - store ushort %b, ushort* %BP
> - store uint   %c, uint* %CP
> - store ulong  %d, ulong* %DP
> + store uint %a, uint* %AP
> + store uint %b, uint* %BP
> + store uint %c, uint* %CP
> + store uint %d, uint* %DP
>   ret void
>  }
>
> -declare ulong %llvm.cttz.i64(ulong)
> +declare uint %llvm.cttz.i64(ulong)
>  declare uint %llvm.cttz.i32(uint)
> -declare ushort %llvm.cttz.i16(ushort)
> -declare ubyte %llvm.cttz.i8(ubyte)
> +declare uint %llvm.cttz.i16(ushort)
> +declare uint %llvm.cttz.i8(ubyte)
>
>  void %cttztest(ubyte %A, ushort %B, uint %C, ulong %D,
> -   ubyte *%AP, ushort* %BP, uint* %CP, ulong* %DP) {
> - %a = call ubyte %llvm.cttz.i8(ubyte %A)
> - %b = call ushort %llvm.cttz.i16(ushort %B)
> +   uint *%AP, uint* %BP, uint* %CP, uint* %DP) {
> + %a = call uint %llvm.cttz.i8(ubyte %A)
> + %b = call uint %llvm.cttz.i16(ushort %B)
>   %c = call uint %llvm.cttz.i32(uint %C)
> - %d = call ulong %llvm.cttz.i64(ulong %D)
> + %d = call uint %llvm.cttz.i64(ulong %D)
>
> - store ubyte %a, ubyte* %AP
> - store ushort %b, ushort* %BP
> - store uint   %c, uint* %CP
> - store ulong  %d, ulong* %DP
> + store uint %a, uint* %AP
> + store uint %b, uint* %BP
> + store uint %c, uint* %CP
> + store uint %d, uint* %DP
>   ret void
>  }
>
>
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

2007-04-01 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.717 -> 1.718
---
Log message:

simplify this code, make it work for ap ints


---
Diffs of the changes:  (+6 -17)

 InstructionCombining.cpp |   23 ++-
 1 files changed, 6 insertions(+), 17 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.717 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.718
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.717   Sun Apr  1 
12:13:37 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sun Apr  1 15:57:36 2007
@@ -3594,14 +3594,14 @@
 /// MatchBSwap - Given an OR instruction, check to see if this is a bswap 
idiom.
 /// If so, insert the new bswap intrinsic and return it.
 Instruction *InstCombiner::MatchBSwap(BinaryOperator &I) {
-  // We cannot bswap one byte.
-  if (I.getType() == Type::Int8Ty)
-return 0;
+  const IntegerType *ITy = dyn_cast(I.getType());
+  if (!ITy || ITy->getBitWidth() % 16) 
+return 0;   // Can only bswap pairs of bytes.  Can't do vectors.
   
   /// ByteValues - For each byte of the result, we keep track of which value
   /// defines each byte.
   SmallVector ByteValues;
-  ByteValues.resize(TD->getTypeSize(I.getType()));
+  ByteValues.resize(ITy->getBitWidth()/8);
 
   // Try to find all the pieces corresponding to the bswap.
   if (CollectBSwapParts(I.getOperand(0), ByteValues) ||
@@ -3616,20 +3616,9 @@
   for (unsigned i = 1, e = ByteValues.size(); i != e; ++i)
 if (ByteValues[i] != V)
   return 0;
-
-  // If they do then *success* we can turn this into a bswap.  Figure out what
-  // bswap to make it into.
+  const Type *Tys[] = { ITy, ITy };
   Module *M = I.getParent()->getParent()->getParent();
-  const char *FnName = 0;
-  if (I.getType() == Type::Int16Ty)
-FnName = "llvm.bswap.i16.i16";
-  else if (I.getType() == Type::Int32Ty)
-FnName = "llvm.bswap.i32.i32";
-  else if (I.getType() == Type::Int64Ty)
-FnName = "llvm.bswap.i64.i64";
-  else
-assert(0 && "Unknown integer type!");
-  Constant *F = M->getOrInsertFunction(FnName, I.getType(), I.getType(), NULL);
+  Function *F = Intrinsic::getDeclaration(M, Intrinsic::bswap, Tys, 2);
   return new CallInst(F, V);
 }
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp

2007-04-01 Thread Chris Lattner

This is incorrect for the changes you made to the ctpop (etc)  
prototypes.  They will assert in RAUW.

-Chris

On Apr 1, 2007, at 12:35 AM, Reid Spencer wrote:

>
>
> Changes in directory llvm/lib/CodeGen:
>
> IntrinsicLowering.cpp updated: 1.72 -> 1.73
> ---
> Log message:
>
> For PR1297: http://llvm.org/PR1297 :
> Support overloaded intrinsics bswap, ctpop, cttz, ctlz.
>
>
> ---
> Diffs of the changes:  (+4 -17)
>
>  IntrinsicLowering.cpp |   21 -
>  1 files changed, 4 insertions(+), 17 deletions(-)
>
>
> Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
> diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.72 llvm/lib/ 
> CodeGen/IntrinsicLowering.cpp:1.73
> --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.72   Thu Mar  1 14:24:30  
> 2007
> +++ llvm/lib/CodeGen/IntrinsicLowering.cppSun Apr  1 02:35:23 2007
> @@ -236,8 +236,6 @@
>return LowerCTPOP(V, IP);
>  }
>
> -
> -
>  void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
>Function *Callee = CI->getCalledFunction();
>assert(Callee && "Cannot lower an indirect call!");
> @@ -283,30 +281,19 @@
>  Type::VoidTy, AbortFCache);
>  break;
>}
> -  case Intrinsic::ctpop_i8:
> -  case Intrinsic::ctpop_i16:
> -  case Intrinsic::ctpop_i32:
> -  case Intrinsic::ctpop_i64:
> +  case Intrinsic::ctpop:
>  CI->replaceAllUsesWith(LowerCTPOP(CI->getOperand(1), CI));
>  break;
>
> -  case Intrinsic::bswap_i16:
> -  case Intrinsic::bswap_i32:
> -  case Intrinsic::bswap_i64:
> +  case Intrinsic::bswap:
>  CI->replaceAllUsesWith(LowerBSWAP(CI->getOperand(1), CI));
>  break;
>
> -  case Intrinsic::ctlz_i8:
> -  case Intrinsic::ctlz_i16:
> -  case Intrinsic::ctlz_i32:
> -  case Intrinsic::ctlz_i64:
> +  case Intrinsic::ctlz:
>  CI->replaceAllUsesWith(LowerCTLZ(CI->getOperand(1), CI));
>  break;
>
> -  case Intrinsic::cttz_i8:
> -  case Intrinsic::cttz_i16:
> -  case Intrinsic::cttz_i32:
> -  case Intrinsic::cttz_i64: {
> +  case Intrinsic::cttz: {
>  // cttz(x) -> ctpop(~X & (X-1))
>  Value *Src = CI->getOperand(1);
>  Value *NotSrc = BinaryOperator::createNot(Src, Src->getName() 
> +".not", CI);
>
>
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-www/DevMtgMay2007.html

2007-04-01 Thread Owen Anderson


Changes in directory llvm-www:

DevMtgMay2007.html updated: 1.20 -> 1.21
---
Log message:

Reword some of my suggestions.


---
Diffs of the changes:  (+5 -6)

 DevMtgMay2007.html |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)


Index: llvm-www/DevMtgMay2007.html
diff -u llvm-www/DevMtgMay2007.html:1.20 llvm-www/DevMtgMay2007.html:1.21
--- llvm-www/DevMtgMay2007.html:1.20Sun Apr  1 13:20:25 2007
+++ llvm-www/DevMtgMay2007.html Sun Apr  1 16:01:30 2007
@@ -144,13 +144,12 @@
   development practices? i.e. release focuses or something?
   Owen AndersonAdoption Goals: while our adoption has
   increased greatly recently, we're still tiny compared to GCC. What are 
our
-  goals in this respect, adn how do we plan to address them? Do we
-  want to compete against GCC? Or, are we targeting a different
-  audience?
+  future growth and adoption plans?
   Owen AndersonProject Management: We have an oversight
   group right now. Do we want more organization? Corporate interest have
-  given us some great things, but sometimes their secrecy makes things
-  difficult; should ther be an LLVM Foundation in our future?
+  given us some great things, but sometimes secrecy makes things
+  difficult for those not involved; should there be an LLVM Foundation
+  in our (distant?) future?
 
 
 
@@ -229,6 +228,6 @@
   src="http://jigsaw.w3.org/css-validator/images/vcss"; alt="Valid CSS!">
   http://validator.w3.org/check/referer";>http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!">
-Last modified: $Date: 2007/04/01 18:20:25 $
+Last modified: $Date: 2007/04/01 21:01:30 $
 
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-www/DevMtgMay2007.html

2007-04-01 Thread Owen Anderson


Changes in directory llvm-www:

DevMtgMay2007.html updated: 1.21 -> 1.22
---
Log message:

Fix a some formatting.


---
Diffs of the changes:  (+10 -10)

 DevMtgMay2007.html |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)


Index: llvm-www/DevMtgMay2007.html
diff -u llvm-www/DevMtgMay2007.html:1.21 llvm-www/DevMtgMay2007.html:1.22
--- llvm-www/DevMtgMay2007.html:1.21Sun Apr  1 16:01:30 2007
+++ llvm-www/DevMtgMay2007.html Sun Apr  1 16:07:53 2007
@@ -135,21 +135,21 @@
   originator followed by 10 minutes of discussion. This will allow 6 issues to 
   be discussed in this time slot.
 
-  Suggested ByIssue or Discussion Topic
-  Owen AndersonIntegration of HLVM into LLVM - its 
+  Suggested ByIssue or Discussion Topic
+  Owen AndersonIntegration of HLVM into LLVM - its 
   future as an LLVM subproject, and plans for making LLVM more accessible 
-  to scripting and higher level language front ends.
-  Owen AndersonFuture development practices: with a
+  to scripting and higher level language front ends.
+  Owen AndersonFuture development practices: with a
   burgeoning number of clients and wider adoption, do we want more orgnized
-  development practices? i.e. release focuses or something?
-  Owen AndersonAdoption Goals: while our adoption has
+  development practices? i.e. release focuses or something?
+  Owen AndersonAdoption Goals: while our adoption has
   increased greatly recently, we're still tiny compared to GCC. What are 
our
-  future growth and adoption plans?
-  Owen AndersonProject Management: We have an oversight
+  future growth and adoption plans?
+  Owen AndersonProject Management: We have an oversight
   group right now. Do we want more organization? Corporate interest have
   given us some great things, but sometimes secrecy makes things
   difficult for those not involved; should there be an LLVM Foundation
-  in our (distant?) future?
+  in our (distant?) future?
 
 
 
@@ -228,6 +228,6 @@
   src="http://jigsaw.w3.org/css-validator/images/vcss"; alt="Valid CSS!">
   http://validator.w3.org/check/referer";>http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!">
-Last modified: $Date: 2007/04/01 21:01:30 $
+Last modified: $Date: 2007/04/01 21:07:53 $
 
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [125597] Apply Anton's patch to improve sret handling.

2007-04-01 Thread clattner
Revision: 125597
Author:   clattner
Date: 2007-04-01 14:57:56 -0700 (Sun, 01 Apr 2007)

Log Message:
---
Apply Anton's patch to improve sret handling.

Modified Paths:
--
apple-local/branches/llvm/gcc/llvm-types.cpp

Modified: apple-local/branches/llvm/gcc/llvm-types.cpp
===
--- apple-local/branches/llvm/gcc/llvm-types.cpp2007-04-01 20:33:33 UTC 
(rev 125596)
+++ apple-local/branches/llvm/gcc/llvm-types.cpp2007-04-01 21:57:56 UTC 
(rev 125597)
@@ -708,9 +708,10 @@
 
   FunctionType::ParamAttrsList ParamAttrs;
 
+  // Something for the return type.
+  ParamAttrs.push_back(FunctionType::NoAttributeSet);
+
   if (static_chain) {
-// Something for the return type.
-ParamAttrs.push_back(FunctionType::NoAttributeSet);
 // Pass the static chain in a register.
 ParamAttrs.push_back(FunctionType::InRegAttribute);
   }
@@ -796,10 +797,13 @@
   if (static_chain)
 // Pass the static chain in a register.
 ParamAttrs.push_back(FunctionType::InRegAttribute);
-
+  
+  // Handle struct return
+  if (ABIConverter.isStructReturn())
+ParamAttrs.push_back(FunctionType::StructRetAttribute);
+  
   for (tree Args = TYPE_ARG_TYPES(type);
-   Args && TREE_VALUE(Args) != void_type_node;
-   Args = TREE_CHAIN(Args)) {
+   Args && TREE_VALUE(Args) != void_type_node; Args = TREE_CHAIN(Args)) {
 unsigned Attributes = FunctionType::NoAttributeSet;
 tree Ty = TREE_VALUE(Args);
 
@@ -816,15 +820,6 @@
   }
 }
 
-// Handle struct return
-if (isFirstArg) {
-  if (ABIConverter.isStructReturn()) {
-Attributes |= FunctionType::StructRetAttribute;
-//printf("Struct return!\n");
-  }
-  isFirstArg = false;
-}
-
 #ifdef LLVM_TARGET_ENABLE_REGPARM
 if (TREE_CODE(Ty) == INTEGER_TYPE || TREE_CODE(Ty) == POINTER_TYPE)
   LLVM_ADJUST_REGPARM_ATTRIBUTE(Attributes, 
TREE_INT_CST_LOW(TYPE_SIZE(Ty)),


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] Correct handling of "sret" attribute - 2

2007-04-01 Thread Chris Lattner
Applied, thanks!  Please commit the testcase,

-Chris

On Mar 30, 2007, at 4:26 PM, Anton Korobeynikov wrote:

> Hello, Everyone.
>
> Please ignore my prev. patch, it's definitely wrong.
>
> You might find attached new patch + testcase.
>
> -- 
> With best regards, Anton Korobeynikov.
>
> Faculty of Mathematics & Mechanics, Saint Petersburg State University.
>
> 
> 
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/CFrontend/sret.c

2007-04-01 Thread Anton Korobeynikov


Changes in directory llvm/test/CFrontend:

sret.c added (r1.1)
---
Log message:

Add testcase for correct sret handling.


---
Diffs of the changes:  (+15 -0)

 sret.c |   15 +++
 1 files changed, 15 insertions(+)


Index: llvm/test/CFrontend/sret.c
diff -c /dev/null llvm/test/CFrontend/sret.c:1.1
*** /dev/null   Sun Apr  1 17:03:15 2007
--- llvm/test/CFrontend/sret.c  Sun Apr  1 17:03:04 2007
***
*** 0 
--- 1,15 
+ // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep 'sret' | wc -l | grep '5'
+ 
+ struct abc {
+  int a;
+  int b;
+  int c;
+ };
+  
+ struct abc foo1(void);
+ struct abc foo2();
+ 
+ void bar() {
+   struct abc dummy1 = foo1();
+   struct abc dummy2 = foo2();
+ }
\ No newline at end of file



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

2007-04-01 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.122 -> 1.123
---
Log message:

print the type of an inserted IV in -debug mode.


---
Diffs of the changes:  (+4 -3)

 LoopStrengthReduce.cpp |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.122 
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.123
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.122 Sun Mar 25 
22:01:27 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp   Sun Apr  1 17:21:39 2007
@@ -1029,10 +1029,12 @@
 IncV   = ReuseIV.IncV;
   }
 
+  const Type *ReplacedTy = CommonExprs->getType();
+  
   // Now that we know what we need to do, insert the PHI node itself.
   //
-  DOUT << "INSERTING IV of STRIDE " << *Stride << " and BASE "
-   << *CommonExprs << " :\n";
+  DOUT << "INSERTING IV of TYPE " << *ReplacedTy << " of STRIDE "
+   << *Stride << " and BASE " << *CommonExprs << " :\n";
 
   SCEVExpander Rewriter(*SE, *LI);
   SCEVExpander PreheaderRewriter(*SE, *LI);
@@ -1043,7 +1045,6 @@
   
   BasicBlock *LatchBlock = L->getLoopLatch();
 
-  const Type *ReplacedTy = CommonExprs->getType();
 
   // Emit the initial base value into the loop preheader.
   Value *CommonBaseV



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/docs/LangRef.html

2007-04-01 Thread Reid Spencer


Changes in directory llvm/docs:

LangRef.html updated: 1.222 -> 1.223
---
Log message:

Fix some bswap typos that Chris noticed.


---
Diffs of the changes:  (+3 -3)

 LangRef.html |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.222 llvm/docs/LangRef.html:1.223
--- llvm/docs/LangRef.html:1.222Sun Apr  1 14:00:37 2007
+++ llvm/docs/LangRef.html  Sun Apr  1 19:19:52 2007
@@ -4438,13 +4438,13 @@
 
   declare i16 @llvm.bswap.i16.i16(i16 )
   declare i32 @llvm.bswap.i32.i32(i32 )
-  declare i64 @llvm.bswap.i64.i32(i64 )
+  declare i64 @llvm.bswap.i64.i64(i64 )
 
 
 Overview:
 
 
-The 'llvm.bwsap' family of intrinsics is used to byteswap integer 
+The 'llvm.bwsap' family of intrinsics is used to byte swap integer 
 values with an even number of bytes (positive multiple of 16 bits).  These are 
 useful for performing operations on data that is not in the target's native 
 byte order.
@@ -4996,7 +4996,7 @@
 
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/04/01 19:00:37 $
+  Last modified: $Date: 2007/04/02 00:19:52 $
 
 
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.y

2007-04-01 Thread Reid Spencer


Changes in directory llvm/tools/llvm-upgrade:

UpgradeParser.y updated: 1.74 -> 1.75
---
Log message:

Handle upgrade of llvm.bswap.iXX to llvm.bswap.iXX.iXX per new naming 
rules for overloaded intrinsic functions.


---
Diffs of the changes:  (+47 -30)

 UpgradeParser.y |   77 ++--
 1 files changed, 47 insertions(+), 30 deletions(-)


Index: llvm/tools/llvm-upgrade/UpgradeParser.y
diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.74 
llvm/tools/llvm-upgrade/UpgradeParser.y:1.75
--- llvm/tools/llvm-upgrade/UpgradeParser.y:1.74Thu Mar 22 02:43:51 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.y Sun Apr  1 19:50:28 2007
@@ -1448,35 +1448,52 @@
  std::vector& Args) {
 
   std::string Name = ID.Type == ValID::NameVal ? ID.Name : "";
-  if (Name == "llvm.isunordered.f32" || Name == "llvm.isunordered.f64") {
-if (Args.size() != 2)
-  error("Invalid prototype for " + Name + " prototype");
-return new FCmpInst(FCmpInst::FCMP_UNO, Args[0], Args[1]);
-  } else {
-const Type* PtrTy = PointerType::get(Type::Int8Ty);
-std::vector Params;
-if (Name == "llvm.va_start" || Name == "llvm.va_end") {
-  if (Args.size() != 1)
-error("Invalid prototype for " + Name + " prototype");
-  Params.push_back(PtrTy);
-  const FunctionType *FTy = FunctionType::get(Type::VoidTy, Params, false);
-  const PointerType *PFTy = PointerType::get(FTy);
-  Value* Func = getVal(PFTy, ID);
-  Args[0] = new BitCastInst(Args[0], PtrTy, makeNameUnique("va"), CurBB);
-  return new CallInst(Func, &Args[0], Args.size());
-} else if (Name == "llvm.va_copy") {
-  if (Args.size() != 2)
-error("Invalid prototype for " + Name + " prototype");
-  Params.push_back(PtrTy);
-  Params.push_back(PtrTy);
-  const FunctionType *FTy = FunctionType::get(Type::VoidTy, Params, false);
-  const PointerType *PFTy = PointerType::get(FTy);
-  Value* Func = getVal(PFTy, ID);
-  std::string InstName0(makeNameUnique("va0"));
-  std::string InstName1(makeNameUnique("va1"));
-  Args[0] = new BitCastInst(Args[0], PtrTy, InstName0, CurBB);
-  Args[1] = new BitCastInst(Args[1], PtrTy, InstName1, CurBB);
-  return new CallInst(Func, &Args[0], Args.size());
+  switch (Name[5]) {
+case 'i':
+  if (Name == "llvm.isunordered.f32" || Name == "llvm.isunordered.f64") {
+if (Args.size() != 2)
+  error("Invalid prototype for " + Name);
+return new FCmpInst(FCmpInst::FCMP_UNO, Args[0], Args[1]);
+  }
+  break;
+case 'b':
+  if (Name.length() > 10 && !memcmp(&Name[5], "bswap.", 6)) {
+const Type* ArgTy = Args[0]->getType();
+Name += ".i" + utostr(cast(ArgTy)->getBitWidth());
+Function *F = cast(
+  CurModule.CurrentModule->getOrInsertFunction(Name, RetTy, ArgTy, 
+   (void*)0));
+return new CallInst(F, Args[0]);
+  }
+  break;
+case 'v' : {
+  const Type* PtrTy = PointerType::get(Type::Int8Ty);
+  std::vector Params;
+  if (Name == "llvm.va_start" || Name == "llvm.va_end") {
+if (Args.size() != 1)
+  error("Invalid prototype for " + Name + " prototype");
+Params.push_back(PtrTy);
+const FunctionType *FTy = 
+  FunctionType::get(Type::VoidTy, Params, false);
+const PointerType *PFTy = PointerType::get(FTy);
+Value* Func = getVal(PFTy, ID);
+Args[0] = new BitCastInst(Args[0], PtrTy, makeNameUnique("va"), CurBB);
+return new CallInst(Func, &Args[0], Args.size());
+  } else if (Name == "llvm.va_copy") {
+if (Args.size() != 2)
+  error("Invalid prototype for " + Name + " prototype");
+Params.push_back(PtrTy);
+Params.push_back(PtrTy);
+const FunctionType *FTy = 
+  FunctionType::get(Type::VoidTy, Params, false);
+const PointerType *PFTy = PointerType::get(FTy);
+Value* Func = getVal(PFTy, ID);
+std::string InstName0(makeNameUnique("va0"));
+std::string InstName1(makeNameUnique("va1"));
+Args[0] = new BitCastInst(Args[0], PtrTy, InstName0, CurBB);
+Args[1] = new BitCastInst(Args[1], PtrTy, InstName1, CurBB);
+return new CallInst(Func, &Args[0], Args.size());
+  }
 }
   }
   return 0;
@@ -3661,7 +3678,7 @@
 if ($6)
   for (unsigned i = 0, e = $6->size(); i < e; ++i) 
 Args.push_back((*$6)[i].V);
-Instruction *Inst = upgradeIntrinsicCall(FTy, $4, Args);
+Instruction *Inst = upgradeIntrinsicCall(FTy->getReturnType(), $4, Args);
 
 // If we got an upgraded intrinsic
 if (Inst) {



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/CodeGen/Generic/llvm-ct-intrinsics.ll

2007-04-01 Thread Reid Spencer


Changes in directory llvm/test/CodeGen/Generic:

llvm-ct-intrinsics.ll updated: 1.5 -> 1.6
---
Log message:

Revert the name changes for llvm.bswap to allow (and test) llvm-upgrade of
this intrinsic.


---
Diffs of the changes:  (+33 -33)

 llvm-ct-intrinsics.ll |   66 +-
 1 files changed, 33 insertions(+), 33 deletions(-)


Index: llvm/test/CodeGen/Generic/llvm-ct-intrinsics.ll
diff -u llvm/test/CodeGen/Generic/llvm-ct-intrinsics.ll:1.5 
llvm/test/CodeGen/Generic/llvm-ct-intrinsics.ll:1.6
--- llvm/test/CodeGen/Generic/llvm-ct-intrinsics.ll:1.5 Sun Apr  1 02:36:28 2007
+++ llvm/test/CodeGen/Generic/llvm-ct-intrinsics.ll Sun Apr  1 19:51:15 2007
@@ -1,59 +1,59 @@
 ; Make sure this testcase is supported by all code generators
 ; RUN: llvm-upgrade < %s | llvm-as | llc
 
-declare uint %llvm.ctpop.i64(ulong)
+declare ulong %llvm.ctpop.i64(ulong)
 declare uint %llvm.ctpop.i32(uint)
-declare uint %llvm.ctpop.i16(ushort)
-declare uint %llvm.ctpop.i8(ubyte)
+declare ushort %llvm.ctpop.i16(ushort)
+declare ubyte %llvm.ctpop.i8(ubyte)
 
 void %ctpoptest(ubyte %A, ushort %B, uint %C, ulong %D, 
-uint *%AP, uint* %BP, uint* %CP, uint* %DP) {
-   %a = call uint %llvm.ctpop.i8(ubyte %A)
-   %b = call uint %llvm.ctpop.i16(ushort %B)
+ubyte *%AP, ushort* %BP, uint* %CP, ulong* %DP) {
+   %a = call ubyte %llvm.ctpop.i8(ubyte %A)
+   %b = call ushort %llvm.ctpop.i16(ushort %B)
%c = call uint %llvm.ctpop.i32(uint %C)
-   %d = call uint %llvm.ctpop.i64(ulong %D)
+   %d = call ulong %llvm.ctpop.i64(ulong %D)
 
-   store uint %a, uint* %AP
-   store uint %b, uint* %BP
-   store uint %c, uint* %CP
-   store uint %d, uint* %DP
+   store ubyte %a, ubyte* %AP
+   store ushort %b, ushort* %BP
+   store uint   %c, uint* %CP
+   store ulong  %d, ulong* %DP
ret void
 }
 
-declare uint %llvm.ctlz.i64(ulong)
+declare ulong %llvm.ctlz.i64(ulong)
 declare uint %llvm.ctlz.i32(uint)
-declare uint %llvm.ctlz.i16(ushort)
-declare uint %llvm.ctlz.i8(ubyte)
+declare ushort %llvm.ctlz.i16(ushort)
+declare ubyte %llvm.ctlz.i8(ubyte)
 
 void %ctlztest(ubyte %A, ushort %B, uint %C, ulong %D, 
-   uint *%AP, uint* %BP, uint* %CP, uint* %DP) {
-   %a = call uint %llvm.ctlz.i8(ubyte %A)
-   %b = call uint %llvm.ctlz.i16(ushort %B)
+   ubyte *%AP, ushort* %BP, uint* %CP, ulong* %DP) {
+   %a = call ubyte %llvm.ctlz.i8(ubyte %A)
+   %b = call ushort %llvm.ctlz.i16(ushort %B)
%c = call uint %llvm.ctlz.i32(uint %C)
-   %d = call uint %llvm.ctlz.i64(ulong %D)
+   %d = call ulong %llvm.ctlz.i64(ulong %D)
 
-   store uint %a, uint* %AP
-   store uint %b, uint* %BP
-   store uint %c, uint* %CP
-   store uint %d, uint* %DP
+   store ubyte %a, ubyte* %AP
+   store ushort %b, ushort* %BP
+   store uint   %c, uint* %CP
+   store ulong  %d, ulong* %DP
ret void
 }
 
-declare uint %llvm.cttz.i64(ulong)
+declare ulong %llvm.cttz.i64(ulong)
 declare uint %llvm.cttz.i32(uint)
-declare uint %llvm.cttz.i16(ushort)
-declare uint %llvm.cttz.i8(ubyte)
+declare ushort %llvm.cttz.i16(ushort)
+declare ubyte %llvm.cttz.i8(ubyte)
 
 void %cttztest(ubyte %A, ushort %B, uint %C, ulong %D, 
-   uint *%AP, uint* %BP, uint* %CP, uint* %DP) {
-   %a = call uint %llvm.cttz.i8(ubyte %A)
-   %b = call uint %llvm.cttz.i16(ushort %B)
+   ubyte *%AP, ushort* %BP, uint* %CP, ulong* %DP) {
+   %a = call ubyte %llvm.cttz.i8(ubyte %A)
+   %b = call ushort %llvm.cttz.i16(ushort %B)
%c = call uint %llvm.cttz.i32(uint %C)
-   %d = call uint %llvm.cttz.i64(ulong %D)
+   %d = call ulong %llvm.cttz.i64(ulong %D)
 
-   store uint %a, uint* %AP
-   store uint %b, uint* %BP
-   store uint %c, uint* %CP
-   store uint %d, uint* %DP
+   store ubyte %a, ubyte* %AP
+   store ushort %b, ushort* %BP
+   store uint   %c, uint* %CP
+   store ulong  %d, ulong* %DP
ret void
 }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Transforms/InstCombine/bswap-fold.ll

2007-04-01 Thread Reid Spencer


Changes in directory llvm/test/Transforms/InstCombine:

bswap-fold.ll updated: 1.3 -> 1.4
---
Log message:

Revert the name changes for llvm.bswap to allow (and test) llvm-upgrade of
this intrinsic.


---
Diffs of the changes:  (+7 -7)

 bswap-fold.ll |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)


Index: llvm/test/Transforms/InstCombine/bswap-fold.ll
diff -u llvm/test/Transforms/InstCombine/bswap-fold.ll:1.3 
llvm/test/Transforms/InstCombine/bswap-fold.ll:1.4
--- llvm/test/Transforms/InstCombine/bswap-fold.ll:1.3  Sun Apr  1 02:36:28 2007
+++ llvm/test/Transforms/InstCombine/bswap-fold.ll  Sun Apr  1 19:51:15 2007
@@ -2,25 +2,25 @@
 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep 
'call.*bswap'
 
 bool %test1(ushort %tmp2) {
-   %tmp10 = call ushort %llvm.bswap.i16.i16( ushort %tmp2 )
+   %tmp10 = call ushort %llvm.bswap.i16( ushort %tmp2 )
%tmp = seteq ushort %tmp10, 1   
ret bool %tmp
 }
 
 bool %test2(uint %tmp) {
-   %tmp34 = tail call uint %llvm.bswap.i32.i32( uint %tmp )
+   %tmp34 = tail call uint %llvm.bswap.i32( uint %tmp )
%tmp = seteq uint %tmp34, 1 
ret bool %tmp
 }
 
+declare uint %llvm.bswap.i32(uint)
+
 bool %test3(ulong %tmp) {
-   %tmp34 = tail call ulong %llvm.bswap.i64.i64( ulong %tmp )  
+   %tmp34 = tail call ulong %llvm.bswap.i64( ulong %tmp )  
%tmp = seteq ulong %tmp34, 1
ret bool %tmp
 }
 
-declare ulong %llvm.bswap.i64.i64(ulong)
-
-declare ushort %llvm.bswap.i16.i16(ushort)
+declare ulong %llvm.bswap.i64(ulong)
 
-declare uint %llvm.bswap.i32.i32(uint)
+declare ushort %llvm.bswap.i16(ushort)



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp

2007-04-01 Thread Reid Spencer


Changes in directory llvm/lib/CodeGen:

IntrinsicLowering.cpp updated: 1.73 -> 1.74
---
Log message:

For PR1297: http://llvm.org/PR1297 :
Make sure that the CTPOP result is casted to i32 as the bit counting 
intrinsics all return i32 now (this affects CTLZ and CTTZ as well).


---
Diffs of the changes:  (+1 -1)

 IntrinsicLowering.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.73 
llvm/lib/CodeGen/IntrinsicLowering.cpp:1.74
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.73 Sun Apr  1 02:35:23 2007
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp  Sun Apr  1 20:01:49 2007
@@ -218,7 +218,7 @@
 V = BinaryOperator::createAdd(LHS, RHS, "ctpop.step", IP);
   }
 
-  return V;
+  return CastInst::createIntegerCast(V, Type::Int32Ty, false, "ctpop", IP);
 }
 
 /// LowerCTLZ - Emit the code to lower ctlz of V before the specified



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/CodeGen/PowerPC/2006-07-19-stwbrx-crash.ll bswap-load-store.ll

2007-04-01 Thread Reid Spencer


Changes in directory llvm/test/CodeGen/PowerPC:

2006-07-19-stwbrx-crash.ll updated: 1.3 -> 1.4
bswap-load-store.ll updated: 1.3 -> 1.4
---
Log message:

Let llvm-upgrade upgrade bswap intrinsic.


---
Diffs of the changes:  (+8 -8)

 2006-07-19-stwbrx-crash.ll |4 ++--
 bswap-load-store.ll|   12 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/test/CodeGen/PowerPC/2006-07-19-stwbrx-crash.ll
diff -u llvm/test/CodeGen/PowerPC/2006-07-19-stwbrx-crash.ll:1.3 
llvm/test/CodeGen/PowerPC/2006-07-19-stwbrx-crash.ll:1.4
--- llvm/test/CodeGen/PowerPC/2006-07-19-stwbrx-crash.ll:1.3Sun Apr  1 
02:36:28 2007
+++ llvm/test/CodeGen/PowerPC/2006-07-19-stwbrx-crash.llSun Apr  1 
20:08:02 2007
@@ -2,9 +2,9 @@
 
 void %img2buf(int %symbol_size_in_bytes, ushort* %ui16) {
%tmp93 = load ushort* null  ;  [#uses=1]
-   %tmp99 = call ushort %llvm.bswap.i16.i16( ushort %tmp93 )   
;  [#uses=1]
+   %tmp99 = call ushort %llvm.bswap.i16( ushort %tmp93 )   ; 
 [#uses=1]
store ushort %tmp99, ushort* %ui16
ret void
 }
 
-declare ushort %llvm.bswap.i16.i16(ushort)
+declare ushort %llvm.bswap.i16(ushort)


Index: llvm/test/CodeGen/PowerPC/bswap-load-store.ll
diff -u llvm/test/CodeGen/PowerPC/bswap-load-store.ll:1.3 
llvm/test/CodeGen/PowerPC/bswap-load-store.ll:1.4
--- llvm/test/CodeGen/PowerPC/bswap-load-store.ll:1.3   Sun Apr  1 02:36:28 2007
+++ llvm/test/CodeGen/PowerPC/bswap-load-store.ll   Sun Apr  1 20:08:02 2007
@@ -8,7 +8,7 @@
 void %STWBRX(uint %i, sbyte* %ptr, int %off) {
%tmp1 = getelementptr sbyte* %ptr, int %off
%tmp1 = cast sbyte* %tmp1 to uint*
-   %tmp13 = tail call uint %llvm.bswap.i32.i32(uint %i)
+   %tmp13 = tail call uint %llvm.bswap.i32(uint %i)
store uint %tmp13, uint* %tmp1
ret void
 }
@@ -17,14 +17,14 @@
%tmp1 = getelementptr sbyte* %ptr, int %off
%tmp1 = cast sbyte* %tmp1 to uint*  
%tmp = load uint* %tmp1 
-   %tmp14 = tail call uint %llvm.bswap.i32.i32( uint %tmp )
+   %tmp14 = tail call uint %llvm.bswap.i32( uint %tmp )
ret uint %tmp14
 }
 
 void %STHBRX(ushort %s, sbyte* %ptr, int %off) {
%tmp1 = getelementptr sbyte* %ptr, int %off
%tmp1 = cast sbyte* %tmp1 to ushort*
-   %tmp5 = call ushort %llvm.bswap.i16.i16( ushort %s )
+   %tmp5 = call ushort %llvm.bswap.i16( ushort %s )
store ushort %tmp5, ushort* %tmp1
ret void
 }
@@ -33,10 +33,10 @@
%tmp1 = getelementptr sbyte* %ptr, int %off
%tmp1 = cast sbyte* %tmp1 to ushort*
%tmp = load ushort* %tmp1
-   %tmp6 = call ushort %llvm.bswap.i16.i16(ushort %tmp)
+   %tmp6 = call ushort %llvm.bswap.i16(ushort %tmp)
ret ushort %tmp6
 }
 
-declare uint %llvm.bswap.i32.i32(uint)
+declare uint %llvm.bswap.i32(uint)
 
-declare ushort %llvm.bswap.i16.i16(ushort)
+declare ushort %llvm.bswap.i16(ushort)



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/CodeGen/X86/bswap.ll

2007-04-01 Thread Reid Spencer


Changes in directory llvm/test/CodeGen/X86:

bswap.ll updated: 1.4 -> 1.5
---
Log message:

Let llvm-upgrade upgrade the bswap intrinsic.


---
Diffs of the changes:  (+6 -6)

 bswap.ll |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)


Index: llvm/test/CodeGen/X86/bswap.ll
diff -u llvm/test/CodeGen/X86/bswap.ll:1.4 llvm/test/CodeGen/X86/bswap.ll:1.5
--- llvm/test/CodeGen/X86/bswap.ll:1.4  Sun Apr  1 02:36:28 2007
+++ llvm/test/CodeGen/X86/bswap.ll  Sun Apr  1 20:09:19 2007
@@ -3,21 +3,21 @@
 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep bswapl | wc -l | 
grep 3 &&
 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep rolw | wc -l | grep 
1
 
-declare ushort %llvm.bswap.i16.i16(ushort)
-declare uint %llvm.bswap.i32.i32(uint)
-declare ulong %llvm.bswap.i64.i64(ulong)
+declare ushort %llvm.bswap.i16(ushort)
+declare uint %llvm.bswap.i32(uint)
+declare ulong %llvm.bswap.i64(ulong)
 
 ushort %W(ushort %A) {
-   %Z = call ushort %llvm.bswap.i16.i16(ushort %A)
+   %Z = call ushort %llvm.bswap.i16(ushort %A)
ret ushort %Z
 }
 
 uint %X(uint %A) {
-   %Z = call uint %llvm.bswap.i32.i32(uint %A)
+   %Z = call uint %llvm.bswap.i32(uint %A)
ret uint %Z
 }
 
 ulong %Y(ulong %A) {
-   %Z = call ulong %llvm.bswap.i64.i64(ulong %A)
+   %Z = call ulong %llvm.bswap.i64(ulong %A)
ret ulong %Z
 }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.y

2007-04-01 Thread Reid Spencer


Changes in directory llvm/tools/llvm-upgrade:

UpgradeParser.y updated: 1.75 -> 1.76
---
Log message:

Don't upgrade functions that look like a bswap intrinsic but aren't.


---
Diffs of the changes:  (+1 -1)

 UpgradeParser.y |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/tools/llvm-upgrade/UpgradeParser.y
diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.75 
llvm/tools/llvm-upgrade/UpgradeParser.y:1.76
--- llvm/tools/llvm-upgrade/UpgradeParser.y:1.75Sun Apr  1 19:50:28 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.y Sun Apr  1 20:13:36 2007
@@ -1457,7 +1457,7 @@
   }
   break;
 case 'b':
-  if (Name.length() > 10 && !memcmp(&Name[5], "bswap.", 6)) {
+  if (Name.length() == 14 && !memcmp(&Name[5], "bswap.i", 7)) {
 const Type* ArgTy = Args[0]->getType();
 Name += ".i" + utostr(cast(ArgTy)->getBitWidth());
 Function *F = cast(



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/ADT/SmallPtrSet.h

2007-04-01 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

SmallPtrSet.h updated: 1.9 -> 1.10
---
Log message:

add range version of insert()


---
Diffs of the changes:  (+7 -2)

 SmallPtrSet.h |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/ADT/SmallPtrSet.h
diff -u llvm/include/llvm/ADT/SmallPtrSet.h:1.9 
llvm/include/llvm/ADT/SmallPtrSet.h:1.10
--- llvm/include/llvm/ADT/SmallPtrSet.h:1.9 Sat Mar  3 22:04:43 2007
+++ llvm/include/llvm/ADT/SmallPtrSet.h Sun Apr  1 20:21:19 2007
@@ -90,6 +90,12 @@
   /// was already in the set.
   bool insert(void *Ptr);
   
+  template 
+  void insert(IterT I, IterT E) {
+for (; I != E; ++I)
+  insert((void*)*I);
+  }
+  
   /// erase - If the set contains the specified pointer, remove it and return
   /// true, otherwise return false.
   bool erase(void *Ptr);
@@ -212,8 +218,7 @@
   template
   SmallPtrSet(It I, It E)
 : SmallPtrSetImpl(NextPowerOfTwo::Val) {
-for (; I != E; ++I)
-  insert(*I);
+insert(I, E);
   }
   
   typedef SmallPtrSetIterator iterator;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/CodeGen/ARM/tst_teq.ll

2007-04-01 Thread Lauro Ramos Venancio


Changes in directory llvm/test/CodeGen/ARM:

tst_teq.ll added (r1.1)
---
Log message:

- Divides the comparisons in two types: comparisons that only use N and Z 
flags (ARMISD::CMPNZ) and comparisons that use all flags (ARMISD::CMP).
- Defines the instructions: TST, TEQ (ARM) and TST (Thumb).


---
Diffs of the changes:  (+21 -0)

 tst_teq.ll |   21 +
 1 files changed, 21 insertions(+)


Index: llvm/test/CodeGen/ARM/tst_teq.ll
diff -c /dev/null llvm/test/CodeGen/ARM/tst_teq.ll:1.1
*** /dev/null   Sun Apr  1 20:30:13 2007
--- llvm/test/CodeGen/ARM/tst_teq.llSun Apr  1 20:30:03 2007
***
*** 0 
--- 1,21 
+ ; RUN: llvm-as < %s | llc -march=arm &&
+ ; RUN: llvm-as < %s | llc -march=thumb &&
+ ; RUN: llvm-as < %s | llc -march=arm | grep "tst" &&
+ ; RUN: llvm-as < %s | llc -march=arm | grep "teq" &&
+ ; RUN: llvm-as < %s | llc -march=thumb | grep "tst"
+ 
+ define i32 @f(i32 %a) {
+ entry:
+   %tmp2 = and i32 %a, 255 ;  [#uses=1]
+   icmp eq i32 %tmp2, 0; :0 [#uses=1]
+   %retval = select i1 %0, i32 20, i32 10  ;  [#uses=1]
+   ret i32 %retval
+ }
+ 
+ define i32 @g(i32 %a) {
+ entry:
+ %tmp2 = xor i32 %a, 255
+   icmp eq i32 %tmp2, 0; :0 [#uses=1]
+   %retval = select i1 %0, i32 20, i32 10  ;  [#uses=1]
+   ret i32 %retval
+ }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp ARMISelLowering.h ARMInstrInfo.td ARMInstrThumb.td

2007-04-01 Thread Lauro Ramos Venancio


Changes in directory llvm/lib/Target/ARM:

ARMISelLowering.cpp updated: 1.34 -> 1.35
ARMISelLowering.h updated: 1.10 -> 1.11
ARMInstrInfo.td updated: 1.94 -> 1.95
ARMInstrThumb.td updated: 1.20 -> 1.21
---
Log message:

- Divides the comparisons in two types: comparisons that only use N and Z 
flags (ARMISD::CMPNZ) and comparisons that use all flags (ARMISD::CMP).
- Defines the instructions: TST, TEQ (ARM) and TST (Thumb).


---
Diffs of the changes:  (+45 -7)

 ARMISelLowering.cpp |   16 +++-
 ARMISelLowering.h   |1 +
 ARMInstrInfo.td |   16 
 ARMInstrThumb.td|   19 +--
 4 files changed, 45 insertions(+), 7 deletions(-)


Index: llvm/lib/Target/ARM/ARMISelLowering.cpp
diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.34 
llvm/lib/Target/ARM/ARMISelLowering.cpp:1.35
--- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.34Sun Apr  1 03:06:46 2007
+++ llvm/lib/Target/ARM/ARMISelLowering.cpp Sun Apr  1 20:30:03 2007
@@ -266,6 +266,7 @@
   case ARMISD::RET_FLAG:  return "ARMISD::RET_FLAG";
   case ARMISD::PIC_ADD:   return "ARMISD::PIC_ADD";
   case ARMISD::CMP:   return "ARMISD::CMP";
+  case ARMISD::CMPNZ: return "ARMISD::CMPNZ";
   case ARMISD::CMPFP: return "ARMISD::CMPFP";
   case ARMISD::CMPFPw0:   return "ARMISD::CMPFPw0";
   case ARMISD::FMSTAT:return "ARMISD::FMSTAT";
@@ -946,8 +947,21 @@
   }
 
   ARMCC::CondCodes CondCode = IntCCToARMCC(CC);
+  ARMISD::NodeType CompareType;
+  switch (CondCode) {
+  default:
+CompareType = ARMISD::CMP;
+break;
+  case ARMCC::EQ:
+  case ARMCC::NE:
+  case ARMCC::MI:
+  case ARMCC::PL:
+// Uses only N and Z Flags
+CompareType = ARMISD::CMPNZ;
+break;
+  }
   ARMCC = DAG.getConstant(CondCode, MVT::i32);
-  return DAG.getNode(ARMISD::CMP, MVT::Flag, LHS, RHS);
+  return DAG.getNode(CompareType, MVT::Flag, LHS, RHS);
 }
 
 /// Returns a appropriate VFP CMP (fcmp{s|d}+fmstat) for the given operands.


Index: llvm/lib/Target/ARM/ARMISelLowering.h
diff -u llvm/lib/Target/ARM/ARMISelLowering.h:1.10 
llvm/lib/Target/ARM/ARMISelLowering.h:1.11
--- llvm/lib/Target/ARM/ARMISelLowering.h:1.10  Fri Mar 30 18:15:24 2007
+++ llvm/lib/Target/ARM/ARMISelLowering.h   Sun Apr  1 20:30:03 2007
@@ -43,6 +43,7 @@
   PIC_ADD,  // Add with a PC operand and a PIC label.
 
   CMP,  // ARM compare instructions.
+  CMPNZ,// ARM compare that uses only N or Z flags.
   CMPFP,// ARM VFP compare instruction, sets FPSCR.
   CMPFPw0,  // ARM VFP compare against zero instruction, sets FPSCR.
   FMSTAT,   // ARM fmstat instruction.


Index: llvm/lib/Target/ARM/ARMInstrInfo.td
diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.94 
llvm/lib/Target/ARM/ARMInstrInfo.td:1.95
--- llvm/lib/Target/ARM/ARMInstrInfo.td:1.94Tue Mar 27 11:19:21 2007
+++ llvm/lib/Target/ARM/ARMInstrInfo.td Sun Apr  1 20:30:03 2007
@@ -70,6 +70,9 @@
 def ARMcmp   : SDNode<"ARMISD::CMP", SDT_ARMCmp,
   [SDNPOutFlag]>;
 
+def ARMcmpNZ : SDNode<"ARMISD::CMPNZ", SDT_ARMCmp,
+  [SDNPOutFlag]>;
+
 def ARMpic_add   : SDNode<"ARMISD::PIC_ADD", SDT_ARMPICAdd>;
 
 def ARMsrl_flag  : SDNode<"ARMISD::SRL_FLAG", SDTIntUnaryOp, 
[SDNPOutFlag]>;
@@ -1023,10 +1026,15 @@
  (CMNri  GPR:$src, so_imm_neg:$imm)>;
 
 // Note that TST/TEQ don't set all the same flags that CMP does!
-def TSTrr : AI1<(ops GPR:$a, so_reg:$b), "tst $a, $b", []>;
-def TSTri : AI1<(ops GPR:$a, so_imm:$b), "tst $a, $b", []>;
-def TEQrr : AI1<(ops GPR:$a, so_reg:$b), "teq $a, $b", []>;
-def TEQri : AI1<(ops GPR:$a, so_imm:$b), "teq $a, $b", []>;
+defm TST  : AI1_bin0_irs<"tst", BinOpFrag<(ARMcmpNZ (and node:$LHS, 
node:$RHS), 0)>>;
+defm TEQ  : AI1_bin0_irs<"teq", BinOpFrag<(ARMcmpNZ (xor node:$LHS, 
node:$RHS), 0)>>;
+
+defm CMPnz : AI1_bin0_irs<"cmp", BinOpFrag<(ARMcmpNZ node:$LHS, node:$RHS)>>;
+defm CMNnz : AI1_bin0_irs<"cmn", BinOpFrag<(ARMcmpNZ node:$LHS,(ineg 
node:$RHS))>>;
+
+def : ARMPat<(ARMcmpNZ GPR:$src, so_imm_neg:$imm),
+ (CMNri  GPR:$src, so_imm_neg:$imm)>;
+
 
 // Conditional moves
 def MOVCCr : AI<(ops GPR:$dst, GPR:$false, GPR:$true, CCOp:$cc),


Index: llvm/lib/Target/ARM/ARMInstrThumb.td
diff -u llvm/lib/Target/ARM/ARMInstrThumb.td:1.20 
llvm/lib/Target/ARM/ARMInstrThumb.td:1.21
--- llvm/lib/Target/ARM/ARMInstrThumb.td:1.20   Thu Mar 29 16:38:31 2007
+++ llvm/lib/Target/ARM/ARMInstrThumb.tdSun Apr  1 20:30:03 2007
@@ -356,7 +356,23 @@
 def tCMPr : TI<(ops GPR:$lhs, GPR:$rhs),
"cmp $lhs, $rhs",
[(ARMcmp GPR:$lhs, GPR:$rhs)]>;
-   
+
+def tTST  : TI<(ops GPR:$lhs, GPR:$rhs),
+   "tst $lhs, $rhs",
+   [(ARMcmpNZ (and GPR:$lhs, GPR:$rhs), 0)]>;
+
+def tCMNNZ : TI<(ops GPR:$lhs, GPR:$rhs),
+"cmn $lhs, $rhs",
+[(ARMcmpNZ GPR:$lhs, (ineg GPR:$rhs))]>;
+
+def tCMPNZi8 : TI<

[llvm-commits] CVS: llvm/test/CodeGen/Generic/phi-immediate-factoring.ll

2007-04-01 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/Generic:

phi-immediate-factoring.ll added (r1.1)
---
Log message:

new testcase for PR1296: http://llvm.org/PR1296 


---
Diffs of the changes:  (+54 -0)

 phi-immediate-factoring.ll |   54 +
 1 files changed, 54 insertions(+)


Index: llvm/test/CodeGen/Generic/phi-immediate-factoring.ll
diff -c /dev/null llvm/test/CodeGen/Generic/phi-immediate-factoring.ll:1.1
*** /dev/null   Sun Apr  1 20:33:09 2007
--- llvm/test/CodeGen/Generic/phi-immediate-factoring.llSun Apr  1 
20:32:59 2007
***
*** 0 
--- 1,54 
+ ; RUN: llvm-as < %s | llc -march=x86 | grep 'movl $1' | wc -l | grep 1
+ ; PR1296
+ 
+ target datalayout = 
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
+ target triple = "i686-apple-darwin8"
+ 
+ define i32 @foo(i32 %A, i32 %B, i32 %C) {
+ entry:
+   switch i32 %A, label %out [
+i32 1, label %bb
+i32 0, label %bb13
+i32 2, label %bb35
+   ]
+ 
+ bb:   ; preds = %cond_next, %entry
+   %i.144.1 = phi i32 [ 0, %entry ], [ %tmp7, %cond_next ] ;  
[#uses=2]
+   %tmp4 = and i32 %i.144.1, %B;  [#uses=1]
+   icmp eq i32 %tmp4, 0; :0 [#uses=1]
+   br i1 %0, label %cond_next, label %out
+ 
+ cond_next:; preds = %bb
+   %tmp7 = add i32 %i.144.1, 1 ;  [#uses=2]
+   icmp slt i32 %tmp7, 1000; :1 [#uses=1]
+   br i1 %1, label %bb, label %out
+ 
+ bb13: ; preds = %cond_next18, %entry
+   %i.248.1 = phi i32 [ 0, %entry ], [ %tmp20, %cond_next18 ]  
;  [#uses=2]
+   %tmp16 = and i32 %i.248.1, %C   ;  [#uses=1]
+   icmp eq i32 %tmp16, 0   ; :2 [#uses=1]
+   br i1 %2, label %cond_next18, label %out
+ 
+ cond_next18:  ; preds = %bb13
+   %tmp20 = add i32 %i.248.1, 1;  [#uses=2]
+   icmp slt i32 %tmp20, 1000   ; :3 [#uses=1]
+   br i1 %3, label %bb13, label %out
+ 
+ bb27: ; preds = %bb35
+   %tmp30 = and i32 %i.3, %C   ;  [#uses=1]
+   icmp eq i32 %tmp30, 0   ; :4 [#uses=1]
+   br i1 %4, label %cond_next32, label %out
+ 
+ cond_next32:  ; preds = %bb27
+   %indvar.next = add i32 %i.3, 1  ;  [#uses=1]
+   br label %bb35
+ 
+ bb35: ; preds = %entry, %cond_next32
+   %i.3 = phi i32 [ %indvar.next, %cond_next32 ], [ 0, %entry ]
;  [#uses=3]
+   icmp slt i32 %i.3, 1000 ; :5 [#uses=1]
+   br i1 %5, label %bb27, label %out
+ 
+ out:  ; preds = %bb27, %bb35, %bb13, %cond_next18, %bb, %cond_next, 
%entry
+   %result.0 = phi i32 [ 0, %entry ], [ 1, %bb ], [ 0, %cond_next ], [ 1, 
%bb13 ], [ 0, %cond_next18 ], [ 1, %bb27 ], [ 0, %bb35 ] ;  
[#uses=1]
+   ret i32 %result.0
+ }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp

2007-04-01 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

CodeGenPrepare.cpp updated: 1.1 -> 1.2
---
Log message:

Various passes before isel split edges and do other CFG-restructuring changes.

isel has its own particular features that it wants in the CFG, in order to
reduce the number of times a constant is computed, etc.  Make sure that we
clean up the CFG before doing any other things for isel.  Doing so can 
dramatically reduce the number of split edges and reduce the number of
places that constants get computed.  For example, this shrinks
CodeGen/Generic/phi-immediate-factoring.ll from 44 to 37 instructions on X86,
and from 21 to 17 MBB's in the output.  This is primarily a code size win,
not a performance win.

This implements CodeGen/Generic/phi-immediate-factoring.ll and PR1296: 
http://llvm.org/PR1296 .



---
Diffs of the changes:  (+175 -2)

 CodeGenPrepare.cpp |  177 -
 1 files changed, 175 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
diff -u llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp:1.1 
llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp:1.2
--- llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp:1.1   Fri Mar 30 23:06:36 2007
+++ llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp   Sun Apr  1 20:35:34 2007
@@ -20,13 +20,14 @@
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
 #include "llvm/Pass.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetLowering.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/ADT/SmallSet.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/Compiler.h"
 using namespace llvm;
 
 namespace {  
@@ -39,6 +40,9 @@
 bool runOnFunction(Function &F);
 
   private:
+bool EliminateMostlyEmptyBlocks(Function &F);
+bool CanMergeBlocks(const BasicBlock *BB, const BasicBlock *DestBB) const;
+void EliminateMostlyEmptyBlock(BasicBlock *BB);
 bool OptimizeBlock(BasicBlock &BB);
 bool OptimizeGEPExpression(GetElementPtrInst *GEPI);
   };
@@ -52,8 +56,13 @@
 
 
 bool CodeGenPrepare::runOnFunction(Function &F) {
-  bool MadeChange = true;
   bool EverMadeChange = false;
+  
+  // First pass, eliminate blocks that contain only PHI nodes and an
+  // unconditional branch.
+  EverMadeChange |= EliminateMostlyEmptyBlocks(F);
+  
+  bool MadeChange = true;
   while (MadeChange) {
 MadeChange = false;
 for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
@@ -63,6 +72,170 @@
   return EverMadeChange;
 }
 
+/// EliminateMostlyEmptyBlocks - eliminate blocks that contain only PHI nodes
+/// and an unconditional branch.  Passes before isel (e.g. LSR/loopsimplify) 
+/// often split edges in ways that are non-optimal for isel.  Start by
+/// eliminating these blocks so we can split them the way we want them.
+bool CodeGenPrepare::EliminateMostlyEmptyBlocks(Function &F) {
+  bool MadeChange = false;
+  // Note that this intentionally skips the entry block.
+  for (Function::iterator I = ++F.begin(), E = F.end(); I != E; ) {
+BasicBlock *BB = I++;
+
+// If this block doesn't end with an uncond branch, ignore it.
+BranchInst *BI = dyn_cast(BB->getTerminator());
+if (!BI || !BI->isUnconditional())
+  continue;
+
+// If the instruction before the branch isn't a phi node, then other stuff
+// is happening here.
+BasicBlock::iterator BBI = BI;
+if (BBI != BB->begin()) {
+  --BBI;
+  if (!isa(BBI)) continue;
+}
+
+// Do not break infinite loops.
+BasicBlock *DestBB = BI->getSuccessor(0);
+if (DestBB == BB)
+  continue;
+
+if (!CanMergeBlocks(BB, DestBB))
+  continue;
+
+EliminateMostlyEmptyBlock(BB);
+MadeChange = true;
+  }
+  return MadeChange;
+}
+
+/// CanMergeBlocks - Return true if we can merge BB into DestBB if there is a
+/// single uncond branch between them, and BB contains no other non-phi
+/// instructions.
+bool CodeGenPrepare::CanMergeBlocks(const BasicBlock *BB,
+const BasicBlock *DestBB) const {
+  // We only want to eliminate blocks whose phi nodes are used by phi nodes in
+  // the successor.  If there are more complex condition (e.g. preheaders),
+  // don't mess around with them.
+  BasicBlock::const_iterator BBI = BB->begin();
+  while (const PHINode *PN = dyn_cast(BBI++)) {
+for (Value::use_const_iterator UI = PN->use_begin(), E = PN->use_end();
+ UI != E; ++UI) {
+  const Instruction *User = cast(*UI);
+  if (User->getParent() != DestBB || !isa(User))
+return false;
+}
+  }
+  
+  // If BB and DestBB contain any common predecessors, then the phi nodes in BB
+  // and DestBB may have conflicting incoming values for the block.  If so, we
+  // can't merge the block.
+  const PHINode *DestBBPN = dyn_cast(DestBB->begin());
+  if 

[llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp

2007-04-01 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Utils:

SimplifyCFG.cpp updated: 1.119 -> 1.120
---
Log message:

reduce use of std::set


---
Diffs of the changes:  (+7 -6)

 SimplifyCFG.cpp |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.119 
llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.120
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.119 Thu Mar 22 11:38:57 2007
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp   Sun Apr  1 20:44:59 2007
@@ -22,6 +22,7 @@
 #include "llvm/Analysis/ConstantFolding.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include 
 #include 
 #include 
@@ -39,7 +40,7 @@
   // conflicting incoming values from the two switch blocks.
   BasicBlock *SI1BB = SI1->getParent();
   BasicBlock *SI2BB = SI2->getParent();
-  std::set SI1Succs(succ_begin(SI1BB), succ_end(SI1BB));
+  SmallPtrSet SI1Succs(succ_begin(SI1BB), succ_end(SI1BB));
   
   for (succ_iterator I = succ_begin(SI2BB), E = succ_end(SI2BB); I != E; ++I)
 if (SI1Succs.count(*I))
@@ -84,10 +85,10 @@
   // with incompatible values coming in from the two edges!
   //
   if (isa(Succ->front())) {
-std::set BBPreds(pred_begin(BB), pred_end(BB));
+SmallPtrSet BBPreds(pred_begin(BB), pred_end(BB));
 for (pred_iterator PI = pred_begin(Succ), PE = pred_end(Succ);
  PI != PE; ++PI)
-  if (std::find(BBPreds.begin(), BBPreds.end(), *PI) != BBPreds.end()) {
+  if (BBPreds.count(*PI)) {
 // Loop over all of the PHI nodes checking to see if there are
 // incompatible values coming in.
 for (BasicBlock::iterator I = Succ->begin(); isa(I); ++I) {
@@ -109,7 +110,7 @@
   // update the PHI nodes correctly.
   if (!isa(BB->begin()) || Succ->getSinglePredecessor()) return true;
 
-  // If the predecessors of Succ are only BB and Succ itself, we can handle 
this.
+  // If the predecessors of Succ are only BB and Succ itself, handle it.
   bool IsSafe = true;
   for (pred_iterator PI = pred_begin(Succ), E = pred_end(Succ); PI != E; ++PI)
 if (*PI != Succ && *PI != BB) {
@@ -131,7 +132,7 @@
   // Scan the predecessor sets of BB and Succ, making sure there are no common
   // predecessors.  Common predecessors would cause us to build a phi node with
   // differing incoming values, which is not legal.
-  std::set BBPreds(pred_begin(BB), pred_end(BB));
+  SmallPtrSet BBPreds(pred_begin(BB), pred_end(BB));
   for (pred_iterator PI = pred_begin(Succ), E = pred_end(Succ); PI != E; ++PI)
 if (BBPreds.count(*PI))
   return false;
@@ -633,7 +634,7 @@
   } else {
 SwitchInst *SI = cast(TI);
 // Okay, TI has cases that are statically dead, prune them away.
-std::set DeadCases;
+SmallPtrSet DeadCases;
 for (unsigned i = 0, e = PredCases.size(); i != e; ++i)
   DeadCases.insert(PredCases[i].first);
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Transforms/InstCombine/bitcount.ll

2007-04-01 Thread Reid Spencer


Changes in directory llvm/test/Transforms/InstCombine:

bitcount.ll added (r1.1)
---
Log message:

Add a test case to make sure that constant folding of the bit counting
intrinsics works.


---
Diffs of the changes:  (+16 -0)

 bitcount.ll |   16 
 1 files changed, 16 insertions(+)


Index: llvm/test/Transforms/InstCombine/bitcount.ll
diff -c /dev/null llvm/test/Transforms/InstCombine/bitcount.ll:1.1
*** /dev/null   Sun Apr  1 20:45:41 2007
--- llvm/test/Transforms/InstCombine/bitcount.llSun Apr  1 20:45:31 2007
***
*** 0 
--- 1,16 
+ ; Tests to make sure bit counts of constants are folded
+ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis -o /dev/null -f && 
+ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'llvm.ct'
+ 
+ declare i32 @llvm.ctpop.i31(i31 %val) 
+ declare i32 @llvm.cttz.i32(i32 %val) 
+ declare i32 @llvm.ctlz.i33(i33 %val) 
+ 
+ define i32 %test(i32 %A) {
+   %c1 = i32 call @llvm.ctpop(i31 12415124)
+   %c2 = i32 call @llvm.cttz(i32 87359874)
+   %c3 = i32 call @llvm.ctlz(i33 87359874)
+   %r1 = add i32 %c1, %c2
+   %r2 = add i32 %r1, %c3
+   ret i32 %r2
+ }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.y

2007-04-01 Thread Reid Spencer


Changes in directory llvm/tools/llvm-upgrade:

UpgradeParser.y updated: 1.76 -> 1.77
---
Log message:

Upgrade the bit count intrinsics to have an i32 result.


---
Diffs of the changes:  (+19 -0)

 UpgradeParser.y |   19 +++
 1 files changed, 19 insertions(+)


Index: llvm/tools/llvm-upgrade/UpgradeParser.y
diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.76 
llvm/tools/llvm-upgrade/UpgradeParser.y:1.77
--- llvm/tools/llvm-upgrade/UpgradeParser.y:1.76Sun Apr  1 20:13:36 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.y Sun Apr  1 21:08:05 2007
@@ -1466,6 +1466,25 @@
 return new CallInst(F, Args[0]);
   }
   break;
+case 'c':
+  if ((Name.length() <= 14 && !memcmp(&Name[5], "ctpop.i", 7)) ||
+  (Name.length() <= 13 && !memcmp(&Name[5], "ctlz.i", 6)) ||
+  (Name.length() <= 13 && !memcmp(&Name[5], "cttz.i", 6))) {
+// These intrinsics changed their result type.
+const Type* ArgTy = Args[0]->getType();
+Function *OldF = CurModule.CurrentModule->getFunction(Name);
+if (OldF)
+  OldF->setName("upgrd.rm." + Name);
+
+Function *NewF = cast(
+  CurModule.CurrentModule->getOrInsertFunction(Name, Type::Int32Ty, 
+   ArgTy, (void*)0));
+
+Instruction *Call = new CallInst(NewF, Args[0], "", CurBB);
+return CastInst::createIntegerCast(Call, RetTy, false);
+  }
+  break;
+
 case 'v' : {
   const Type* PtrTy = PointerType::get(Type::Int8Ty);
   std::vector Params;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/docs/LangRef.html

2007-04-01 Thread Chris Lattner

On Apr 1, 2007, at 5:20 PM, Reid Spencer wrote:

>
>  
> -The 'llvm.bwsap' family of intrinsics is used to byteswap  
> integer
> +The 'llvm.bwsap' family of intrinsics is used to byte  
> swap integer
>  values with an even number of bytes (positive multiple of 16  
> bits).  These are

Typo remains: llvm.bwsap

-Chris
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/docs/LangRef.html

2007-04-01 Thread Reid Spencer


Changes in directory llvm/docs:

LangRef.html updated: 1.223 -> 1.224
---
Log message:

bwsap -> bswap


---
Diffs of the changes:  (+2 -2)

 LangRef.html |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.223 llvm/docs/LangRef.html:1.224
--- llvm/docs/LangRef.html:1.223Sun Apr  1 19:19:52 2007
+++ llvm/docs/LangRef.html  Sun Apr  1 21:25:19 2007
@@ -,7 +,7 @@
 Overview:
 
 
-The 'llvm.bwsap' family of intrinsics is used to byte swap integer 
+The 'llvm.bswap' family of intrinsics is used to byte swap integer 
 values with an even number of bytes (positive multiple of 16 bits).  These are 
 useful for performing operations on data that is not in the target's native 
 byte order.
@@ -4996,7 +4996,7 @@
 
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/04/02 00:19:52 $
+  Last modified: $Date: 2007/04/02 02:25:19 $
 
 
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Transforms/InstCombine/bitcount.ll

2007-04-01 Thread Reid Spencer


Changes in directory llvm/test/Transforms/InstCombine:

bitcount.ll updated: 1.1 -> 1.2
---
Log message:

Fix illegal assembly syntax.


---
Diffs of the changes:  (+4 -4)

 bitcount.ll |8 
 1 files changed, 4 insertions(+), 4 deletions(-)


Index: llvm/test/Transforms/InstCombine/bitcount.ll
diff -u llvm/test/Transforms/InstCombine/bitcount.ll:1.1 
llvm/test/Transforms/InstCombine/bitcount.ll:1.2
--- llvm/test/Transforms/InstCombine/bitcount.ll:1.1Sun Apr  1 20:45:31 2007
+++ llvm/test/Transforms/InstCombine/bitcount.llSun Apr  1 22:24:47 2007
@@ -6,10 +6,10 @@
 declare i32 @llvm.cttz.i32(i32 %val) 
 declare i32 @llvm.ctlz.i33(i33 %val) 
 
-define i32 %test(i32 %A) {
-  %c1 = i32 call @llvm.ctpop(i31 12415124)
-  %c2 = i32 call @llvm.cttz(i32 87359874)
-  %c3 = i32 call @llvm.ctlz(i33 87359874)
+define i32 @test(i32 %A) {
+  %c1 = call i32 @llvm.ctpop.i31(i31 12415124)
+  %c2 = call i32 @llvm.cttz.i32(i32 87359874)
+  %c3 = call i32 @llvm.ctlz.i33(i33 87359874)
   %r1 = add i32 %c1, %c2
   %r2 = add i32 %r1, %c3
   ret i32 %r2



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/CodeGen/PowerPC/branch-opt.ll

2007-04-01 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/PowerPC:

branch-opt.ll updated: 1.6 -> 1.7
---
Log message:

my patch fixed the fixme.


---
Diffs of the changes:  (+1 -2)

 branch-opt.ll |3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)


Index: llvm/test/CodeGen/PowerPC/branch-opt.ll
diff -u llvm/test/CodeGen/PowerPC/branch-opt.ll:1.6 
llvm/test/CodeGen/PowerPC/branch-opt.ll:1.7
--- llvm/test/CodeGen/PowerPC/branch-opt.ll:1.6 Fri Feb 16 18:44:34 2007
+++ llvm/test/CodeGen/PowerPC/branch-opt.ll Mon Apr  2 00:08:54 2007
@@ -1,6 +1,5 @@
 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 &&
-; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'b LBB.*' | wc -l 
| grep 5
-;;; FIXME, 4 unconditional branches is minimal
+; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'b LBB.*' | wc -l 
| grep 4
 
 target endian = big
 target pointersize = 32



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Transforms/InstCombine/xor.ll

2007-04-01 Thread Chris Lattner


Changes in directory llvm/test/Transforms/InstCombine:

xor.ll updated: 1.20 -> 1.21
---
Log message:

creative way to add one.


---
Diffs of the changes:  (+6 -0)

 xor.ll |6 ++
 1 files changed, 6 insertions(+)


Index: llvm/test/Transforms/InstCombine/xor.ll
diff -u llvm/test/Transforms/InstCombine/xor.ll:1.20 
llvm/test/Transforms/InstCombine/xor.ll:1.21
--- llvm/test/Transforms/InstCombine/xor.ll:1.20Fri Jan 26 02:25:06 2007
+++ llvm/test/Transforms/InstCombine/xor.ll Mon Apr  2 00:35:08 2007
@@ -190,3 +190,9 @@
 ret int %tmp6
 }
 
+int %test28(int %indvar) {
+%tmp7 = add int %indvar, -2147483647
+%tmp214 = xor int %tmp7, -2147483648
+ret int %tmp214
+}
+



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

2007-04-01 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.718 -> 1.719
---
Log message:

simplify (x+c)^signbit as (x+c+signbit), pointed out by PR1288: 
http://llvm.org/PR1288 .  This implements
test/Transforms/InstCombine/xor.ll:test28


---
Diffs of the changes:  (+7 -1)

 InstructionCombining.cpp |8 +++-
 1 files changed, 7 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.718 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.719
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.718   Sun Apr  1 
15:57:36 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr  2 00:36:22 2007
@@ -4005,7 +4005,7 @@
   return BinaryOperator::createOr(Op0NotVal, NotY);
 }
   }
-
+  
   if (ConstantInt *Op0CI = dyn_cast(Op0I->getOperand(1)))
 if (Op0I->getOpcode() == Instruction::Add) {
   // ~(X-c) --> (-c-1)-X
@@ -4015,6 +4015,12 @@
ConstantExpr::getSub(NegOp0CI,
  ConstantInt::get(I.getType(), 1)),
   Op0I->getOperand(0));
+  } else if (RHS->getValue().isMinSignedValue()) {
+// (X + C) ^ signbit -> (X + C + signbit)
+Constant *C = ConstantInt::get(RHS->getValue() + 
Op0CI->getValue());
+return BinaryOperator::createAdd(Op0I->getOperand(0), C);
+ 
+  
   }
 } else if (Op0I->getOpcode() == Instruction::Or) {
   // (X|C1)^C2 -> X^(C1|C2) iff X&~C1 == 0



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h

2007-04-01 Thread Chris Lattner


Changes in directory llvm/include/llvm/ADT:

APInt.h updated: 1.60 -> 1.61
---
Log message:

add a helper function.


---
Diffs of the changes:  (+3 -0)

 APInt.h |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/include/llvm/ADT/APInt.h
diff -u llvm/include/llvm/ADT/APInt.h:1.60 llvm/include/llvm/ADT/APInt.h:1.61
--- llvm/include/llvm/ADT/APInt.h:1.60  Sun Apr  1 07:45:33 2007
+++ llvm/include/llvm/ADT/APInt.h   Mon Apr  2 00:41:00 2007
@@ -272,6 +272,9 @@
   /// @returns true if the argument APInt value is a power of two > 0.
   bool isPowerOf2() const; 
 
+  /// isSignBit - Return true if this is the value returned by getSignBit.
+  bool isSignBit() const { return isMinSignedValue(); }
+  
   /// This converts the APInt to a boolean value as a test against zero.
   /// @brief Boolean conversion function. 
   inline bool getBoolValue() const {



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

2007-04-01 Thread Chris Lattner


Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.105 -> 1.106
---
Log message:

Treat xor of signbit like an add.


---
Diffs of the changes:  (+10 -1)

 ScalarEvolution.cpp |   11 ++-
 1 files changed, 10 insertions(+), 1 deletion(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.105 
llvm/lib/Analysis/ScalarEvolution.cpp:1.106
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.105 Sat Mar  3 19:25:35 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Mon Apr  2 00:41:38 2007
@@ -1427,7 +1427,16 @@
 }
   }
   break;
-  
+case Instruction::Xor:
+  // If the RHS of the xor is a signbit, then this is just an add.
+  // Instcombine turns add of signbit into xor as a strength reduction 
step.
+  if (ConstantInt *CI = dyn_cast(I->getOperand(1))) {
+if (CI->getValue().isSignBit())
+  return SCEVAddExpr::get(getSCEV(I->getOperand(0)),
+  getSCEV(I->getOperand(1)));
+  }
+  break;
+
 case Instruction::Shl:
   // Turn shift left of a constant amount into a multiply.
   if (ConstantInt *SA = dyn_cast(I->getOperand(1))) {



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

2007-04-01 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.719 -> 1.720
---
Log message:

use more obvious function name.


---
Diffs of the changes:  (+1 -1)

 InstructionCombining.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.719 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.720
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.719   Mon Apr  2 
00:36:22 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr  2 00:42:22 2007
@@ -4015,7 +4015,7 @@
ConstantExpr::getSub(NegOp0CI,
  ConstantInt::get(I.getType(), 1)),
   Op0I->getOperand(0));
-  } else if (RHS->getValue().isMinSignedValue()) {
+  } else if (RHS->getValue().isSignBit()) {
 // (X + C) ^ signbit -> (X + C + signbit)
 Constant *C = ConstantInt::get(RHS->getValue() + 
Op0CI->getValue());
 return BinaryOperator::createAdd(Op0I->getOperand(0), C);



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

2007-04-01 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.720 -> 1.721
---
Log message:

Wrap long line


---
Diffs of the changes:  (+3 -3)

 InstructionCombining.cpp |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.720 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.721
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.720   Mon Apr  2 
00:42:22 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr  2 00:48:58 2007
@@ -4019,8 +4019,7 @@
 // (X + C) ^ signbit -> (X + C + signbit)
 Constant *C = ConstantInt::get(RHS->getValue() + 
Op0CI->getValue());
 return BinaryOperator::createAdd(Op0I->getOperand(0), C);
- 
-  
+
   }
 } else if (Op0I->getOpcode() == Instruction::Or) {
   // (X|C1)^C2 -> X^(C1|C2) iff X&~C1 == 0
@@ -6272,7 +6271,8 @@
   case Instruction::ZExt: {
 // We need to emit an AND to clear the high bits.
 assert(SrcBitSize < DestBitSize && "Not a zext?");
-Constant *C = ConstantInt::get(APInt::getLowBitsSet(DestBitSize, 
SrcBitSize));
+Constant *C = ConstantInt::get(APInt::getLowBitsSet(DestBitSize,
+SrcBitSize));
 return BinaryOperator::createAnd(Res, C);
   }
   case Instruction::SExt:



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/CodeGen/PowerPC/compare-simm.ll

2007-04-01 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/PowerPC:

compare-simm.ll added (r1.1)
---
Log message:

new testcase


---
Diffs of the changes:  (+13 -0)

 compare-simm.ll |   13 +
 1 files changed, 13 insertions(+)


Index: llvm/test/CodeGen/PowerPC/compare-simm.ll
diff -c /dev/null llvm/test/CodeGen/PowerPC/compare-simm.ll:1.1
*** /dev/null   Mon Apr  2 00:58:09 2007
--- llvm/test/CodeGen/PowerPC/compare-simm.ll   Mon Apr  2 00:57:59 2007
***
*** 0 
--- 1,13 
+ ; RUN: llvm-as < %s | llc -march=ppc32 | grep 'cmpwi cr0, r3, -1'
+ 
+ define i32 @test(i32 %x) {
+ %c = icmp eq i32 %x, -1
+   br i1 %c, label %T, label %F
+ T:
+   %A = call i32 @test(i32 123)
+   %B = add i32 %A, 43
+   ret i32 %B
+ F:
+   %G = add i32 %x, 1234
+   ret i32 %G
+ }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp

2007-04-01 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

PPCISelDAGToDAG.cpp updated: 1.229 -> 1.230
---
Log message:

Fix a bug which caused us to never be able to use signed comparisons for
equality comparisons of a constant.  This allows us to codegen the 'sintzero'
loop in PR1288: http://llvm.org/PR1288  as:

LBB1_1: ;cond_next
li r4, 0
addi r2, r2, 1
stw r4, 0(r3)
addi r3, r3, 4
cmpwi cr0, r2, -1
bne cr0, LBB1_1 ;cond_next

instead of:

LBB1_1: ;cond_next
addi r2, r2, 1
li r4, 0
xoris r5, r2, 65535
stw r4, 0(r3)
addi r3, r3, 4
cmplwi cr0, r5, 65535
bne cr0, LBB1_1 ;cond_next

This implements CodeGen/PowerPC/compare-simm.ll, and also cuts 74
instructions out of kc++.



---
Diffs of the changes:  (+1 -1)

 PPCISelDAGToDAG.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.229 
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.230
--- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.229   Tue Dec 19 16:59:26 2006
+++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Mon Apr  2 00:59:42 2007
@@ -508,7 +508,7 @@
   return SDOperand(CurDAG->getTargetNode(PPC::CMPLWI, MVT::i32, LHS,
  getI32Imm(Imm & 0x)), 0);
 // If this is a 16-bit signed immediate, fold it.
-if (isInt16(Imm))
+if (isInt16((int)Imm))
   return SDOperand(CurDAG->getTargetNode(PPC::CMPWI, MVT::i32, LHS,
  getI32Imm(Imm & 0x)), 0);
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-www/DevMtgMay2007.html

2007-04-01 Thread Reid Spencer


Changes in directory llvm-www:

DevMtgMay2007.html updated: 1.22 -> 1.23
---
Log message:

Add Devang.


---
Diffs of the changes:  (+4 -3)

 DevMtgMay2007.html |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm-www/DevMtgMay2007.html
diff -u llvm-www/DevMtgMay2007.html:1.22 llvm-www/DevMtgMay2007.html:1.23
--- llvm-www/DevMtgMay2007.html:1.22Sun Apr  1 16:07:53 2007
+++ llvm-www/DevMtgMay2007.html Mon Apr  2 01:09:54 2007
@@ -212,13 +212,14 @@
 Chris LattnerApple, Inc.
 Nick LewyckyIndependent
 Scott Michel + 2Aerospace
+Devang PatelApple, Inc.
 Reid SpencerIndependent
 Sarah Thompson + 1NASA, Ames Research Center
 Bill WendlingApple, Inc.
 Marcel WeiherMetaObject
   
-  Total confirmed attendees: 13
-  Possible additional attendees: 8
+  Total confirmed attendees: 14
+  Possible additional attendees: 7
 
 
 
@@ -228,6 +229,6 @@
   src="http://jigsaw.w3.org/css-validator/images/vcss"; alt="Valid CSS!">
   http://validator.w3.org/check/referer";>http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!">
-Last modified: $Date: 2007/04/01 21:07:53 $
+Last modified: $Date: 2007/04/02 06:09:54 $
 
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/CodeGen/ARM/lsr-scale-addr-mode.ll

2007-04-01 Thread Chris Lattner


Changes in directory llvm/test/CodeGen/ARM:

lsr-scale-addr-mode.ll added (r1.1)
---
Log message:

new testcase.


---
Diffs of the changes:  (+19 -0)

 lsr-scale-addr-mode.ll |   19 +++
 1 files changed, 19 insertions(+)


Index: llvm/test/CodeGen/ARM/lsr-scale-addr-mode.ll
diff -c /dev/null llvm/test/CodeGen/ARM/lsr-scale-addr-mode.ll:1.1
*** /dev/null   Mon Apr  2 01:33:20 2007
--- llvm/test/CodeGen/ARM/lsr-scale-addr-mode.llMon Apr  2 01:33:10 2007
***
*** 0 
--- 1,19 
+ ; RUN: llvm-as < %s | llc -march=arm | grep -F 'str r2, [r0, +r3, lsl #2]'
+ ; Should use scaled addressing mode.
+ 
+ define void @sintzero(i32* %a) {
+ entry:
+   store i32 0, i32* %a
+   br label %cond_next
+ 
+ cond_next:; preds = %cond_next, %entry
+   %indvar = phi i32 [ 0, %entry ], [ %tmp25, %cond_next ] ;  
[#uses=1]
+   %tmp25 = add i32 %indvar, 1 ;  [#uses=3]
+   %tmp36 = getelementptr i32* %a, i32 %tmp25  ;  
[#uses=1]
+   store i32 0, i32* %tmp36
+   icmp eq i32 %tmp25, -1  ; :0 [#uses=1]
+   br i1 %0, label %return, label %cond_next
+ 
+ return:   ; preds = %cond_next
+   ret void
+ }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

2007-04-01 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.123 -> 1.124
---
Log message:

Pass the type of the store access, not the type of the store, into the 
target hook.  This allows us to codegen a loop as:

LBB1_1: @cond_next
mov r2, #0
str r2, [r0, +r3, lsl #2]
add r3, r3, #1
cmn r3, #1
bne LBB1_1  @cond_next

instead of:

LBB1_1: @cond_next
mov r2, #0
str r2, [r0], #+4
add r3, r3, #1
cmn r3, #1
bne LBB1_1  @cond_next

This looks the same, but has one fewer induction variable (and therefore,
one fewer register) live in the loop.



---
Diffs of the changes:  (+9 -2)

 LoopStrengthReduce.cpp |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.123 
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.124
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.123 Sun Apr  1 
17:21:39 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp   Mon Apr  2 01:34:44 2007
@@ -899,8 +899,15 @@
   Imm = SC->getValue()->getSExtValue();
 else
   Imm = 0;
-if (!TLI->isLegalAddressScaleAndImm(Scale, Imm, 
-  UsersToProcess[i].Inst->getType()))
+
+// If this is a load or other access, pass the type of the access in.
+const Type *AccessTy = Type::VoidTy;
+if (StoreInst *SI = dyn_cast(UsersToProcess[i].Inst))
+  AccessTy = SI->getOperand(0)->getType();
+else if (LoadInst *LI = dyn_cast(UsersToProcess[i].Inst))
+  AccessTy = LI->getType();
+
+if (!TLI->isLegalAddressScaleAndImm(Scale, Imm, AccessTy))
   return false;
   }
   return true;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits