r187079 - Partial revert of r185568.
Eli Bendersky
eliben at google.com
Wed Jul 24 14:22:01 PDT 2013
Author: eliben
Date: Wed Jul 24 16:22:01 2013
New Revision: 187079
URL: http://llvm.org/viewvc/llvm-project?rev=187079&view=rev
Log:
Partial revert of r185568.
r186899 and r187061 added a preferred way for some architectures not to get
intrinsic generation for math builtins. So the code changes in r185568 can
now be undone (the test remains).
Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/lib/CodeGen/TargetInfo.h
cfe/trunk/test/CodeGen/le32-libcall-pow.c
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=187079&r1=187078&r2=187079&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Jul 24 16:22:01 2013
@@ -1293,17 +1293,14 @@ RValue CodeGenFunction::EmitBuiltinExpr(
case Builtin::BIpow:
case Builtin::BIpowf:
case Builtin::BIpowl: {
- // Transform a call to pow* into a @llvm.pow.* intrinsic call, but only
- // if the target agrees.
- if (getTargetHooks().emitIntrinsicForPow()) {
- if (!FD->hasAttr<ConstAttr>())
- break;
- Value *Base = EmitScalarExpr(E->getArg(0));
- Value *Exponent = EmitScalarExpr(E->getArg(1));
- llvm::Type *ArgType = Base->getType();
- Value *F = CGM.getIntrinsic(Intrinsic::pow, ArgType);
- return RValue::get(Builder.CreateCall2(F, Base, Exponent));
- }
+ // Transform a call to pow* into a @llvm.pow.* intrinsic call.
+ if (!FD->hasAttr<ConstAttr>())
+ break;
+ Value *Base = EmitScalarExpr(E->getArg(0));
+ Value *Exponent = EmitScalarExpr(E->getArg(1));
+ llvm::Type *ArgType = Base->getType();
+ Value *F = CGM.getIntrinsic(Intrinsic::pow, ArgType);
+ return RValue::get(Builder.CreateCall2(F, Base, Exponent));
break;
}
Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=187079&r1=187078&r2=187079&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Jul 24 16:22:01 2013
@@ -443,10 +443,6 @@ class PNaClTargetCodeGenInfo : public Ta
public:
PNaClTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT)
: TargetCodeGenInfo(new PNaClABIInfo(CGT)) {}
-
- /// For PNaCl we don't want llvm.pow.* intrinsics to be emitted instead
- /// of library function calls.
- bool emitIntrinsicForPow() const { return false; }
};
void PNaClABIInfo::computeInfo(CGFunctionInfo &FI) const {
Modified: cfe/trunk/lib/CodeGen/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.h?rev=187079&r1=187078&r2=187079&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.h (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.h Wed Jul 24 16:22:01 2013
@@ -74,10 +74,6 @@ namespace clang {
/// through such registers.
virtual bool extendPointerWithSExt() const { return false; }
- /// Controls whether BIpow* emit an intrinsic call instead of a library
- /// function call.
- virtual bool emitIntrinsicForPow() const { return true; }
-
/// Determines the DWARF register number for the stack pointer, for
/// exception-handling purposes. Implements __builtin_dwarf_sp_column.
///
Modified: cfe/trunk/test/CodeGen/le32-libcall-pow.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/le32-libcall-pow.c?rev=187079&r1=187078&r2=187079&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/le32-libcall-pow.c (original)
+++ cfe/trunk/test/CodeGen/le32-libcall-pow.c Wed Jul 24 16:22:01 2013
@@ -1,7 +1,13 @@
-// RUN: %clang_cc1 -fmath-errno -emit-llvm -o - %s -triple le32-unknown-nacl | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - %s -triple le32-unknown-nacl | FileCheck %s
+// RUN: %clang_cc1 -fno-math-builtin -fmath-errno -emit-llvm -o - %s -triple le32-unknown-nacl | FileCheck %s
+// RUN: %clang_cc1 -fno-math-builtin -emit-llvm -o - %s -triple le32-unknown-nacl | FileCheck %s
-// le32 (PNaCl) never generates intrinsics for pow calls, with or without errno
+// le32 (PNaCl) never generates intrinsics for pow calls, with or without
+// errno, when the -fno-math-builtin flag is passed to -cc1. A separate test
+// makes sure this flag is indeed passed for le32.
+
+float powf(float, float);
+double pow(double, double);
+long double powl(long double, long double);
// CHECK: define void @test_pow
void test_pow(float a0, double a1, long double a2) {
More information about the cfe-commits
mailing list