Commit Graph

44 Commits

Author SHA1 Message Date
Petar Avramovic
1061506620 [MIPS GlobalISel] Select integer to floating point conversions
Select G_SITOFP and G_UITOFP for MIPS32.

Differential Revision: https://reviews.llvm.org/D63542


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363912 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-20 09:05:02 +00:00
Petar Avramovic
e4d9699aa0 [MIPS GlobalISel] Select floating point to integer conversions
Select G_FPTOSI and G_FPTOUI for MIPS32.

Differential Revision: https://reviews.llvm.org/D63541


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363911 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-20 08:52:53 +00:00
Petar Avramovic
16cf5446ce [MIPS GlobalISel] Select sqrt
Select G_FSQRT for MIPS32.

Differential Revision: https://reviews.llvm.org/D62905


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362692 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-06 10:00:41 +00:00
Petar Avramovic
271f77cd2f [MIPS GlobalISel] Select fabs
Select G_FABS for MIPS32.

Differential Revision: https://reviews.llvm.org/D62903


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362690 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-06 09:22:37 +00:00
Petar Avramovic
9f0c8880fb [MIPS GlobalISel] Select fpext and fptrunc
Select G_FPEXT and G_FPTRUNC for MIPS32.

Differential Revision: https://reviews.llvm.org/D62902


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362689 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-06 09:16:58 +00:00
Petar Avramovic
a5f55e79b6 [MIPS GlobalISel] Select floor and ceil
Select G_FFLOOR and G_FCEIL for MIPS32.

Differential Revision: https://reviews.llvm.org/D62901


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362688 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-06 09:02:24 +00:00
Petar Avramovic
38ccf90cce [MIPS GlobalISel] Select fcmp
Select floating point compare for MIPS32.

Differential Revision: https://reviews.llvm.org/D62721


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362603 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-05 14:03:13 +00:00
Petar Avramovic
d98749c59f [MIPS GlobalISel] Select floating point arithmetic operations
Select 32 and 64 bit floating point add, sub, mul and div for MIPS32.

Differential Revision: https://reviews.llvm.org/D60191


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357584 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-03 14:12:59 +00:00
Petar Avramovic
fbfa7eae2f [MIPS GlobalISel] Select float constants
Select 32 and 64 bit float constants for MIPS32.

Differential Revision: https://reviews.llvm.org/D59933


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357183 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-28 16:58:12 +00:00
Petar Avramovic
e7f4ae297e [MIPS GlobalISel] NarrowScalar G_UMULH
NarrowScalar G_UMULH in LegalizerHelper 
using multiplyRegisters helper function.
NarrowScalar G_UMULH for MIPS32.

Differential Revision: https://reviews.llvm.org/D58825


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355815 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-11 10:08:44 +00:00
Petar Avramovic
4306b0ed95 [MIPS GlobalISel] NarrowScalar G_MUL
Narrow Scalar G_MUL for MIPS32.
Revisit NarrowScalar implementation in LegalizerHelper.
Introduce new helper function multiplyRegisters.
It performs generic multiplication of values held in multiple registers.
Generated instructions use only types NarrowTy and i1.
Destination can be same or two times size of the source.

Differential Revision: https://reviews.llvm.org/D58824


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355814 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-11 10:00:17 +00:00
Petar Avramovic
778b40dc9a [MIPS GlobalISel] Select G_UMULH
Legalize G_UMULO and select G_UMULH for MIPS32.

Differential Revision: https://reviews.llvm.org/D58714


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355177 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 07:25:44 +00:00
Petar Avramovic
7e18e3836e [MIPS GlobalISel] Select G_UADDO
Lower G_UADDO.
Legalize G_UADDO for MIPS32

Differential Revision: https://reviews.llvm.org/D58671


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354900 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 17:22:42 +00:00
Matt Arsenault
6f55bb14e6 GlobalISel: Add alignment to LegalityQuery MMOs
This allows targets to specify the minimum alignment required for the
load/store.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354071 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14 22:41:09 +00:00
Petar Avramovic
3cb9895a5c [MIPS GlobalISel] Select phi instruction for integers
Select G_PHI for integers for MIPS32.

Differential Revision: https://reviews.llvm.org/D58183


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354025 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14 12:36:19 +00:00
Petar Avramovic
e817e7373a [MIPS GlobalISel] Select branch instructions
Select G_BR and G_BRCOND for MIPS32.
Unconditional branch G_BR does not have register operand,
for that reason we only add tests.
Since conditional branch G_BRCOND compares register to zero on MIPS32,
explicit extension must be performed on i1 condition in order to set
high bits to appropriate value.

