aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/IntrinsicLowering.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-01-16 21:12:35 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-01-16 21:12:35 +0000
commit0b118206bf3411722707f2e5cab8fd2eedcd50d6 (patch)
tree1a222f39010130f9e1a5a30f5937bf323b7265eb /lib/CodeGen/IntrinsicLowering.cpp
parente86bf519e1ea57a84d37422ec364f89c322e3ef4 (diff)
For PR411:
This patch is an incremental step towards supporting a flat symbol table. It de-overloads the intrinsic functions by providing type-specific intrinsics and arranging for automatically upgrading from the old overloaded name to the new non-overloaded name. Specifically: llvm.isunordered -> llvm.isunordered.f32, llvm.isunordered.f64 llvm.sqrt -> llvm.sqrt.f32, llvm.sqrt.f64 llvm.ctpop -> llvm.ctpop.i8, llvm.ctpop.i16, llvm.ctpop.i32, llvm.ctpop.i64 llvm.ctlz -> llvm.ctlz.i8, llvm.ctlz.i16, llvm.ctlz.i32, llvm.ctlz.i64 llvm.cttz -> llvm.cttz.i8, llvm.cttz.i16, llvm.cttz.i32, llvm.cttz.i64 New code should not use the overloaded intrinsic names. Warnings will be emitted if they are used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25366 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/IntrinsicLowering.cpp')
-rw-r--r--lib/CodeGen/IntrinsicLowering.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp
index 7c2008233c..c47a107cc3 100644
--- a/lib/CodeGen/IntrinsicLowering.cpp
+++ b/lib/CodeGen/IntrinsicLowering.cpp
@@ -113,11 +113,13 @@ void DefaultIntrinsicLowering::AddPrototypes(Module &M) {
Type::IntTy, (--(--I->arg_end()))->getType(),
(Type *)0);
break;
- case Intrinsic::isunordered:
+ case Intrinsic::isunordered_f32:
+ case Intrinsic::isunordered_f64:
EnsureFunctionExists(M, "isunordered", I->arg_begin(), I->arg_end(),
Type::BoolTy);
break;
- case Intrinsic::sqrt:
+ case Intrinsic::sqrt_f32:
+ case Intrinsic::sqrt_f64:
if(I->arg_begin()->getType() == Type::FloatTy)
EnsureFunctionExists(M, "sqrtf", I->arg_begin(), I->arg_end(),
Type::FloatTy);
@@ -326,22 +328,30 @@ void DefaultIntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
AbortFCache);
break;
}
-
+ case Intrinsic::ctpop_i8:
+ case Intrinsic::ctpop_i16:
+ case Intrinsic::ctpop_i32:
+ case Intrinsic::ctpop_i64:
+ CI->replaceAllUsesWith(LowerCTPOP(CI->getOperand(1), CI));
+ break;
+
case Intrinsic::bswap_i16:
case Intrinsic::bswap_i32:
case Intrinsic::bswap_i64:
CI->replaceAllUsesWith(LowerBSWAP(CI->getOperand(1), CI));
break;
- case Intrinsic::ctpop:
- CI->replaceAllUsesWith(LowerCTPOP(CI->getOperand(1), CI));
- break;
-
- case Intrinsic::ctlz:
+ case Intrinsic::ctlz_i8:
+ case Intrinsic::ctlz_i16:
+ case Intrinsic::ctlz_i32:
+ case Intrinsic::ctlz_i64:
CI->replaceAllUsesWith(LowerCTLZ(CI->getOperand(1), CI));
break;
- case Intrinsic::cttz: {
+ case Intrinsic::cttz_i8:
+ case Intrinsic::cttz_i16:
+ case Intrinsic::cttz_i32:
+ case Intrinsic::cttz_i64: {
// cttz(x) -> ctpop(~X & (X-1))
Value *Src = CI->getOperand(1);
Value *NotSrc = BinaryOperator::createNot(Src, Src->getName()+".not", CI);
@@ -419,7 +429,8 @@ void DefaultIntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
(*(CI->op_begin()+1))->getType(), MemsetFCache);
break;
}
- case Intrinsic::isunordered: {
+ case Intrinsic::isunordered_f32:
+ case Intrinsic::isunordered_f64: {
Value *L = CI->getOperand(1);
Value *R = CI->getOperand(2);
@@ -430,7 +441,8 @@ void DefaultIntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
"isunordered", CI));
break;
}
- case Intrinsic::sqrt: {
+ case Intrinsic::sqrt_f32:
+ case Intrinsic::sqrt_f64: {
static Function *sqrtFCache = 0;
static Function *sqrtfFCache = 0;
if(CI->getType() == Type::FloatTy)