diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-07-21 18:44:41 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-07-21 18:44:41 +0000 |
commit | c2f67966f4807d7f80849838dbb672631c4f8a50 (patch) | |
tree | a21b57c5caf0e8bdae843587c516964de112fb5e /clang/lib/CodeGen/CGBuiltin.cpp | |
parent | 5b288788b3eb72380311e477ec72bb0b7508a46d (diff) | |
download | bcm5719-llvm-c2f67966f4807d7f80849838dbb672631c4f8a50.tar.gz bcm5719-llvm-c2f67966f4807d7f80849838dbb672631c4f8a50.zip |
Add __builtin_powi[fl] support
llvm-svn: 53866
Diffstat (limited to 'clang/lib/CodeGen/CGBuiltin.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index d186a716197..a85f139a0d5 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -192,6 +192,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { } case Builtin::BI__builtin_expect: + // FIXME: pass expect through to LLVM return RValue::get(EmitScalarExpr(E->getArg(0))); case Builtin::BI__builtin_bswap32: case Builtin::BI__builtin_bswap64: { @@ -226,6 +227,19 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { // Otherwise, call libm 'nan'. break; } + case Builtin::BI__builtin_powi: + case Builtin::BI__builtin_powif: + case Builtin::BI__builtin_powil: { + Value *Base = EmitScalarExpr(E->getArg(0)); + Value *Exponent = EmitScalarExpr(E->getArg(1)); + + const llvm::Type *ArgType = Base->getType(); + Value *F = CGM.getIntrinsic(Intrinsic::powi, &ArgType, 1); + + const llvm::Type *ResultType = ConvertType(E->getType()); + return RValue::get(Builder.CreateCall2(F, Base, Exponent, "tmp")); + } + case Builtin::BI__builtin_isgreater: case Builtin::BI__builtin_isgreaterequal: case Builtin::BI__builtin_isless: |