Differential Revision: https://reviews.llvm.org/D58182


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354022 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14 11:39:53 +00:00
Petar Avramovic
005af434d1 [MIPS GlobalISel] Select any extending load and truncating store
Make behavior of G_LOAD in widenScalar same as for G_ZEXTLOAD and
G_SEXTLOAD. That is perform widenScalarDst to size given by the target
and avoid additional checks in common code. Targets can reorder or add
additional rules in LegalizeRuleSet for the opcode to achieve desired
behavior.

Select extending load that does not have specified type of extension
into zero extending load.

Select truncating store that stores number of bytes indicated by size
in MachineMemoperand.

Differential Revision: https://reviews.llvm.org/D57454


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353520 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-08 14:27:23 +00:00
Petar Avramovic
5cf50dec64 [MIPS GlobalISel] Select mul
Legalize and select G_MUL for s32 and smaller types for MIPS32.

Differential Revision: https://reviews.llvm.org/D57816


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353506 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-08 10:11:33 +00:00
Petar Avramovic
2ac1bfd366 [MIPS GlobalISel] Select sub
Lower G_USUBO and G_USUBE. Add narrowScalar for G_SUB.
Legalize and select G_SUB for MIPS 32.

Differential Revision: https://reviews.llvm.org/D53416


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352351 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-28 12:10:17 +00:00
Petar Avramovic
8993a7805d [MIPS GlobalISel] Select zero extending and sign extending load
Select zero extending and sign extending load for MIPS32.
Use size from MachineMemOperand to determine number of bytes to load.

Differential Revision: https://reviews.llvm.org/D57099


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352038 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 10:27:21 +00:00
Matt Arsenault
5f7a8a499f GlobalISel: Allow shift amount to be a different type
For AMDGPU the shift amount is never 64-bit, and
this needs to use a 32-bit shift.

X86 uses i8, but seemed to be hacking around this before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351882 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-22 21:42:11 +00:00
Chandler Carruth
6b547686c5 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 08:50:56 +00:00
Petar Avramovic
a8f8c0e6e6 [MIPS GlobalISel] Select G_SELECT
Add widen scalar for type index 1 (i1 condition) for G_SELECT.
Select G_SELECT for pointer, s32(integer) and smaller low level
types on MIPS32.

Differential Revision: https://reviews.llvm.org/D56001


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350063 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-25 14:42:30 +00:00
Petar Avramovic
046371adb0 [MIPS GlobalISel] Select G_SDIV, G_UDIV, G_SREM and G_UREM
Add support for s64 libcalls for G_SDIV, G_UDIV, G_SREM and G_UREM
and use integer type of correct size when creating arguments for
CLI.lowerCall.
Select G_SDIV, G_UDIV, G_SREM and G_UREM for types s8, s16, s32 and s64
on MIPS32.

Differential Revision: https://reviews.llvm.org/D55651


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349499 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18 15:59:51 +00:00
Petar Avramovic
7fe679909d [MIPS GlobalISel] ClampScalar G_AND G_OR and G_XOR
Add narrowScalar for G_AND and G_XOR.
Legalize G_AND G_OR and G_XOR for types other then s32 
with clampScalar on MIPS32.

Differential Revision: https://reviews.llvm.org/D55362


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349475 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18 11:36:14 +00:00
Petar Avramovic
a7f5217bfb [MIPS GlobalISel] Remove switch statement (fix r349346 for MSVC)
Temporarily remove switch statement without any case labels 
in function legalizeCustom in order to fix r349346 for MSVC.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349356 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-17 15:12:53 +00:00
Petar Avramovic
4c18d27900 [MIPS GlobalISel] Lower G_UADDE and narrowScalar G_ADD
Lower G_UADDE and legalize G_ADD using narrowScalar on MIPS32.

Differential Revision: https://reviews.llvm.org/D54580


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349346 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-17 12:31:07 +00:00
Aditya Nandakumar
a47a91a7f3 [GISel]: Provide standard interface to observe changes in GISel passes
https://reviews.llvm.org/D54980

This provides a standard API across GISel passes to observe and notify
passes about changes (insertions/deletions/mutations) to MachineInstrs.
This patch also removes the recordInsertion method in MachineIRBuilder
and instead provides method to setObserver.

Reviewed by: vkeles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348406 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-05 20:14:52 +00:00
Petar Avramovic
eff069b6c8 [MIPS GlobalISel] narrowScalar G_CONSTANT
Legalize s64 G_CONSTANT using narrowScalar on MIPS 32.

Differential Revision: https://reviews.llvm.org/D54255


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346495 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-09 14:21:16 +00:00
Petar Avramovic
d22ff25690 [MIPS GlobalISel] Set operand order for G_MERGE and G_UNMERGE
Set operands order for G_MERGE_VALUES and G_UNMERGE_VALUES so
that least significant bits always go first, regardless of endianness.

