[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Reid Spencer
reid at x10sys.com
Sun Apr 1 00:35:46 PDT 2007
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.715 -> 1.716
---
Log message:
For PR1297: http://llvm.org/PR1297 :
Support overloaded intrinsics bswap, ctpop, cttz, ctlz.
---
Diffs of the changes: (+7 -25)
InstructionCombining.cpp | 32 +++++++-------------------------
1 files changed, 7 insertions(+), 25 deletions(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.715 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.716
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.715 Sun Apr 1 00:36:37 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sun Apr 1 02:35:23 2007
@@ -3624,11 +3624,11 @@
Module *M = I.getParent()->getParent()->getParent();
const char *FnName = 0;
if (I.getType() == Type::Int16Ty)
- FnName = "llvm.bswap.i16";
+ FnName = "llvm.bswap.i16.i16";
else if (I.getType() == Type::Int32Ty)
- FnName = "llvm.bswap.i32";
+ FnName = "llvm.bswap.i32.i32";
else if (I.getType() == Type::Int64Ty)
- FnName = "llvm.bswap.i64";
+ FnName = "llvm.bswap.i64.i64";
else
assert(0 && "Unknown integer type!");
Constant *F = M->getOrInsertFunction(FnName, I.getType(), I.getType(), NULL);
@@ -5173,29 +5173,11 @@
default: break;
}
} else if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Op0)) {
- // Handle set{eq|ne} <intrinsic>, intcst.
- switch (II->getIntrinsicID()) {
- default: break;
- case Intrinsic::bswap_i16:
- // icmp eq (bswap(x)), c -> icmp eq (x,bswap(c))
- AddToWorkList(II); // Dead?
- I.setOperand(0, II->getOperand(1));
- I.setOperand(1, ConstantInt::get(Type::Int16Ty,
- ByteSwap_16(CI->getZExtValue())));
- return &I;
- case Intrinsic::bswap_i32:
- // icmp eq (bswap(x)), c -> icmp eq (x,bswap(c))
- AddToWorkList(II); // Dead?
- I.setOperand(0, II->getOperand(1));
- I.setOperand(1, ConstantInt::get(Type::Int32Ty,
- ByteSwap_32(CI->getZExtValue())));
- return &I;
- case Intrinsic::bswap_i64:
- // icmp eq (bswap(x)), c -> icmp eq (x,bswap(c))
- AddToWorkList(II); // Dead?
+ // Handle icmp {eq|ne} <intrinsic>, intcst.
+ if (II->getIntrinsicID() == Intrinsic::bswap) {
+ AddToWorkList(II);
I.setOperand(0, II->getOperand(1));
- I.setOperand(1, ConstantInt::get(Type::Int64Ty,
- ByteSwap_64(CI->getZExtValue())));
+ I.setOperand(1, ConstantInt::get(CI->getValue().byteSwap()));
return &I;
}
}
More information about the llvm-commits
mailing list