summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/intrinsics.ll
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Temporarily Revert "Add basic loop fusion pass.""Eric Christopher2019-04-171-0/+427
| | | | | | | | The reversion apparently deleted the test/Transforms directory. Will be re-reverting again. llvm-svn: 358552
* Temporarily Revert "Add basic loop fusion pass."Eric Christopher2019-04-171-427/+0
| | | | | | | | As it's causing some bot failures (and per request from kbarton). This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda. llvm-svn: 358546
* [InstCombine] Move with.overflow tests to separate file; NFCNikita Popov2019-02-241-303/+0
| | | | | | | | | And regenerate checks. I had to rename some variables, because update_test_checks can't deal with the same variable names used in lower and upper case. I've also dropped the result type aliases, as just using the type directly gives a cleaner result. llvm-svn: 354759
* [InstCombine] Simplify cttz/ctlz + icmp eq/ne into mask checkNikita Popov2018-12-181-10/+2
| | | | | | | | | | | | | Checking whether a number has a certain number of trailing / leading zeros means checking whether it is of the form XXXX1000 / 0001XXXX, which can be done with an and+icmp. Related to https://bugs.llvm.org/show_bug.cgi?id=28668. As a next step, this can be extended to non-equality predicates. Differential Revision: https://reviews.llvm.org/D55745 llvm-svn: 349530
* [InstCombine] Make cttz/ctlz knownbits tests more robust; NFCNikita Popov2018-12-161-20/+12
| | | | | | | Tests checking for the addition of !range metadata should be preserved if cttz/ctlz + icmp is optimized. llvm-svn: 349318
* Revert "[InstCombine] Regenerate test checks; NFC"Nikita Popov2018-12-161-166/+117
| | | | | | | | This reverts commit r349311. Didn't check this carefully enough... llvm-svn: 349312
* [InstCombine] Regenerate test checks; NFCNikita Popov2018-12-161-117/+166
| | | | llvm-svn: 349311
* Move tests associated with transforms moved in r321467 Philip Reames2017-12-301-8/+0
| | | | llvm-svn: 321572
* [instcombine] add powi(x, 2) -> x * xPhilip Reames2017-12-271-0/+5
| | | | llvm-svn: 321468
* Fix some misc. -enable-var-scope violationsMatt Arsenault2017-11-131-4/+4
| | | | llvm-svn: 318006
* [InstCombine] move and improve tests for cmp-intrinsic; NFCSanjay Patel2017-07-031-60/+0
| | | | llvm-svn: 307022
* [InstCombine] Add range metadata to cttz/ctlz/ctpop intrinsic calls based on ↵Craig Topper2017-06-211-12/+29
| | | | | | | | | | | | | | | | | | | | | known bits Summary: I noticed that passing known bits across these intrinsics isn't great at capturing the information we really know. Turning known bits of the input into known bits of a count output isn't able to convey a lot of what we really know. This patch adds range metadata to these intrinsics based on the known bits. Currently the patch punts if we already have range metadata present. Reviewers: spatel, RKSimon, davide, majnemer Reviewed By: RKSimon Subscribers: sanjoy, hfinkel, llvm-commits Differential Revision: https://reviews.llvm.org/D32582 llvm-svn: 305927
* [InstCombine] Add support for simplifying ctlz/cttz intrinsics based on ↵Craig Topper2017-06-031-10/+4
| | | | | | known bits. llvm-svn: 304669
* [ConstantFolding] Fix constant folding for vector cttz and ctlz intrinsics ↵Craig Topper2017-06-031-4/+2
| | | | | | to understand that the second argument is still a scalar. llvm-svn: 304668
* [InstCombine][InstSimplify] Add various tests for ctlz/cttz with vectors, ↵Craig Topper2017-06-031-0/+160
| | | | | | some showing missed optimizations. NFC llvm-svn: 304667
* [InstCombine] Use cttz instead of ctlz in the cttz_cmp_vec test case. Looks ↵Craig Topper2017-06-031-1/+1
| | | | | | like a copy paste mistake. llvm-svn: 304666
* [InstCombine] Add test cases to show missed opportunities to remove compare ↵Craig Topper2017-05-301-0/+28
| | | | | | instructions after cttz/ctlz/ctpop where some bits of the input is known. llvm-svn: 304224
* [ValueTracking] Use KnownOnes to provide a better bound on known zeros for ↵Craig Topper2017-05-081-4/+25
| | | | | | | | | | ctlz/cttz intrinics This patch uses KnownOnes of the input of ctlz/cttz to bound the value that can be returned from these intrinsics. This makes these intrinsics more similar to the handling for ctpop which already uses known bits to produce a similar bound. Differential Revision: https://reviews.llvm.org/D32521 llvm-svn: 302444
* Replace hardcoded intrinsic list with speculatable attribute.Matt Arsenault2017-05-031-2/+2
| | | | | | No change in which intrinsics should be speculated. llvm-svn: 301995
* [InstCombine] Add test cases for opportunities to improve knownbits handling ↵Craig Topper2017-04-261-0/+26
| | | | | | for cttz and ctlz intrinsics. llvm-svn: 301385
* [InstCombine / InstSimplify] add and move tests for lshr transforms; NFCSanjay Patel2017-01-131-22/+1
| | | | llvm-svn: 291970
* Make cltz and cttz zero undef when the operand cannot be zero in InstCombineAmaury Sechet2016-08-181-0/+20
| | | | | | | | | | | | Summary: Also add popcount(n) == bitsize(n) -> n == -1 transformation. Reviewers: majnemer, spatel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D23134 llvm-svn: 279141
* reduce tests; auto-generate checksSanjay Patel2016-08-051-59/+68
| | | | llvm-svn: 277819
* Fix intrinsics.ll testAmaury Sechet2016-08-041-3/+3
| | | | llvm-svn: 277695
* Add popcount(n) == bitsize(n) -> n == -1 transformation.Amaury Sechet2016-08-041-12/+22
| | | | | | | | | | | | Summary: As per title. Reviewers: majnemer, spatel Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D23139 llvm-svn: 277694
* [InstCombine] allow icmp (bit-manipulation-intrinsic(), C) folds for vectorsSanjay Patel2016-07-231-8/+3
| | | | llvm-svn: 276523
* add tests for vector bit manipulation intrinsicsSanjay Patel2016-07-221-2/+40
| | | | llvm-svn: 276451
* Constfold trunc,rint,nearbyint,ceil and floor using APFloatKarthik Bhat2015-07-211-0/+65
| | | | | | | | A patch by Chakshu Grover! This patch allows constfolding of trunc,rint,nearbyint,ceil and floor intrinsics using APFloat class. Differential Revision: http://reviews.llvm.org/D11144 llvm-svn: 242763
* Allow constfolding of llvm.sin.* and llvm.cos.* intrinsicsKarthik Bhat2015-07-081-0/+22
| | | | | | | | This patch const folds llvm.sin.* and llvm.cos.* intrinsics whenever feasible. Differential Revision: http://reviews.llvm.org/D10836 llvm-svn: 241665
* [InstSimplify] Handle some overflow intrinsics in InstSimplifyDavid Majnemer2015-05-221-2/+2
| | | | | | | | | This change does a few things: - Move some InstCombine transforms to InstSimplify - Run SimplifyCall from within InstCombine::visitCallInst - Teach InstSimplify to fold [us]mul_with_overflow(X, undef) to 0. llvm-svn: 237995
* [InstCombine] X - 0 is equal to X, not undefDavid Majnemer2015-05-211-0/+8
| | | | | | | | | A refactoring made @llvm.ssub.with.overflow.i32(i32 %X, i32 0) transform into undef instead of %X. This fixes PR23624. llvm-svn: 237968
* Subtraction is not commutative. Fixes PR23212!Nick Lewycky2015-04-131-0/+10
| | | | llvm-svn: 234780
* Teach ComputeNumSignBits about signed reminder.Nadav Rotem2015-03-061-0/+21
| | | | | | This optimization a continuation of r231140 that reasoned about signed div. llvm-svn: 231433
* Teach ComputeNumSignBits about signed divisions.Nadav Rotem2015-03-031-0/+23
| | | | | | | http://reviews.llvm.org/D8028 rdar://20023136 llvm-svn: 231140
* [InstCombine] Teach how to fold a select into a cttz/ctlz with the ↵Andrea Di Biagio2015-01-271-2/+4
| | | | | | | | | | | 'is_zero_undef' flag. This patch teaches the Instruction Combiner how to fold a cttz/ctlz followed by a icmp plus select into a single cttz/ctlz with flag 'is_zero_undef' cleared. Added test InstCombine/select-cmp-cttz-ctlz.ll. llvm-svn: 227197
* InstCombine: Detect when llvm.umul.with.overflow always overflowsDavid Majnemer2015-01-021-0/+13
| | | | | | | We know overflow always occurs if both ~LHSKnownZero * ~RHSKnownZero and LHSKnownOne * RHSKnownOne overflow. llvm-svn: 225077
* InstCombine: Infer nuw for multipliesDavid Majnemer2014-12-261-1/+1
| | | | | | | A multiply cannot unsigned wrap if there are bitwidth, or more, leading zero bits between the two operands. llvm-svn: 224849
* Strength reduce intrinsics with overflow into regular arithmetic operations ↵Erik Eckstein2014-12-171-12/+91
| | | | | | | | | | if possible. Some intrinsics, like s/uadd.with.overflow and umul.with.overflow, are already strength reduced. This change adds other arithmetic intrinsics: s/usub.with.overflow, smul.with.overflow. It completes the work on PR20194. llvm-svn: 224417
* InstCombine: Strength reduce sadd.with.overflow into a regular nsw add if we ↵Benjamin Kramer2014-07-041-0/+13
| | | | | | | | can prove that it cannot overflow. PR20194 llvm-svn: 212331
* Update Transforms tests to use CHECK-LABEL for easier debugging. No ↵Stephen Lin2013-07-141-20/+20
| | | | | | | | | | | | | | | | | | | | | | functionality change. This update was done with the following bash script: find test/Transforms -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_]*\):\( *\)@$FUNC\([( ]*\)\$/;\1\2-LABEL:\3@$FUNC(/g" $TEMP done mv $TEMP $NAME fi done llvm-svn: 186268
* Revert "Have InstCombine call SipmlifyCall when handling calls. Test case ↵Andrew Trick2013-02-081-14/+2
| | | | | | | | | | included." This reverts commit 3854a5d90fee52af1065edbed34521fff6cdc18d. This causes a clang unit test to hang: vtable-available-externally.cpp. llvm-svn: 174692
* Have InstCombine call SipmlifyCall when handling calls. Test case included.Michael Ilseman2013-02-071-2/+14
| | | | llvm-svn: 174675
* ConstantFolding: Add a missing folding that leads to a miscompile.Benjamin Kramer2013-01-241-0/+36
| | | | | | | | | | We use constant folding to see if an intrinsic evaluates to the same value as a constant that we know. If we don't take the undefinedness into account we get a value that doesn't match the actual implementation, and miscompiled code. This was uncovered by Chandler's simplifycfg changes. llvm-svn: 173356
* Tests: rewrite 'opt ... %s' to 'opt ... < %s' so that opt does not emit a ↵Dmitri Gribenko2013-01-011-1/+1
| | | | | | | | | | ModuleID This is done to avoid odd test failures, like the one fixed in r171243. My previous regex was not good enough to find these. llvm-svn: 171343
* Add an explicit test that we now fold cttz.i32(..., true) >> 5 -> 0.Chandler Carruth2011-12-241-7/+13
| | | | | | This is a result of Benjamin's work on ValueTracking. llvm-svn: 147259
* ComputeMaskedBits: Make knownzero computation more aggressive for ctlz with ↵Benjamin Kramer2011-12-241-3/+3
| | | | | | | | | undef zero. unsigned foo(unsigned x) { return 31 - __builtin_clz(x); } now compiles into a single "bsrl" instruction on x86. llvm-svn: 147255
* Manually upgrade the test suite to specify the flag to cttz and ctlz.Chandler Carruth2011-12-121-8/+8
| | | | | | | | | | | | | | | | | | | | | | | I followed three heuristics for deciding whether to set 'true' or 'false': - Everything target independent got 'true' as that is the expected common output of the GCC builtins. - If the target arch only has one way of implementing this operation, set the flag in the way that exercises the most of codegen. For most architectures this is also the likely path from a GCC builtin, with 'true' being set. It will (eventually) require lowering away that difference, and then lowering to the architecture's operation. - Otherwise, set the flag differently dependending on which target operation should be tested. Let me know if anyone has any issue with this pattern or would like specific tests of another form. This should allow the x86 codegen to just iteratively improve as I teach the backend how to differentiate between the two forms, and everything else should remain exactly the same. llvm-svn: 146370
* Upgrade syntax of tests using volatile instructions to use 'load volatile' ↵Chris Lattner2011-11-271-6/+6
| | | | | | instead of 'volatile load', which is archaic. llvm-svn: 145171
* Move "atomic" and "volatile" designations on instructions after the opcodeEli Friedman2011-08-121-6/+6
| | | | | | | | | | of the instruction. Note that this change affects the existing non-atomic load and store instructions; the parser now accepts both forms, and the change is noted in the release notes. llvm-svn: 137527
* make the asmparser reject function and type redefinitions. 'Merging' hasn't ↵Chris Lattner2011-06-171-1/+0
| | | | | | | | been needed since llvm-gcc 3.4 days. llvm-svn: 133248
OpenPOWER on IntegriCloud