Differential Revision: https://reviews.llvm.org/D54098


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346305 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-07 11:45:43 +00:00
Petar Jovanovic
c99132a727 [MIPS GlobalISel] Legalize constants
Legalize s1, s8, s16 and s64 G_CONSTANT for MIPS32.

Patch by Petar Avramovic.

Differential Revision: https://reviews.llvm.org/D53077


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344684 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-17 10:30:03 +00:00
Petar Jovanovic
48d3a5535e [MIPS GlobalISel] Legalize i64 add
Custom legalize s64 G_ADD for MIPS32.

Patch by Petar Avramovic.

Differential Revision: https://reviews.llvm.org/D52652


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344007 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-08 23:59:37 +00:00
Petar Jovanovic
8a7d229b56 [MIPS GlobalISel] Select icmp
Select 32bit integer compare instructions for MIPS32.

Patch by Petar Avramovic.

Differential Revision: https://reviews.llvm.org/D51489


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341840 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-10 15:56:52 +00:00
Petar Jovanovic
f798bee771 [MIPS GlobalISel] Legalize i8 and i16 add
Legalize G_ADD for types smaller than i32.
LegalizationArtifactCombiner replaces extend instructions with appropriate
bitwise instructions.

Patch by Petar Avramovic.

Differential Revision: https://reviews.llvm.org/D51213


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340697 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-26 07:25:33 +00:00
Petar Jovanovic
35df2a3841 [MIPS GlobalISel] Select bitwise instructions
Select bitwise instructions for i32.

Patch by Petar Avramovic.

Differential Revision: https://reviews.llvm.org/D50183


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340258 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-21 08:15:56 +00:00
Petar Jovanovic
f4bd4b2689 [MIPS GlobalISel] Select global address
Select G_GLOBAL_VALUE for position dependent code.

Patch by Petar Avramovic.

Differential Revision: https://reviews.llvm.org/D49803


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338499 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-01 09:03:23 +00:00
Petar Jovanovic
3de71f627e [MIPS GlobalISel] Lower pointer arguments
Add support for lowering pointer arguments.
Changing type from pointer to integer is already done in
MipsTargetLowering::getRegisterTypeForCallingConv.

Patch by Petar Avramovic.

Differential Revision: https://reviews.llvm.org/D49419


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337912 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-25 12:35:01 +00:00
Petar Jovanovic
f85073912f [MIPS GlobalISel] Select instructions to load and store i32 on stack
Add code for selection of G_LOAD, G_STORE, G_GEP, G_FRAMEINDEX and
G_CONSTANT. Support loads and stores of i32 values.

Patch by Petar Avramovic.

Differential Revision: https://reviews.llvm.org/D48957


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337168 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-16 13:29:32 +00:00
Roman Tereshin
f911f7d95a [GlobalISel][Mips] LegalizerInfo verifier: Adding LegalizerInfo::verify(...) call for Mips
Reviewers: aemerson, qcolombet

Reviewed By: qcolombet

Differential Revision: https://reviews.llvm.org/D46339

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333665 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-31 16:16:49 +00:00
Petar Jovanovic
91e3c3b9cc [MIPS GlobalISel] remove superfluous #includes (NFC)
Remove superfluous #includes.
Minor code style change in MipsCallLowering::lowerFormalArguments().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329926 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 17:01:46 +00:00
Petar Jovanovic
92ffece499 [MIPS GlobalISel] Select add i32, i32
Add the minimal support necessary to lower a function that returns the
sum of two i32 values.
Support argument/return lowering of i32 values through registers only.
Add tablegen for regbankselect and instructionselect.

Patch by Petar Avramovic.

Differential Revision: https://reviews.llvm.org/D44304


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329819 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-11 15:12:32 +00:00
Craig Topper
f137ed238d [IR][CodeGen] Remove dependency on EVT from IR/Function.cpp. Move EVT to CodeGen layer.
Currently EVT is in the IR layer only because of Function.cpp needing a very small piece of the functionality of EVT::getEVTString(). The rest of EVT is used in codegen making CodeGen a better place for it.

The previous code converted a Type* to EVT and then called getEVTString. This was only expected to handle the primitive types from Type*. Since there only a few primitive types, we can just print them as strings directly.

Differential Revision: https://reviews.llvm.org/D45017

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328806 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-29 17:21:10 +00:00
David Blaikie
b91d9a7128 Fix layering by moving ValueTypes.h from CodeGen to IR
ValueTypes.h is implemented in IR already.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328397 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-23 23:58:31 +00:00
Petar Jovanovic
581db4c3f6 [MIPS GlobalISel] Adding GlobalISel
Add GlobalISel infrastructure up to the point where we can select a ret
void.

Patch by Petar Avramovic.

Differential Revision: https://reviews.llvm.org/D43583


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325888 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-23 11:06:40 +00:00