diff options
author | Meador Inge <meadori@codesourcery.com> | 2012-12-18 20:58:04 +0000 |
---|---|---|
committer | Meador Inge <meadori@codesourcery.com> | 2012-12-18 20:58:04 +0000 |
commit | 08cc03fcd97c3886b004d861aadbc28de70092c5 (patch) | |
tree | 07b0245fd5271a237fbfd1c4c0ffd8252d7e25e8 /lib/CodeGen | |
parent | e35ec2b10c2a0d53ae76a7a6c383fa6aaf7645bd (diff) |
CodeGen: Expand creal and cimag into complex field loads
PR 14529 was opened because neither Clang or LLVM was expanding
calls to creal* or cimag* into instructions that just load the
respective complex field. After some discussion, it was not
considered realistic to do this in LLVM because of the platform
specific way complex types are expanded. Thus a way to solve
this in Clang was pursued. GCC does a similar expansion.
This patch adds the feature to Clang by making the creal* and
cimag* functions library builtins and modifying the builtin code
generator to look for the new builtin types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170455 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGBuiltin.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index a1a6ef6bfa..d2824e91e7 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -244,14 +244,20 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, } case Builtin::BI__builtin_creal: case Builtin::BI__builtin_crealf: - case Builtin::BI__builtin_creall: { + case Builtin::BI__builtin_creall: + case Builtin::BIcreal: + case Builtin::BIcrealf: + case Builtin::BIcreall: { ComplexPairTy ComplexVal = EmitComplexExpr(E->getArg(0)); return RValue::get(ComplexVal.first); } case Builtin::BI__builtin_cimag: case Builtin::BI__builtin_cimagf: - case Builtin::BI__builtin_cimagl: { + case Builtin::BI__builtin_cimagl: + case Builtin::BIcimag: + case Builtin::BIcimagf: + case Builtin::BIcimagl: { ComplexPairTy ComplexVal = EmitComplexExpr(E->getArg(0)); return RValue::get(ComplexVal.second); } |