Commit Graph

97 Commits

Author SHA1 Message Date
Matt Arsenault
dc25a20424 AMDGPU/GlobalISel: Fail select of G_INSERT non-32-bit source
This was producing an illegal copy which would hit an assert
later. Error on selection for now until this is implemented.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371993 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-16 14:26:14 +00:00
Matt Arsenault
e93fcf5684 AMDGPU/GlobalISel: Fix assert on multi-return side effect intrinsics
llvm.amdgcn.else hits this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371812 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-13 04:12:12 +00:00
Matt Arsenault
6d85c15b5f AMDGPU/GlobalISel: Select llvm.amdgcn.class
Also fixes missing SubtargetPredicate on f16 class instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371436 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-09 18:29:45 +00:00
Matt Arsenault
ec4cccf933 AMDGPU/GlobalISel: Select fmed3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371435 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-09 18:29:37 +00:00
Matt Arsenault
ec69d2c9e6 AMDGPU/GlobalISel: Select G_PTR_MASK
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371412 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-09 15:46:13 +00:00
Matt Arsenault
62cb516312 AMDGPU/GlobalISel: Use known bits for selection
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371409 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-09 15:39:32 +00:00
Matt Arsenault
667563e84d AMDGPU/GlobalISel: Try generated matcher before add/sub code
This will allow optimization patterns which fold adds away to work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371406 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-09 15:20:44 +00:00
Matt Arsenault
4c7535db16 AMDGPU/GlobalISel: Fix assert on load from constant address
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371006 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-05 02:20:25 +00:00
Matt Arsenault
78868df3d7 AMDGPU/GlobalISel: Fix constraining scalar and/or/xor
If the result register already had a register class assigned, the
sources may not have been properly constrained.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370150 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-28 02:11:03 +00:00
Daniel Sanders
57a8129407 Apply llvm-prefer-register-over-unsigned from clang-tidy to LLVM
Summary:
This clang-tidy check is looking for unsigned integer variables whose initializer
starts with an implicit cast from llvm::Register and changes the type of the
variable to llvm::Register (dropping the llvm:: where possible).

Partial reverts in:
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
X86FixupLEAs.cpp - Some functions return unsigned and arguably should be MCRegister
X86FrameLowering.cpp - Some functions return unsigned and arguably should be MCRegister
HexagonBitSimplify.cpp - Function takes BitTracker::RegisterRef which appears to be unsigned&
MachineVerifier.cpp - Ambiguous operator==() given MCRegister and const Register
PPCFastISel.cpp - No Register::operator-=()
PeepholeOptimizer.cpp - TargetInstrInfo::optimizeLoadInstr() takes an unsigned&
MachineTraceMetrics.cpp - MachineTraceMetrics lacks a suitable constructor

Manual fixups in:
ARMFastISel.cpp - ARMEmitLoad() now takes a Register& instead of unsigned&
HexagonSplitDouble.cpp - Ternary operator was ambiguous between unsigned/Register
HexagonConstExtenders.cpp - Has a local class named Register, used llvm::Register instead of Register.
PPCFastISel.cpp - PPCEmitLoad() now takes a Register& instead of unsigned&

Depends on D65919

Reviewers: arsenm, bogner, craig.topper, RKSimon

Reviewed By: arsenm

Subscribers: RKSimon, craig.topper, lenary, aemerson, wuzish, jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369041 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-15 19:22:08 +00:00
Amara Emerson
7c19e0123a [GlobalISel] Make the InstructionSelector instance non-const, allowing state to be maintained.
Currently we can't keep any state in the selector object that we get from
subtarget. As a result we have to plumb through all our variables through
multiple functions. This change makes it non-const and adds a virtual init()
method to allow further state to be captured for each target.

