[llvm-commits] [llvm-gcc-4.2] r55796 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Dale Johannesen
dalej at apple.com
Thu Sep 4 14:23:40 PDT 2008
Author: johannes
Date: Thu Sep 4 16:23:40 2008
New Revision: 55796
URL: http://llvm.org/viewvc/llvm-project?rev=55796&view=rev
Log:
Use new math intrinsics only when errno is not in use.
They are marked as not touching memory.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=55796&r1=55795&r2=55796&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Sep 4 16:23:40 2008
@@ -4509,48 +4509,67 @@
case BUILT_IN_POW:
case BUILT_IN_POWF:
case BUILT_IN_POWL:
- Result = EmitBuiltinPOW(exp);
- return true;
+ // If errno math has been disabled, expand these to llvm.pow calls.
+ if (!flag_errno_math) {
+ Result = EmitBuiltinPOW(exp);
+ return true;
+ }
+ break;
case BUILT_IN_LOG:
case BUILT_IN_LOGF:
- case BUILT_IN_LOGL: {
- Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::log);
- Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp)));
- return true;
- }
+ case BUILT_IN_LOGL:
+ // If errno math has been disabled, expand these to llvm.log calls.
+ if (!flag_errno_math) {
+ Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
+ EmitBuiltinUnaryOp(Amt, Result, Intrinsic::log);
+ Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp)));
+ return true;
+ }
+ break;
case BUILT_IN_LOG2:
case BUILT_IN_LOG2F:
- case BUILT_IN_LOG2L: {
- Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::log2);
- Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp)));
- return true;
- }
+ case BUILT_IN_LOG2L:
+ // If errno math has been disabled, expand these to llvm.log2 calls.
+ if (!flag_errno_math) {
+ Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
+ EmitBuiltinUnaryOp(Amt, Result, Intrinsic::log2);
+ Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp)));
+ return true;
+ }
+ break;
case BUILT_IN_LOG10:
case BUILT_IN_LOG10F:
- case BUILT_IN_LOG10L: {
- Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::log10);
- Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp)));
- return true;
- }
+ case BUILT_IN_LOG10L:
+ // If errno math has been disabled, expand these to llvm.log10 calls.
+ if (!flag_errno_math) {
+ Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
+ EmitBuiltinUnaryOp(Amt, Result, Intrinsic::log10);
+ Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp)));
+ return true;
+ }
+ break;
case BUILT_IN_EXP:
case BUILT_IN_EXPF:
- case BUILT_IN_EXPL: {
- Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::exp);
- Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp)));
- return true;
- }
+ case BUILT_IN_EXPL:
+ // If errno math has been disabled, expand these to llvm.exp calls.
+ if (!flag_errno_math) {
+ Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
+ EmitBuiltinUnaryOp(Amt, Result, Intrinsic::exp);
+ Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp)));
+ return true;
+ }
+ break;
case BUILT_IN_EXP2:
case BUILT_IN_EXP2F:
- case BUILT_IN_EXP2L: {
- Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- EmitBuiltinUnaryOp(Amt, Result, Intrinsic::exp2);
- Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp)));
- return true;
- }
+ case BUILT_IN_EXP2L:
+ // If errno math has been disabled, expand these to llvm.exp2 calls.
+ if (!flag_errno_math) {
+ Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
+ EmitBuiltinUnaryOp(Amt, Result, Intrinsic::exp2);
+ Result = CastToFPType(Result, ConvertType(TREE_TYPE(exp)));
+ return true;
+ }
+ break;
case BUILT_IN_FFS: // These GCC builtins always return int.
case BUILT_IN_FFSL:
case BUILT_IN_FFSLL: { // FFS(X) -> (x == 0 ? 0 : CTTZ(x)+1)
More information about the llvm-commits
mailing list