summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/libcalls.c
Commit message (Collapse)AuthorAgeFilesLines
* [FunctionAttrs] Annotate "willreturn" for intrinsicsHideto Ueno2019-07-281-1/+1
| | | | | | | | | | | | | | | | | | | Summary: In D62801, new function attribute `willreturn` was introduced. In short, a function with `willreturn` is guaranteed to come back to the call site(more precise definition is in LangRef). In this patch, willreturn is annotated for LLVM intrinsics. Reviewers: jdoerfert Reviewed By: jdoerfert Subscribers: jvesely, nhaehnle, sstefan1, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64904 llvm-svn: 367184
* [CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsicsSanjay Patel2017-12-011-6/+6
| | | | | | | | | | | | | | | | There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef: http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign, fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents. This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a check for const-ness to make sure we're not doing the transform if errno could possibly be set by the libcall or builtin. Differential Revision: https://reviews.llvm.org/D40044 llvm-svn: 319593
* [CodeGen] fix const-ness of cbrt and fmaSanjay Patel2017-11-131-8/+6
| | | | | | | | | | | cbrt() is always constant because it can't overflow or underflow. Therefore, it can't set errno. fma() is not always constant because it can overflow or underflow. Therefore, it can set errno. But we know that it never sets errno on GNU / MSVC, so make it constant in those environments. Differential Revision: https://reviews.llvm.org/D39641 llvm-svn: 318093
* [CodeGen] map sqrt libcalls to llvm.sqrt when errno is not setSanjay Patel2017-10-311-13/+12
| | | | | | | | | | | | | | | | | The LLVM sqrt intrinsic definition changed with: D28797 ...so we don't have to use any relaxed FP settings other than errno handling. This patch sidesteps a question raised in PR27435: https://bugs.llvm.org/show_bug.cgi?id=27435 Is a programmer using __builtin_sqrt() invoking the compiler's intrinsic definition of sqrt or the mathlib definition of sqrt? But we have an answer now: the builtin should match the behavior of the libm function including errno handling. Differential Revision: https://reviews.llvm.org/D39204 llvm-svn: 317031
* Fix tests after speculatable intrinsics patchMatt Arsenault2017-05-031-2/+2
| | | | | | These were relying on the attribute group numbering llvm-svn: 301996
* Update clang test to cover for new treatment of intrinsics as readnone.Raul E. Silvera2014-03-061-4/+4
| | | | llvm-svn: 203056
* Fix broken CHECK linesNico Rieck2014-02-161-2/+2
| | | | llvm-svn: 201477
* Restore the sqrt -> llvm.sqrt mapping in fast-math modeHal Finkel2013-09-121-0/+5
| | | | | | | | | | | | | | | This restores the sqrt -> llvm.sqrt mapping, but only in fast-math mode (specifically, when the UnsafeFPMath or NoNaNsFPMath CodeGen options are enabled). The @llvm.sqrt* intrinsics have slightly different semantics from the libm call, specifically, they are undefined when given a non-zero negative number (the libm calls will always return NaN for any negative number). This mapping was removed in r100613, and replaced with a TODO, but at that time the fast-math flags were not yet implemented. Now that we have these, restoring this mapping is important because it will enable autovectorization of sqrt calls in loops (at least in fast-math mode). llvm-svn: 190646
* CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin2013-08-151-6/+6
| | | | | | tests fail. llvm-svn: 188447
* Fix FileCheck --check-prefix lines.Tim Northover2013-08-121-2/+2
| | | | | | | | | | Various tests had sprung up over the years which had --check-prefix=ABC on the RUN line, but "CHECK-ABC:" later on. This happened to work before, but was strictly incorrect. FileCheck is getting stricter soon though. Patch by Ron Ofir. llvm-svn: 188174
* Reapply r176133 with testcase fixes.Bill Wendling2013-02-271-17/+16
| | | | llvm-svn: 176145
* Fix testcases to not rely upon target-* attributes.Bill Wendling2013-02-261-43/+40
| | | | llvm-svn: 176135
* Revert "Add more attributes from the command line to functions."Anna Zaks2013-02-251-40/+43
| | | | | | | | This reverts commit 176009. The commit is a likely cause of several buildbot failures. llvm-svn: 176044
* Add more attributes from the command line to functions.Bill Wendling2013-02-251-43/+40
| | | | | | | This is an ongoing process. Any command line option which a back-end cares about should be added here. llvm-svn: 176009
* Modify the tests to use attribute group references instead of listing theBill Wendling2013-02-201-36/+45
| | | | | | function attributes. llvm-svn: 175606
* Add atan, atan2, exp, and log to the builtin math library functions.Chad Rosier2012-04-241-0/+45
| | | | | | | | | With -fno-math-errno (the default for Darwin) or -ffast-math these library function can be marked readnone enabling more opportunities for CSE and other optimizations. rdar://11251464 llvm-svn: 155498
* 'pure' and 'const' functions should also be marked nounwind. MigrateEric Christopher2011-08-151-3/+3
| | | | | | | test over from llvm/test/FrontendC++ and update others to account for the change. llvm-svn: 137669
* Add codegen support for the fma/fmal/fmaf builtins.Cameron Zwarich2011-07-081-0/+23
| | | | llvm-svn: 134743
* @llvm.sqrt isn't really close enough to C's sqrt to justify emitting callsJohn McCall2010-04-071-10/+40
| | | | | | | | to the intrinsic, even when math-errno is off. Fixes rdar://problem/7828230 by falling back on the library function. llvm-svn: 100613
* Use -fno-math-errno by default, and remove the IsMathErrnoDefaultDan Gohman2010-01-081-2/+2
| | | | | | targethook, which is no longer being used. This fixes PR5971. llvm-svn: 92987
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-2/+2
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Switch -f{builtin,math-errno,rtti} and -analyzer-purge-dead to -...no... ↵Daniel Dunbar2009-11-191-2/+2
| | | | | | variants instead of using llvm::cl::init(true) arguments. llvm-svn: 89315
* Eliminate &&s in tests.Daniel Dunbar2009-11-081-5/+5
| | | | | | - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious. llvm-svn: 86430
* Add a target triple to a couple of tests which depend on it. Reported Eli Friedman2009-06-181-2/+2
| | | | | | by Mark Cianciosa on cfe-dev. llvm-svn: 73672
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-2/+2
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Support IRgen of sqrt -> llvm.sqrt, pow -> llvm.pow.Daniel Dunbar2009-02-161-0/+22
- Define pow[lf]?, sqrt[lf]? as builtins. - Add -fmath-errno option which binds to LangOptions.MathErrno - Add new builtin flag Builtin::Context::isConstWithoutErrno for functions which can be marked as const if errno isn't respected for math functions. Sema automatically marks these functions as const when they are defined, if MathErrno=0. - IRgen uses const attribute on sqrt and pow library functions to decide if it can use the llvm intrinsic. llvm-svn: 64689
OpenPOWER on IntegriCloud