summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/apint-shift.ll
Commit message (Collapse)AuthorAgeFilesLines
* [InstCombine] allow shl demanded bits folds with splat constantsSanjay Patel2017-04-201-5/+2
| | | | | | More fixes are needed to enable the helper SimplifyShrShlDemandedBits(). llvm-svn: 300898
* [InstCombine] allow (X * C2) << C1 --> X * (C2 << C1) for vectorsSanjay Patel2017-02-091-0/+14
| | | | | | | | | | This fold already existed for vectors but only when 'C1' was a splat constant (but 'C2' could be any constant). There were no tests for any vector constants, so I'm adding a test that shows non-splat constants for both operands. llvm-svn: 294650
* fix typos; NFCSanjay Patel2017-02-011-4/+4
| | | | llvm-svn: 293816
* [InstCombine] move folds for shift-shift pairs; NFCISanjay Patel2017-02-011-0/+52
| | | | | | | | | | | Although this is 'no-functional-change-intended', I'm adding tests for shl-shl and lshr-lshr pairs because there is no existing test coverage for those folds. It seems like we should be able to remove some code from foldShiftedShift() at this point because we're handling those patterns on the general path. llvm-svn: 293814
* [InstCombine] fold (X >>u C) << C --> X & (-1 << C)Sanjay Patel2017-01-261-4/+4
| | | | | | | | | | | | | | | We already have this fold when the lshr has one use, but it doesn't need that restriction. We may be able to remove some code from foldShiftedShift(). Also, move the similar: (X << C) >>u C --> X & (-1 >>u C) ...directly into visitLShr to help clean up foldShiftByConstOfShiftByConst(). That whole function seems questionable since it is called by commonShiftTransforms(), but there's really not much in common if we're checking the shift opcodes for every fold. llvm-svn: 293215
* [InstCombine] use m_APInt to allow (X << C) >>u C --> X & (-1 >>u C) with ↵Sanjay Patel2017-01-261-2/+2
| | | | | | splat vectors llvm-svn: 293208
* [InstCombine] add tests for shift-shift folds; NFCSanjay Patel2017-01-261-0/+60
| | | | llvm-svn: 293205
* [InstCombine] use m_APInt to allow shift-shift folds for vectors with splat ↵Sanjay Patel2017-01-161-24/+18
| | | | | | | | constants Some existing 'FIXME' tests are still not folded because of splat holes in value tracking. llvm-svn: 292151
* [InstCombine] add tests to show missed vector folds; NFCSanjay Patel2017-01-161-7/+82
| | | | | | | The shift-shift possibilities became easier to see after: https://reviews.llvm.org/rL292145 llvm-svn: 292150
* [InstCombine] add tests to show missed vector folds; NFCSanjay Patel2017-01-151-12/+42
| | | | | | Also, add comments and remove bogus comment. llvm-svn: 292082
* [InstCombine] use m_APInt to allow icmp (and (sh X, Y), C2), C1 folds for ↵Sanjay Patel2016-09-071-3/+1
| | | | | | splat constant vectors llvm-svn: 280873
* [InstCombine] use m_APInt to allow icmp (and X, Y), C folds for splat ↵Sanjay Patel2016-08-281-3/+1
| | | | | | constant vectors llvm-svn: 279937
* [InstCombine] use m_APInt to allow icmp eq/ne (shr X, C2), C folds for splat ↵Sanjay Patel2016-08-241-8/+5
| | | | | | constant vectors llvm-svn: 279677
* [InstCombine] add tests for missing vector icmp foldsSanjay Patel2016-08-151-0/+37
| | | | llvm-svn: 278689
* [InstCombine] auto-generate exact checksSanjay Patel2016-08-151-150/+209
| | | | | | | Note that several of these tests belong in InstSimplify rather than InstCombine because they return existing operands or constants. llvm-svn: 278684
* [InstCombine] add test for missing vector icmp foldSanjay Patel2016-08-141-6/+22
| | | | llvm-svn: 278639
* Update Transforms tests to use CHECK-LABEL for easier debugging. No ↵Stephen Lin2013-07-141-30/+30
| | | | | | | | | | | | | | | | | | | | | | 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
* Reapply r155136 after fixing PR12599.Jakob Stoklund Olesen2012-04-231-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original commit message: Defer some shl transforms to DAGCombine. The shl instruction is used to represent multiplication by a constant power of two as well as bitwise left shifts. Some InstCombine transformations would turn an shl instruction into a bit mask operation, making it difficult for later analysis passes to recognize the constsnt multiplication. Disable those shl transformations, deferring them to DAGCombine time. An 'shl X, C' instruction is now treated mostly the same was as 'mul X, C'. These transformations are deferred: (X >>? C) << C --> X & (-1 << C) (When X >> C has multiple uses) (X >>? C1) << C2 --> X << (C2-C1) & (-1 << C2) (When C2 > C1) (X >>? C1) << C2 --> X >>? (C1-C2) & (-1 << C2) (When C1 > C2) The corresponding exact transformations are preserved, just like div-exact + mul: (X >>?,exact C) << C --> X (X >>?,exact C1) << C2 --> X << (C2-C1) (X >>?,exact C1) << C2 --> X >>?,exact (C1-C2) The disabled transformations could also prevent the instruction selector from recognizing rotate patterns in hash functions and cryptographic primitives. I have a test case for that, but it is too fragile. llvm-svn: 155362
* Revert r155136 "Defer some shl transforms to DAGCombine."Jakob Stoklund Olesen2012-04-201-13/+3
| | | | | | | | | While the patch was perfect and defect free, it exposed a really nasty bug in X86 SelectionDAG that caused an llc crash when compiling lencod. I'll put the patch back in after fixing the SelectionDAG problem. llvm-svn: 155181
* Defer some shl transforms to DAGCombine.Jakob Stoklund Olesen2012-04-191-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The shl instruction is used to represent multiplication by a constant power of two as well as bitwise left shifts. Some InstCombine transformations would turn an shl instruction into a bit mask operation, making it difficult for later analysis passes to recognize the constsnt multiplication. Disable those shl transformations, deferring them to DAGCombine time. An 'shl X, C' instruction is now treated mostly the same was as 'mul X, C'. These transformations are deferred: (X >>? C) << C --> X & (-1 << C) (When X >> C has multiple uses) (X >>? C1) << C2 --> X << (C2-C1) & (-1 << C2) (When C2 > C1) (X >>? C1) << C2 --> X >>? (C1-C2) & (-1 << C2) (When C1 > C2) The corresponding exact transformations are preserved, just like div-exact + mul: (X >>?,exact C) << C --> X (X >>?,exact C1) << C2 --> X << (C2-C1) (X >>?,exact C1) << C2 --> X >>?,exact (C1-C2) The disabled transformations could also prevent the instruction selector from recognizing rotate patterns in hash functions and cryptographic primitives. I have a test case for that, but it is too fragile. llvm-svn: 155136
* FileCheckizeJakob Stoklund Olesen2012-04-181-2/+59
| | | | llvm-svn: 155010
* Nobody likes shifty instructions, but that was a bit strong.Jakob Stoklund Olesen2012-04-181-1/+1
| | | | llvm-svn: 155009
* change the preferred canonical form for a sign extension to beChris Lattner2010-01-101-7/+0
| | | | | | | | lshr+ashr instead of trunc+sext. We want to avoid type conversions whenever possible, it is easier to codegen expressions without truncates and extensions. llvm-svn: 93107
* Use opt -S instead of piping bitcode output through llvm-dis.Dan Gohman2009-09-081-1/+1
| | | | llvm-svn: 81257
* Change these tests to feed the assembly files to opt directly, insteadDan Gohman2009-09-081-1/+1
| | | | | | of using llvm-as, now that opt supports this. llvm-svn: 81226
* For PR1319:Reid Spencer2007-04-141-2/+1
| | | | | | Upgrade tests to work with new llvm.exp version of llvm_runtest. llvm-svn: 36013
* Add more test cases for APIntified InstCombine.Reid Spencer2007-03-231-0/+192
llvm-svn: 35288
OpenPOWER on IntegriCloud