200 Commits

Author SHA1 Message Date
Matt Arsenault
b1b624d08a GlobalISel: Implement widenScalar for g_extract scalar results
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354293 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-18 22:39:27 +00:00
Matt Arsenault
57d9165df0 GlobalISel: Fix double count of offset for irregular vector breakdowns
Fixes cases with odd vectors that break into multiple requested size
pieces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354280 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-18 17:01:09 +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
Matt Arsenault
bfe35f840d GlobalISel: Use default rounding mode when extending fconstant
I don't think this matters since the values should all be exactly
representable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353844 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-12 14:54:54 +00:00
Matt Arsenault
31cd6654ed GlobalISel: Move some more legalize cases into functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353843 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-12 14:54:52 +00:00
Matt Arsenault
f3f4691605 GlobalISel: Implement moreElementsVector for implicit_def
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353754 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 22:00:39 +00:00
Matt Arsenault
3038811553 GlobalISel: Fix not calling the observer when legalizing G_EXTRACT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353750 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 21:33:54 +00:00
Jessica Paquette
baeeed43cc [GlobalISel][AArch64] Select G_FFLOOR
This teaches the legalizer about G_FFLOOR, and lets us select G_FFLOOR in
AArch64.

It updates the existing floating point tests, and adds a select-floor.mir test.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353722 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 17:22:58 +00:00
Matt Arsenault
c0665d4bcd GlobalISel: Add G_FCANONICALIZE instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353719 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 17:05:20 +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
Matt Arsenault
e6576d59f1 AMDGPU/GlobalISel: Legalize addrspacecast
Use a placeholder constant for now on targets
that need the load from the queue ptr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353497 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-08 02:40:47 +00:00
Matt Arsenault
ef001e8e8a GlobalISel: Try to fix bot failures
Don't rely on order of evaluation of function arguments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353460 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07 20:44:08 +00:00
Matt Arsenault
c0f816e09c GlobalISel: Implement narrowScalar for shift main type
This is pretty much directly ported from SelectionDAG. Doesn't include
the shift by non-constant but known bits version, since there isn't a
globalisel version of computeKnownBits yet.

This shows a disadvantage of targets not specifically which type
should be used for the shift amount. If type 0 is legalized before
type 1, the operations on the shift amount type use the wider type
(which are also less likely to legalize). This can be avoided by
targets specifying legalization actions on type 1 earlier than for
type 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353455 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07 19:37:44 +00:00
Matt Arsenault
f2e3c26215 GlobalISel: Implement fewerElementsVector for shifts
Introduce a new function which handles instructions with multiple type
indices, but have the same number of vector elements.

Also legalize v2s16 shifts when applicable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353432 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07 17:38:00 +00:00
Matt Arsenault
4966488eee GlobalISel: Consolidate load/store legalization
The fewerElementsVectors implementation for load/stores
handles the scalar reduction case just as well, so drop
the redundant code in narrowScalar. This also introduces
support for narrowing irregular size breakdowns for
scalars.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353125 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 00:26:12 +00:00
Matt Arsenault
e3333a3a48 GlobalISel: Implement narrowScalar for select
Don't handle vector conditions.

I think this can be merged in the future with
fewerElementsVectorSelect, although this becomes slightly tricky with
a vector condition.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353122 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 00:13:44 +00:00
Matt Arsenault
733c08b6b3 GlobalISel: Fix not calling observer when legalizing bitcount ops
This was hiding bugs from never legalizing the source type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353102 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04 22:26:33 +00:00
Matt Arsenault
c1923fc6c2 GlobalISel: Implement widenScalar for G_UNMERGE_VALUES
For the scalar case only.

Also move the similar G_MERGE_VALUES handling to a separate function
and cleanup to make them look more similar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352979 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-03 00:07:33 +00:00
Matt Arsenault
757bd101c7 GlobalISel: Implement widenScalar for G_EXTRACT vector sources
Handle the basic element extract case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352978 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-02 23:56:00 +00:00
Matt Arsenault
87de283c8b GlobalISel: Legalization for inttoptr/ptrtoint
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352973 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-02 23:29:55 +00:00
Matt Arsenault
2a852a1e74 GlobalISel: Handle odd splits in fewerElementsVector for load/store
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352720 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-31 02:46:05 +00:00
Matt Arsenault
8927be488e GlobalISel: Implement narrowScalar for bswap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352719 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-31 02:34:03 +00:00
Matt Arsenault
bda0adb383 GlobalISel: Don't call changingInstruction before giving up
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352718 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-31 02:22:39 +00:00
Matt Arsenault
d08f66450d GlobalISel: Allow bitcount ops to have different result type
For AMDGPU the result is always 32-bit for 64-bit inputs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352717 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-31 02:09:57 +00:00
Matt Arsenault
b2d28d4c34 GlobalISel: Use helper function for MMO splitting
Also fix an alignment bug getMachineMemOperand. If the
tracked value is null, the offset isn't tracked so the
base alignment needs to be reduced.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352716 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-31 01:49:58 +00:00
Jessica Paquette
e2abb7ac81 [GlobalISel][AArch64] Select G_FEXP
This teaches the legalizer to handle G_FEXP in AArch64. As a result, it also
allows us to select G_FEXP.

