diff options
| author | Reid Kleckner <reid@kleckner.net> | 2014-11-03 23:52:09 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2014-11-03 23:52:09 +0000 |
| commit | 06ea7d6213e0be131137218977ec7873f638d8eb (patch) | |
| tree | b1d86f7a563776b2a9497635a39eddb0bcec1f02 /clang/lib/CodeGen | |
| parent | 4cad00abf3bb33d91382931a10a59aaa38df7763 (diff) | |
| download | bcm5719-llvm-06ea7d6213e0be131137218977ec7873f638d8eb.tar.gz bcm5719-llvm-06ea7d6213e0be131137218977ec7873f638d8eb.zip | |
Lower __builtin_fabs* to @llvm.fabs.*
mingw64's headers implement fabs by calling __builtin_fabs, so using the
library call results in an infinite loop. If the backend legalizes
@llvm.fabs as a call to fabs later, things should work out, as the crt
provides a definition.
llvm-svn: 221206
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 0972e28069d..aa11a906f40 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -245,6 +245,13 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, return RValue::get(Result); } + case Builtin::BI__builtin_fabs: + case Builtin::BI__builtin_fabsf: + case Builtin::BI__builtin_fabsl: { + Value *Arg1 = EmitScalarExpr(E->getArg(0)); + Value *Result = EmitFAbs(*this, Arg1); + return RValue::get(Result); + } case Builtin::BI__builtin_fmod: case Builtin::BI__builtin_fmodf: case Builtin::BI__builtin_fmodl: { |