AArch64 makes use of this in this patch to cache a call to hasFnAttribute()
which is expensive to call, and is used on each selection of G_BRCOND.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368652 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-13 06:26:59 +00:00
Daniel Sanders
c7a3c5c5d1 Finish moving TargetRegisterInfo::isVirtualRegister() and friends to llvm::Register as started by r367614. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367633 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-01 23:27:28 +00:00
Matt Arsenault
62b274e7ca AMDGPU/GlobalISel: Remove manual store select code
This regresses the weird types that are newly treated as legal load
types, but fixes incorrectly using flat instrucions on SI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367512 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-01 03:52:40 +00:00
Matt Arsenault
9455340d7b AMDGPU/GlobalISel: Handle G_ATOMICRMW_FADD
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367509 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-01 03:33:15 +00:00
Matt Arsenault
b8f72a5a52 AMDGPU/GlobalISel: Allow selection of DS atomicrmw
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367507 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-01 03:29:01 +00:00
Matt Arsenault
79e53ddffa AMDGPU/GlobalISel: Select simple local stores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367504 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-01 03:09:15 +00:00
Matt Arsenault
dfa7d6f913 AMDGPU/GlobalISel: Select local loads
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367498 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-01 00:53:38 +00:00
Matt Arsenault
df1a10ab2c AMDGPU/GlobalISel: Don't assume instruction can be erased when selecting exts
The G_ANYEXT handling can end up reaching selectCOPY, which mutates
the instruction in place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366915 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-24 16:05:53 +00:00
Matt Arsenault
0c93423f8d AMDGPU/GlobalISel: Remove unnecessary code
The minnum/maxnum case are dead, and the cvt is handled by the
default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366685 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-22 13:05:25 +00:00
Matt Arsenault
c7d2de0c8f AMDGPU/GlobalISel: Select private loads
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366248 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-16 19:22:21 +00:00
Matt Arsenault
329f885366 AMDGPU/GlobalISel: Select flat stores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366246 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-16 18:42:53 +00:00
Matt Arsenault
b18edea81b AMDGPU/GlobalISel: Select flat loads
Now that the patterns use the new PatFrag address space support, the
only blocker to importing most load patterns is the addressing mode
complex patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366237 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-16 18:05:29 +00:00
Matt Arsenault
aeefee98c1 AMDGPU/GlobalISel: Fix test failures in release build
Apparently the check for legal instructions during instruction
select does not happen without an asserts build, so these would
successfully select in release, and fail in debug.

Make s16 and/or/xor legal. These can just be selected directly
to the 32-bit operation, as is already done in SelectionDAG, so just
make them legal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366210 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-16 14:28:30 +00:00
Matt Arsenault
46513b57db AMDGPU/GlobalISel: Select G_AND/G_OR/G_XOR
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366121 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-15 19:50:07 +00:00
Matt Arsenault
848db45c88 AMDGPU/GlobalISel: Don't constrain source register of VCC copies
This is a hack until I come up with a better way of dealing with the
pseudo-register banks used for boolean values. If the use instruction
constrains the register, the selector for the def instruction won't
see that the bank was VCC. A 1-bit SReg_32 is could ambiguously have
been SCCRegBank or VCCRegBank in wave32.

