aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/ARM/GlobalISel
AgeCommit message (Collapse)Author
2017-11-07[GlobalISel] Enable legalizing non-power-of-2 sized types.Kristof Beyls
This changes the interface of how targets describe how to legalize, see the below description. 1. Interface for targets to describe how to legalize. In GlobalISel, the API in the LegalizerInfo class is the main interface for targets to specify which types are legal for which operations, and what to do to turn illegal type/operation combinations into legal ones. For each operation the type sizes that can be legalized without having to change the size of the type are specified with a call to setAction. This isn't different to how GlobalISel worked before. For example, for a target that supports 32 and 64 bit adds natively: for (auto Ty : {s32, s64}) setAction({G_ADD, 0, s32}, Legal); or for a target that needs a library call for a 32 bit division: setAction({G_SDIV, s32}, Libcall); The main conceptual change to the LegalizerInfo API, is in specifying how to legalize the type sizes for which a change of size is needed. For example, in the above example, how to specify how all types from i1 to i8388607 (apart from s32 and s64 which are legal) need to be legalized and expressed in terms of operations on the available legal sizes (again, i32 and i64 in this case). Before, the implementation only allowed specifying power-of-2-sized types (e.g. setAction({G_ADD, 0, s128}, NarrowScalar). A worse limitation was that if you'd wanted to specify how to legalize all the sized types as allowed by the LLVM-IR LangRef, i1 to i8388607, you'd have to call setAction 8388607-3 times and probably would need a lot of memory to store all of these specifications. Instead, the legalization actions that need to change the size of the type are specified now using a "SizeChangeStrategy". For example: setLegalizeScalarToDifferentSizeStrategy( G_ADD, 0, widenToLargerAndNarrowToLargest); This example indicates that for type sizes for which there is a larger size that can be legalized towards, do it by Widening the size. For example, G_ADD on s17 will be legalized by first doing WidenScalar to make it s32, after which it's legal. The "NarrowToLargest" indicates what to do if there is no larger size that can be legalized towards. E.g. G_ADD on s92 will be legalized by doing NarrowScalar to s64. Another example, taken from the ARM backend is: for (unsigned Op : {G_SDIV, G_UDIV}) { setLegalizeScalarToDifferentSizeStrategy(Op, 0, widenToLargerTypesUnsupportedOtherwise); if (ST.hasDivideInARMMode()) setAction({Op, s32}, Legal); else setAction({Op, s32}, Libcall); } For this example, G_SDIV on s8, on a target without a divide instruction, would be legalized by first doing action (WidenScalar, s32), followed by (Libcall, s32). The same principle is also followed for when the number of vector lanes on vector data types need to be changed, e.g.: setAction({G_ADD, LLT::vector(8, 8)}, LegalizerInfo::Legal); setAction({G_ADD, LLT::vector(16, 8)}, LegalizerInfo::Legal); setAction({G_ADD, LLT::vector(4, 16)}, LegalizerInfo::Legal); setAction({G_ADD, LLT::vector(8, 16)}, LegalizerInfo::Legal); setAction({G_ADD, LLT::vector(2, 32)}, LegalizerInfo::Legal); setAction({G_ADD, LLT::vector(4, 32)}, LegalizerInfo::Legal); setLegalizeVectorElementToDifferentSizeStrategy( G_ADD, 0, widenToLargerTypesUnsupportedOtherwise); As currently implemented here, vector types are legalized by first making the vector element size legal, followed by then making the number of lanes legal. The strategy to follow in the first step is set by a call to setLegalizeVectorElementToDifferentSizeStrategy, see example above. The strategy followed in the second step "moreToWiderTypesAndLessToWidest" (see code for its definition), indicating that vectors are widened to more elements so they map to natively supported vector widths, or when there isn't a legal wider vector, split the vector to map it to the widest vector supported. Therefore, for the above specification, some example legalizations are: * getAction({G_ADD, LLT::vector(3, 3)}) returns {WidenScalar, LLT::vector(3, 8)} * getAction({G_ADD, LLT::vector(3, 8)}) then returns {MoreElements, LLT::vector(8, 8)} * getAction({G_ADD, LLT::vector(20, 8)}) returns {FewerElements, LLT::vector(16, 8)} 2. Key implementation aspects. How to legalize a specific (operation, type index, size) tuple is represented by mapping intervals of integers representing a range of size types to an action to take, e.g.: setScalarAction({G_ADD, LLT:scalar(1)}, {{1, WidenScalar}, // bit sizes [ 1, 31[ {32, Legal}, // bit sizes [32, 33[ {33, WidenScalar}, // bit sizes [33, 64[ {64, Legal}, // bit sizes [64, 65[ {65, NarrowScalar} // bit sizes [65, +inf[ }); Please note that most of the code to do the actual lowering of non-power-of-2 sized types is currently missing, this is just trying to make it possible for targets to specify what is legal, and how non-legal types should be legalized. Probably quite a bit of further work is needed in the actual legalizing and the other passes in GlobalISel to support non-power-of-2 sized types. I hope the documentation in LegalizerInfo.h and the examples provided in the various {Target}LegalizerInfo.cpp and LegalizerInfoTest.cpp explains well enough how this is meant to be used. This drops the need for LLT::{half,double}...Size(). Differential Revision: https://reviews.llvm.org/D30529 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317560 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-03[globalisel][tablegen] Skip src child predicatesDiana Picus
The GlobalISel TableGen backend didn't check for predicates on the source children. This caused it to generate code for ARM patterns such as SMLABB or similar, but without properly checking for the sext_16_node part of the operands. This in turn meant that we would select SMLABB instead of MLA for simple sequences such as s32 + s32 * s32, which is wrong (we want a MLA on the full operands, not just their bottom 16 bits). This patch forces TableGen to skip patterns with predicates on the src children, so it doesn't generate code for SMLABB and other similar ARM instructions at all anymore. AArch64 and X86 are not affected. Differential Revision: https://reviews.llvm.org/D39554 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317313 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30[GlobalISel|ARM] : Allow legalizing G_FSUBJaved Absar
Adding support for VSUB. Reviewed by: @rovka Differential Revision: https://reviews.llvm.org/D39261 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316902 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30[ARM GlobalISel] Fixup r316572. NFCDiana Picus
Just missed a few spots... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316897 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[ARM GlobalISel] Remove redundant testcases. NFCDiana Picus
Remove the G_FADD testcases from arm-legalizer.mir, they are covered by arm-legalizer-fp.mir (I probably forgot to delete them when I created that test). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316573 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[ARM GlobalISel] Update test after r316479. NFCDiana Picus
No need to check register classes in the register block anymore, since we can now much more conveniently check them at their def. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316572 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[ARM GlobalISel] Fix call opcodesDiana Picus
We were generating BLX for all the calls, which was incorrect in most cases. Update ARMCallLowering to generate BL for direct calls, and BLX, BX_CALL or BMOVPCRX_CALL for indirect calls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316570 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[ARM GlobalISel] Split test into 3. NFCDiana Picus
Separate the test cases that deal with calls from the rest of the IR Translator tests. We split into 2 different files, one for testing parameter and result lowering, and one for testing the various different kinds of calls that can occur (BL, BLX, BX_CALL etc). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316569 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-24MIR: Print the register class or bank in vreg defsJustin Bogner
This updates the MIRPrinter to include the regclass when printing virtual register defs, which is already valid syntax for the parser. That is, given 64 bit %0 and %1 in a "gpr" regbank, %1(s64) = COPY %0(s64) would now be written as %1:gpr(s64) = COPY %0(s64) While this change alone introduces a bit of redundancy with the registers block, it allows us to update the tests to be more concise and understandable and brings us closer to being able to remove the registers block completely. Note: We generally only print the class in defs, but there is one exception. If there are uses without any defs whatsoever, we'll print the class on all uses. I'm not completely convinced this comes up in meaningful machine IR, but for now the MIRParser and MachineVerifier both accept that kind of stuff, so we don't want to have a situation where we can print something we can't parse. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316479 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-23[GISel][ARM]: Fix illegal Generic copies in testsAditya Nandakumar
This is in preparation for a verifier check that makes sure copies are of the same size (when generic virtual registers are involved). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316388 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-19[ARM GlobalISel] Fix liveins in test. NFCDiana Picus
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316155 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-19[ARM GlobalISel] Remove redundant testsDiana Picus
These test cases don't really add anything that isn't covered by other tests as well, so we can safely remove them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316154 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-18Canonicalize a large number of mir tests using update_mir_test_checksJustin Bogner
This converts a large and somewhat arbitrary set of tests to use update_mir_test_checks. I ran the script on all of the tests I expect to need to modify for an upcoming mir syntax change and kept the ones that obviously didn't change the tests in ways that might make it harder to understand. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316137 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09[GISel]: Fix generation of illegal COPYs during CallLoweringAditya Nandakumar
We end up creating COPY's that are either truncating/extending and this should be illegal. https://reviews.llvm.org/D37640 Patch for X86 and ARM by igorb, rovka git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315240 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[ARM] GlobalISel: Make tests less strictDiana Picus
These are intended as integration tests, so they shouldn't be too specific about what they're checking. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315083 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[ARM] GlobalISel: Select shiftsDiana Picus
Unfortunately TableGen doesn't handle this yet: Unable to deduce gMIR opcode to handle Src (which is a leaf). Just add some temporary hand-written code to generate the proper MOVsr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315071 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[ARM] GlobalISel: Map shift operands to GPRsDiana Picus
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315067 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[ARM] GlobalISel: Mark shifts as legal for s32Diana Picus
The new legalize combiner introduces shifts all over the place, so we should support them sooner rather than later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315064 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-05[ARM] GlobalISel: Support global variables for RWPIDiana Picus
In RWPI code, globals that are not read-only are accessed relative to the SB register (R9). This is achieved by explicitly generating an ADD instruction between SB and an offset that we either load from a constant pool or movw + movt into a register. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312521 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-01[ARM] GlobalISel: Support ROPI global variablesDiana Picus
In the ROPI relocation model, read-only variables are accessed relative to the PC. We use the (MOV|LDRLIT)_ga_pcrel pseudoinstructions for this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312323 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-01[ARM] GlobalISel: More tests. NFC.Diana Picus
Test constants as well in the PIC tests. These are also represented as G_GLOBAL_VALUE, and although they are treated just like other globals for PIC, they won't be for ROPI, so it's good to have this coverage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312319 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-30[GISel]: Add a clean up combiner during legalization.Aditya Nandakumar
Added a combiner which can clean up truncs/extends that are created in order to make the types work during legalization. Also moved the combineMerges to the LegalizeCombiner. https://reviews.llvm.org/D36880 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312158 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-29[ARM] GlobalISel: Select globals in PIC modeDiana Picus
Support the selection of G_GLOBAL_VALUE in the PIC relocation model. For simplicity we use the same pseudoinstructions for both Darwin and ELF: (MOV|LDRLIT)_ga_pcrel(_ldr). This is new for ELF, so it requires a small update to the ARM pseudo expansion pass to make sure it adds the correct constant pool modifier and add-current-address in the case of ELF. Differential Revision: https://reviews.llvm.org/D36507 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311992 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-29[ARM] GlobalISel: Rename tests. NFC.Diana Picus
The checks are complicated enough as it is, there's no use cramming PIC in there as well... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311989 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28Fix ARMv4 supportJoerg Sonnenberger
ARMv4 doesn't support the "BX" instruction, which has been introduced with ARMv4t. Adjust the call lowering and tail call implementation accordingly. Further changes are necessary to ensure that presence of the v4t feature is correctly set. Most importantly, the "generic" CPU for thumb-* triples should include ARMv4t, since thumb mode without thumb support would naturally be pointless. Add a couple of asserts to ensure thumb instructions are not emitted without CPU support. Differential Revision: https://reviews.llvm.org/D37030 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311921 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03[ARM] GlobalISel: Select simple G_GLOBAL_VALUE instructionsDiana Picus
Add support in the instruction selector for G_GLOBAL_VALUE for ELF and MachO for the static relocation model. We don't handle Windows yet because that's Thumb-only, and we don't handle Thumb in general at the moment. Support for PIC, ROPI, RWPI and TLS will be added in subsequent commits. Differential Revision: https://reviews.llvm.org/D35883 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309927 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26[ARM] GlobalISel: Map G_GLOBAL_VALUE to GPRDiana Picus
A G_GLOBAL_VALUE is basically a pointer, so it should live in the GPR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309101 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-26[ARM] GlobalISel: Mark G_GLOBAL_VALUE as legalDiana Picus
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309090 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18[ARM] GlobalISel: Support G_(S|U)REM for s8 and s16Diana Picus
Widen to s32, and then do whatever Lowering/Custom/Libcall action the subtarget wants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308285 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14[ARM] GlobalISel: Support G_BRCONDDiana Picus
Insert a TSTri to set the flags and a Bcc to branch based on their values. This is a bit inefficient in the (common) cases where the condition for the branch comes from a compare right before the branch, since we set the flags both as part of the compare lowering and as part of the branch lowering. We're going to live with that until we settle on a principled way to handle this kind of situation, which occurs with other patterns as well (combines might be the way forward here). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308009 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-13[ARM] GlobalISel: Support G_BRDiana Picus
This boils down to not crashing in reg bank select due to the lack of register operands on this instruction, and adding some tests. The instruction selection is already covered by the TableGen'erated code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307904 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12[ARM] GlobalISel: Select s64 G_FCMPDiana Picus
Very similar to how we select s32 G_FCMP, the only thing that is different is the exact opcodes that we use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307763 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11[ARM] GlobalISel: Tighten G_FCMP selection test. NFCDiana Picus
Use CHECK-NEXT for the comparison sequence, to make sure we don't get any unexpected instructions in the middle of our flag manipulation efforts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307656 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11[ARM] GlobalISel: Add reg mapping for s64 G_FCMPDiana Picus
Map the result into GPR and the operands into FPR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307653 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11[ARM] GlobalISel: Tighten legalizer tests. NFCDiana Picus
Make sure that all the legalizer tests where the original instruction needs to be removed check for the removal. We do this by adding CHECK-NOT lines before and after the replacement sequence. This won't catch pathological cases where the instruction remains somewhere in the middle of the instruction sequence that's supposed to replace it, but hopefully that won't occur in practice (since ideally we'd be setting the insert point for the new instruction sequence either before or after the original instruction and not fiddle with it while building the sequence). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307647 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11[ARM] GlobalISel: Fix oversight in G_FCMP legalizationDiana Picus
We used to forget to erase the original instruction when replacing a G_FCMP true/false. Fix this bug and make sure the tests check for it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307639 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11[ARM] GlobalISel: Legalize s64 G_FCMPDiana Picus
Same as the s32 version, for both hard and soft float. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307633 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07[ARM] GlobalISel: Select hard G_FCMP for s32Diana Picus
We lower to a sequence consisting of: - MOVi 0 into a register - VCMPS to do the actual comparison and set the VFP flags - FMSTAT to move the flags out of the VFP unit - MOVCCi to either use the "zero register" that we have previously set with the MOVi, or move 1 into the result register, based on the values of the flags As was the case with soft-float, for some predicates (one, ueq) we actually need two comparisons instead of just one. When that happens, we generate two VCMPS-FMSTAT-MOVCCi sequences and chain them by means of using the result of the first MOVCCi as the "zero register" for the second one. This is a bit overkill, since one comparison followed by two non-flag-setting conditional moves should be enough. In any case, the backend manages to CSE one of the comparisons away so it doesn't matter much. Note that unlike SelectionDAG and FastISel, we always use VCMPS, and not VCMPES. This makes the code a lot simpler, and it also seems correct since the LLVM Lang Ref defines simple true/false returns if the operands are QNaN's. For SNaN's, even VCMPS throws an Invalid Operand exception, so they won't be slipping through unnoticed. Implementation-wise, this introduces a template so we can share the same code that we use for handling integer comparisons, since the only differences are in the details (exact opcodes to be used etc). Hopefully this will be easy to extend to s64 G_FCMP. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307365 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06[ARM] GlobalISel: Map s32 G_FCMP in reg bank selectDiana Picus
Map hard G_FCMP operands to FPR and the result to GPR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307245 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06[ARM] GlobalISel: Legalize G_FCMP for s32Diana Picus
This covers both hard and soft float. Hard float is easy, since it's just Legal. Soft float is more involved, because there are several different ways to handle it based on the predicate: one and ueq need not only one, but two libcalls to get a result. Furthermore, we have large differences between the values returned by the AEABI and GNU functions. AEABI functions return a nice 1 or 0 representing true and respectively false. GNU functions generally return a value that needs to be compared against 0 (e.g. for ogt, the value returned by the libcall is > 0 for true). We could introduce redundant comparisons for AEABI as well, but they don't seem easy to remove afterwards, so we do different processing based on whether or not the result really needs to be compared against something (and just truncate if it doesn't). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307243 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06[ARM] GlobalISel: Widen s1, s8, s16 G_CONSTANTDiana Picus
Get the legalizer to widen small constants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307239 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30GlobalISel: add G_IMPLICIT_DEF instruction.Tim Northover
It looks like there are two target-independent but not GISel instructions that need legalization, IMPLICIT_DEF and PHI. These are already anomalies since their operands have important LLTs attached, so to make things more uniform it seems like a good idea to add generic variants. Starting with G_IMPLICIT_DEF. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306875 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-27[ARM] GlobalISel: Support G_SELECT for pointersDiana Picus
All we need to do is mark it as legal, otherwise it's just like s32. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306390 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-27[ARM] GlobalISel: Support G_SELECT for i32Diana Picus
* Mark as legal for (s32, i1, s32, s32) * Map everything into GPRs * Select to two instructions: a CMP of the condition against 0, to set the flags, and a MOVCCr to select between the two inputs based on the flags that we've just set git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306382 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23GlobalISel: convert buildSequence to use non-deprecated instructions.Tim Northover
G_SEQUENCE is going away soon so as a first step the MachineIRBuilder needs to be taught how to emulate it with alternatives. We use G_MERGE_VALUES where possible, and a sequence of G_INSERTs if not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306119 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-19[ARM] GlobalISel: Support G_ICMP for s8 and s16Diana Picus
Widen to s32 (like all other binary ops). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305683 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-19[ARM] GlobalISel: Support G_ICMP for i32 and pointersDiana Picus
Add support throughout the pipeline: - mark as legal for s32 and pointers - map to GPRs - lower to a sequence of instructions, which moves 0 or 1 into the result register based on the flags set by a CMPrr We have copied from FastISel a helper function which maps CmpInst predicates into ARMCC codes. Ideally, we should be able to move it somewhere that both FastISel and GlobalISel can use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305672 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15[ARM] GlobalISel: Add support for i32 moduloDiana Picus
Add support for modulo for targets that have hardware division and for those that don't. When hardware division is not available, we have to choose the correct libcall to use. This is generally straightforward, except for AEABI. The AEABI variant is trickier than the other libcalls because it returns { quotient, remainder }, instead of just one value like the other libcalls that we've seen so far. Therefore, we need to use custom lowering for it. However, we don't want to have too much special code, so we refactor the target-independent code in the legalizer by adding a helper for replacing an instruction with a libcall. This helper is used by the legalizer itself when dealing with simple calls, and also by the custom ARM legalization for the more complicated AEABI divmod calls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305459 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15[ARM] GlobalISel: Lower only homogeneous struct argsDiana Picus
Lowering mixed struct args, params and returns used G_INSERT, which is a bit more convoluted to support through the entire pipeline. Since they don't occur that often in practice, it's probably wiser to leave them out until later. Meanwhile, we can lower homogeneous structs using G_MERGE_VALUES, which has good support in the legalizer. These occur e.g. as the return of __aeabi_idivmod, so it's nice to be able to support them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305458 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-08[ARM] GlobalISel: Add more tests. NFCDiana Picus
Add a couple of tests to increase coverage for the TableGen'erated code, in particular for rules where 2 generic instructions may be combined into a single machine instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304971 91177308-0d34-0410-b5e6-96231b3b80d8