It...

- Updates the legalizer-info tests
- Adds a test for legalizing exp
- Updates the existing fp tests to show that we can now select G_FEXP

https://reviews.llvm.org/D57483

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352692 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-30 23:46:15 +00:00
Amara Emerson
8b38d7e571 [GlobalISel][LegalizerHelper] Add some missing MI change observer calls.
No test as it's a preventative fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352691 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-30 23:42:46 +00:00
Jessica Paquette
5d6324274b [GlobalISel][AArch64] Add instruction selection support for @llvm.log2
This teaches GlobalISel to emit a RTLib call for @llvm.log2 when it encounters
it.

It updates the existing floating point tests to show that we don't fall back on
the intrinsic, and select the correct instructions. It also adds a legalizer
test for G_FLOG2.

https://reviews.llvm.org/D57357

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352673 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-30 21:16:04 +00:00
Jessica Paquette
d2bce7d4ae [GlobalISel][AArch64] Add instruction selection support for @llvm.sqrt
This teaches the legalizer about G_FSQRT in AArch64. Also adds a legalizer
test for G_FSQRT, a selection test for it, and updates existing floating point
tests.

https://reviews.llvm.org/D57361

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352671 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-30 21:03:52 +00:00
Matt Arsenault
e405a3bd22 GlobalISel: Implement fewerElementsVector for select
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352601 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-30 04:19:31 +00:00
Matt Arsenault
a20ea20810 GlobalISel: Use appropriate extension for legalizing select conditions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352597 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-30 02:57:43 +00:00
Matt Arsenault
00f3241eeb GlobalISel: Support narrowScalar for uneven loads
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352594 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-30 02:35:38 +00:00
Matt Arsenault
553368f2f8 GlobalISel: Handle some odd splits in fewerElementsVector
Also add some quick hacks to AMDGPU legality for the tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352591 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-30 02:22:13 +00:00
Matt Arsenault
c2b6aeb1f4 GlobalISel: Handle more cases for widenScalar for G_STORE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352585 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-30 02:04:31 +00:00
Matt Arsenault
8859c398f2 GlobalISel: Fix unused variable warning in release builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352565 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-29 23:38:42 +00:00
Matt Arsenault
9fb9172b43 GlobalISel: Partially implement widenScalar for MERGE_VALUES
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352560 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-29 23:17:35 +00:00
Matt Arsenault
ae17beb3c1 GlobalISel: Fix narrowScalar for load/store with different mem size
This was ignoring the memory size, and producing multiple loads/stores
if the operand size was different from the memory size.

I assume this is the intent of not having an explicit G_ANYEXTLOAD
(although I think that would probably be better).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352523 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-29 18:13:02 +00:00
Jessica Paquette
42bf149c65 [GlobalISel][AArch64] Add legalization for G_FLOG
This adds support for legalizing G_FLOG into a RTLib call.

It adds a legalizer test, and updates the existing floating point tests.

https://reviews.llvm.org/D57347

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352429 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-28 21:27:23 +00:00
Jessica Paquette
8a75387dbf [GlobalISel][AArch64] Add instruction selection support for @llvm.log10
This adds instruction selection support for @llvm.log10 in AArch64. It teaches
GISel to lower it to a library call, updates the relevant tests, and adds a
legalizer test for log10.

https://reviews.llvm.org/D57341

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352418 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-28 19:53:14 +00:00
Jessica Paquette
11b94ff409 [GlobalISel][AArch64] Add instruction selection support for G_FCOS and G_FSIN
This contains all of the legalizer changes from D57197 necessary to select
G_FCOS and G_FSIN. It also updates several existing IR tests in
test/CodeGen/AArch64 that verify that we correctly lower the G_FCOS and G_FSIN
instructions.

https://reviews.llvm.org/D57197
3/3

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352402 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-28 18:34:18 +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
Matt Arsenault
d0b56c0be6 GlobalISel: Don't reduce elements for atomic load/store
This is invalid for the same reason as in the narrowScalar handling
for load.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352334 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-27 22:36:24 +00:00
Matt Arsenault
5b66f011e7 GlobalISel: Factor fewerElementVectors into separate functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352332 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-27 21:53:09 +00:00
Matt Arsenault
230bc3fabf GlobalISel: Implement narrowScalar for mul
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352300 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-27 00:52:51 +00:00
Matt Arsenault
696da757ff GlobalISel: fewerElementsVector for intrinsic_trunc/intrinsic_round
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352298 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-27 00:12:21 +00:00
Matt Arsenault
d50257b91f AMDGPU/GlobalISel: Legalize more bit ops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352295 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-26 23:47:07 +00:00
Matt Arsenault
edf38e43a9 AMDGPU/GlobalISel: Scalarize add/sub
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352167 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-25 04:53:57 +00:00
Matt Arsenault
efa677ca14 GlobalISel: fewerElementsVector for more cast types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352166 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-25 04:37:33 +00:00
Matt Arsenault
da46a0ebae GlobalISel: fewerElementsVector for a few more trivial ops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352165 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-25 04:03:38 +00:00
Matt Arsenault
5a3235419c AMDGPU/GlobalISel: Legalize smulh/umulh and scalarize mul
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352162 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-25 03:23:04 +00:00