This is necessary to successfully select branches with and and/or/xor
condition.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366120 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-15 19:48:36 +00:00
Matt Arsenault
fcd8db8a7d AMDGPU/GlobalISel: Fix selecting vcc->vcc bank copies
The extra test change is correct, although how it arrives there is a
bug that needs work. With wave32, the test for isVCC ambiguously
reports true for an SCC or VCC source. A new allocatable pseudo
register class for SCC may be necesssary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366119 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-15 19:46:48 +00:00
Matt Arsenault
0cf596c83a AMDGPU/GlobalISel: Fix not constraining result reg of copies to VCC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366118 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-15 19:45:49 +00:00
Matt Arsenault
0774fb325e AMDGPU/GlobalISel: Fix handling of sgpr (not scc bank) s1 to VCC
This was emitting a copy from a 32-bit register to a 64-bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366117 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-15 19:44:07 +00:00
Matt Arsenault
2e692a0fec AMDGPU/GlobalISel: Fix G_ICMP for wave32
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366114 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-15 19:39:31 +00:00
Matt Arsenault
92d1538833 AMDGPU/GlobalISel: Handle llvm.amdgcn.if.break
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366102 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-15 18:25:24 +00:00
Matt Arsenault
9aa5131c1d AMDGPU/GlobalISel: Select llvm.amdgcn.end.cf
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366099 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-15 18:18:46 +00:00
Matt Arsenault
227403b223 AMDGPU/GlobalISel: Select easy cases for G_BUILD_VECTOR
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366087 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-15 17:26:43 +00:00
Matt Arsenault
cd159ec3d2 AMDGPU/GlobalISel: Select G_SUB
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365484 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-09 14:05:11 +00:00
Matt Arsenault
583f33b170 AMDGPU/GlobalISel: Select G_UNMERGE_VALUES
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365483 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-09 14:02:26 +00:00
Matt Arsenault
fd0d82251d AMDGPU/GlobalISel: Select G_MERGE_VALUES
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365482 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-09 14:02:20 +00:00
Matt Arsenault
5955c03166 AMDGPU/GlobalISel: Try generated matcher with intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364933 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-02 14:52:16 +00:00
Matt Arsenault
59c422424e AMDGPU/GlobalISel: Fix G_GEP with mixed SGPR/VGPR operands
The register bank for the destination of the sample argument copy was
wrong. We shouldn't be constraining each source to the result register
bank. Allow constraining the original register to the right size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364928 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-02 14:40:22 +00:00
Matt Arsenault
0368e15ad1 AMDGPU/GlobalISel: Select G_FENCE
Manually select to workaround tablegen emitter emitting checks for
G_CONSTANT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364927 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-02 14:17:38 +00:00
Matt Arsenault
51744f169f AMDGPU/GlobalISel: Lower kernarg segment ptr intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364835 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 18:49:01 +00:00
Matt Arsenault
87f9f81250 AMDGPU/GlobalISel: Fail instead of assert when selecting loads
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364807 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 16:36:39 +00:00
Matt Arsenault
5060182440 AMDGPU/GlobalISel: Complete implementation of G_GEP
Also works around tablegen defect in selecting add with unused carry,
but if we have to manually select GEP, might as well handle add
manually.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364806 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 16:34:48 +00:00
Matt Arsenault
b1c22290af AMDGPU/GlobalISel: Select G_PHI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364805 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 16:32:47 +00:00
Tom Stellard
962c2a67ea AMDGPU/GlobalISel: Implement select for 32-bit G_ADD
Reviewers: arsenm

Reviewed By: arsenm

Subscribers: hiraditya, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, Petar.Avramovic, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364797 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 16:09:33 +00:00
Matt Arsenault
ebb2f49e2d AMDGPU/GlobalISel: Select G_BRCOND for vcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364795 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 16:06:02 +00:00
Matt Arsenault
23031b8243 AMDGPU/GlobalISel: Select G_FRAME_INDEX
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364789 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 15:48:18 +00:00
Matt Arsenault
faac328d81 AMDGPU/GlobalISel: Make s16 select legal
This is easy to handle and avoids legalization artifacts which are
likely to obscure combines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364787 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 15:42:47 +00:00
Matt Arsenault
1adfb58fa1 AMDGPU/GlobalISel: Select G_BRCOND for scc conditions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364786 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 15:39:27 +00:00
Matt Arsenault
d3f47bd68b AMDGPU/GlobalISel: Tolerate copies with no type set
isVCC has the same bug, but isn't used in a context where it can cause
a problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364784 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 15:23:04 +00:00
Matt Arsenault
f0431d4012 AMDGPU/GlobalISel: Select src modifiers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364782 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 15:18:56 +00:00
Matt Arsenault
d12e3c69f0 AMDGPU/GlobalISel: Fail on store to 32-bit address space
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364766 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 13:37:39 +00:00