Commit Graph

1969 Commits

Author SHA1 Message Date
Matt Arsenault 2363fe8f86 AMDGPU/GlobalISel: Introduce vcc reg bank
I'm not entirely sure this is the correct thing
to do with the global isel philosophy, but I think
this is necessary to handle how differently SGPRs
are used normally vs. from a condition.

For example, it makes sense to allow a copy
from a VGPR to an SGPR, but it makes no sense
to allow a copy from VGPRs to SGPRs used as
select mask.

This avoids regbankselecting strange code with
a truncate feeding directly into a condition field.
Now a copy is forced from sgpr(s1) to vcc, which is
more sensible to handle.

Some of these issues could probably avoided with making enough
operations resulting in i1 illegal. I think we can't avoid
this register bank for legality.

For example, an i1 and where one source is from a truncate, and
one source is a compare needs some kind of copy inserted to
make sure both are in condition registers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350611 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-08 06:30:53 +00:00
Matt Arsenault a62ff5dd41 AMDGPU/GlobalISel: Legalize concat_vectors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350598 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-08 01:30:02 +00:00
Matt Arsenault 1720133d5c RegBankSelect: Fix copy insertion point for terminators
If a copy was needed to handle the condition of brcond, it was being
inserted before the defining instruction. Add tests for iterator edge
cases.

I find the existing code here suspect for the case where it's looking
for terminators that modify the register. It's going to insert a copy
in the middle of the terminators, which isn't allowed (it might be
necessary to have a COPY_terminator if anybody actually needs this).

Also legalize brcond for AMDGPU.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350595 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-08 01:22:47 +00:00
Matt Arsenault 2bb35671cc AMDGPU/GlobalISel: Disallow VGPR->SCC copies
This fixes using scalar adds when only the carry in is a VGPR
using greedy regbankselect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350593 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-08 01:13:20 +00:00
Matt Arsenault 2128ba0c85 AMDGPU/GlobalISel: RegBankSelect for carry-in
I'm not sure we should be allowing the truncate
to s1 for the inputs. It may be necessary to
create a new VCC reg bank.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350592 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-08 01:09:09 +00:00
Matt Arsenault 9054ffcfc8 AMDGPU/GlobalISel: RegBankSelect for add/sub with carry out
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350589 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-08 01:03:58 +00:00
Matt Arsenault 68e5e50395 AMDGPU/GlobalISel: InstrMapping for G_UNMERGE_VALUES
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350588 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-08 00:46:19 +00:00
Craig Topper 2d88ada4d7 [TargetLowering][AMDGPU] Remove the SimplifyDemandedBits function that takes a User and OpIdx. Stop using it in AMDGPU target for simplifyI24.
As we saw in D56057 when we tried to use this function on X86, it's unsafe. It allows the operand node to have multiple users, but doesn't prevent recursing past the first node when it does have multiple users. This can cause other simplifications earlier in the graph without regard to what bits are needed by the other users of the first node. Ideally all we should do to the first node if it has multiple uses is bypass it when its not needed by the user we started from. Doing any other transformation that SimplifyDemandedBits can do like turning ZEXT/SEXT into AEXT would result in an increase in instructions.

Fortunately, we already have a function that can do just that, GetDemandedBits. It will only make transformations that involve bypassing a node.

This patch changes AMDGPU's simplifyI24, to use a combination of GetDemandedBits to handle the multiple use simplifications. And then uses the regular SimplifyDemandedBits on each operand to handle simplifications allowed when the operand only has a single use. Unfortunately, GetDemandedBits simplifies constants more aggressively than SimplifyDemandedBits. This caused the -7 constant in the changed test to be simplified to remove the upper bits. I had to modify computeKnownBits to account for this by ignoring the upper 8 bits of the input.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350560 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-07 19:30:43 +00:00
Rhys Perry 016461668f AMDGPU: test for uniformity of branch instruction, not its condition
Summary:
If a divergent branch instruction is marked as divergent by propagation
rule 2 in DivergencePropagator::exploreSyncDependency() and its condition
is uniform, that branch would incorrectly be assumed to be uniform.

Reviewers: arsenm, tstellar

Reviewed By: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350532 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-07 15:52:28 +00:00
Matt Arsenault 57fed470f0 AMDGPU: Remove VS/SV mappings from select
These would violate the constant bus restriction

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350517 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-07 13:21:36 +00:00
Simon Pilgrim 8adb73fcab Regenerate test.
Prep work towards enabling SimplifyDemandedBits vector support for TRUNCATE as discussed on D56118.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350513 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-07 12:20:35 +00:00
Stanislav Mekhanoshin f04e8d9380 Added single use check to ShrinkDemandedConstant
Fixes cvt_f32_ubyte combine. performCvtF32UByteNCombine() could shrink
source node to demanded bits only even if there are other uses.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350475 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-05 19:20:00 +00:00
Alexander Timofeev bf5049eaf1 [AMDGPU] Fix scalar operand folding bug that causes SHOC performance regression.
Detailed description: SIFoldOperands::foldInstOperand iterates over the
operand uses calling the function that changes def-use iteratorson the
way. As a result loop exits immediately when def-use iterator is
changed. Hence, the operand is folded to the very first use instruction
only. This makes VGPR live along the whole basic block and increases
register pressure significantly. The performance drop observed in SHOC
DeviceMemory test is caused by this bug.

Proposed fix: collect uses to separate container for further processing
in another loop.

Testing: make check-llvm
SHOC performance test.

Reviewers: rampitec, ronlieb

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350350 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-03 19:55:32 +00:00
Piotr Sobczak 114b83cbe2 [AMDGPU] Change section name with metadata access
Summary:
The commit rL348922 introduced a means to set Metadata
section kind for a global variable, if its explicit section
name was prefixed with ".AMDGPU.metadata.".

This patch changes that prefix to ".AMDGPU.comment.",
as "metadata" in the section name might lead to
ambiguity with metadata used by AMD PAL runtime.

Change-Id: Idd4748800d6fe801441d91595fc21e5a4171e668

Reviewers: kzhuravl

Reviewed By: kzhuravl

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350292 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-03 11:22:58 +00:00
Piotr Sobczak 85979bea18 [AMDGPU] Handle OR as operand of raw load/store
Summary:
Use isBaseWithConstantOffset() which handles OR as an operand
to llvm.amdgcn.raw.buffer.load and llvm.amdgcn.raw.buffer.store.

Change-Id: Ifefb9dc5ded8710d333df07ab1900b230e33539a

Reviewers: nhaehnle, mareko, arsenm

Reviewed By: arsenm

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350208 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-02 09:47:41 +00:00
Simon Pilgrim f77e034b28 [AMDGPU] Regenerate i64 shift tests.
To show codegen diff due to a future SimplifyDemandedBits patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350065 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-26 12:09:10 +00:00
Sanjay Patel 4452b74d57 [DAGCombiner] allow narrowing of add followed by truncate
trunc (add X, C ) --> add (trunc X), C'

If we're throwing away the top bits of an 'add' instruction, do it in the narrow destination type.
This makes the truncate-able opcode list identical to the sibling transform done in IR (in instcombine).

This change used to show regressions for x86, but those are gone after D55494. 
This gets us closer to deleting the x86 custom function (combineTruncatedArithmetic) 
that does almost the same thing.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350006 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-22 17:10:31 +00:00
Changpeng Fang 44dd5040ee AMDGPU: Don't peel of the offset if the resulting base could possibly be negative in Indirect addressing.
Summary:
  Don't peel of the offset if the resulting base could possibly be negative in Indirect addressing.
This is because the M0 field is of unsigned.

This patch achieves the similar goal as https://reviews.llvm.org/D55241, but keeps the optimization
if the base is known unsigned.

Reviewers:
  arsemn

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349951 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-21 20:57:34 +00:00
Matt Arsenault 2faa975e74 AMDGPU/GlobalISel: RegBankSelect for amdgcn.wqm.vote
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349882 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-21 03:20:54 +00:00
Matt Arsenault 5547f9f07e AMDGPU/GlobalISel: RegBankSelect for some fp ops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349880 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-21 03:14:45 +00:00
Matt Arsenault 8043ea3725 AMDGPU/GlobalISel: Redo legality for build_vector
It seems better to avoid using the callback if possible since
there are coverage assertions which are disabled if this is used.

Also fix missing tests. Only test the legal cases since it seems
legalization for build_vector is quite lacking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349878 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-21 03:03:11 +00:00
Matt Arsenault 6493b36705 AMDGPU: Make i1/i64/v2i32 and/or/xor legal
The 64-bit types do depend on the register bank,
but that's another issue to deal with later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349716 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-20 01:35:49 +00:00
Matt Arsenault 48efaa117f AMDGPU/GlobalISel: Fix ValueMapping tables for i1
This was incorrectly selecting SGPR for any i1 values,
e.g. G_TRUNC to i1 from a VGPR was still an SGPR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349715 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-20 01:33:43 +00:00
Matt Arsenault e675164b4b AMDGPU/GlobalISel: RegBankSelect for fp conversions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349709 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-20 00:37:02 +00:00
Matt Arsenault c6f008464f AMDGPU/GlobalISel: Legality/regbankselect for atomicrmw/atomic_cmpxchg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349708 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-20 00:33:49 +00:00
Rhys Perry 934db57c7d AMDGPU: Add patterns for v4i16/v4f16 -> v4i16/v4f16 bitcasts
Reviewers: arsenm, tstellar

Reviewed By: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349694 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-19 22:53:33 +00:00
Nicolai Haehnle f835629b79 AMDGPU: Use an ABS32_LO relocation for SCRATCH_RSRC_DWORD1
Summary:
Using HI here makes no logical sense, since the dword is only
32 bits to begin with.

Current Mesa master does not look at the relocation type at all,
so this change is fine. Future Mesa will rely on this, however.

Change-Id: I91085707834c4ac0370926602b93c94b90e44cb1

Reviewers: arsenm, rampitec, mareko

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349620 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-19 11:55:03 +00:00
Carl Ritson 8cea59c941 AMDGPU/InsertWaitcnts: Update VGPR/SGPR bounds when brackets are merged
Summary:
Fix an issue where VGPR/SGPR bounds are not properly extended when brackets are merged.
This manifests as missing waitcnt insertions when multiple brackets are forwarded to a successor block and the first forward has lower VGPR/SGPR bounds.

Irreducible loop test has been extended based on a CTS failure detected for GFX9.

Reviewers: nhaehnle

Reviewed By: nhaehnle

Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, jfb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349611 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-19 10:17:49 +00:00
Matt Arsenault 028b8a6045 AMDGPU/GlobalISel: Regbankselect for fsub
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349608 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-19 09:07:58 +00:00
Farhana Aleen efd098d00b [AMDGPU] Removed the unnecessary operand size-check-assert from processBaseWithConstOffset().
Summary: 32bit operand sizes are guaranteed by the opcode check AMDGPU::V_ADD_I32_e64 and
         AMDGPU::V_ADDC_U32_e64. Therefore, we don't any additional operand size-check-assert.

Author: FarhanaAleen

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349529 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18 19:58:39 +00:00
Matt Arsenault 5af2f5e104 AMDGPU: Legalize/regbankselect frame_index
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349468 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18 09:46:13 +00:00
Matt Arsenault 08319618c5 AMDGPU: Legalize/regbankselect fma
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349467 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18 09:39:56 +00:00
Matt Arsenault d38a2490f3 AMDGPU/GlobalISel: Legalize/regbankselect fneg/fabs/fsub
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349463 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18 09:19:03 +00:00
Farhana Aleen 0bbe50f2fb [AMDGPU] Promote constant offset to the immediate by finding a new base with 13bit constant offset from the nearby instructions.
Summary: Promote constant offset to immediate by recomputing the relative 13bit offset from nearby instructions.
 E.g.
  s_movk_i32 s0, 0x1800
  v_add_co_u32_e32 v0, vcc, s0, v2
  v_addc_co_u32_e32 v1, vcc, 0, v6, vcc

  s_movk_i32 s0, 0x1000
  v_add_co_u32_e32 v5, vcc, s0, v2
  v_addc_co_u32_e32 v6, vcc, 0, v6, vcc
  global_load_dwordx2 v[5:6], v[5:6], off
  global_load_dwordx2 v[0:1], v[0:1], off
  =>
  s_movk_i32 s0, 0x1000
  v_add_co_u32_e32 v5, vcc, s0, v2
  v_addc_co_u32_e32 v6, vcc, 0, v6, vcc
  global_load_dwordx2 v[5:6], v[5:6], off
  global_load_dwordx2 v[0:1], v[5:6], off offset:2048

Author: FarhanaAleen

Reviewed By: arsenm, rampitec

Subscribers: llvm-commits, AMDGPU

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349196 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-14 21:13:14 +00:00
John Brawn 98689c01bb [RegAllocGreedy] IMPLICIT_DEF values shouldn't prefer registers
It costs nothing to spill an IMPLICIT_DEF value (the only spill code that's
generated is a KILL of the value), so when creating split constraints if the
live-out value is IMPLICIT_DEF the exit constraint should be DontCare instead
of PrefReg.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349151 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-14 14:07:57 +00:00
Aakanksha Patil cc31a27f1e Revert r348971: [AMDGPU] Support for "uniform-work-group-size" attribute
This patch breaks RADV (and probably RadeonSI as well)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349084 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-13 21:23:12 +00:00
Matt Arsenault dfc9645964 AMDGPU/GlobalISel: Legalize/regbankselect block_addr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349081 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-13 20:34:15 +00:00
Matt Arsenault e50f44d0a3 AMDGPU/GlobalISel: Legalize f64 fadd/fmul
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349014 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-13 08:27:48 +00:00
Matt Arsenault f2ca2facab AMDGPU/GlobalISel: RegBankSelect some simple operations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349012 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-13 08:23:51 +00:00
Matt Arsenault e735adba9b AMDGPU/GlobalISel: Test cleanups
Remove IR and registers sections

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349011 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-13 08:11:45 +00:00
Stanislav Mekhanoshin bf39a84926 [AMDGPU] Simplify negated condition
Optimize sequence:

  %sel = V_CNDMASK_B32_e64 0, 1, %cc
  %cmp = V_CMP_NE_U32 1, %1
  $vcc = S_AND_B64 $exec, %cmp
  S_CBRANCH_VCC[N]Z
=>
  $vcc = S_ANDN2_B64 $exec, %cc
  S_CBRANCH_VCC[N]Z

It is the negation pattern inserted by DAGCombiner::visitBRCOND() in the
rebuildSetCC().

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349003 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-13 03:17:40 +00:00
Aakanksha Patil b20ee3547f [AMDGPU] Support for "uniform-work-group-size" attribute
Updated the annotate-kernel-features pass to support the propagation of uniform-work-group attribute from the kernel to the called functions. Once this pass is run, all kernels, even the ones which initially did not have the attribute, will be able to indicate weather or not they have uniform work group size depending on the value of the attribute. 

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348971 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-12 20:49:17 +00:00
Scott Linder 8ae3c1c06a [AMDGPU] Emit MessagePack HSA Metadata for v3 code object
Continue to present HSA metadata as YAML in ASM and when output by tools
(e.g. llvm-readobj), but encode it in Messagepack in the code object.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348963 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-12 19:39:27 +00:00
Neil Henning 4778d2ba93 [AMDGPU] Extend the SI Load/Store optimizer to combine more things.
I've extended the load/store optimizer to be able to produce dwordx3
loads and stores, This change allows many more load/stores to be combined,
and results in much more optimal code for our hardware.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348937 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-12 16:15:21 +00:00
Piotr Sobczak a7da881aa5 [AMDGPU] Set metadata access for explicit section
Summary:
This patch provides a means to set Metadata section kind
for a global variable, if its explicit section name is
prefixed with ".AMDGPU.metadata."
This could be useful to make the global variable go to
an ELF section without any section flags set.

Reviewers: dstuttard, tpr, kzhuravl, nhaehnle, t-tye

Reviewed By: dstuttard, kzhuravl

Subscribers: llvm-commits, arsenm, jvesely, wdng, yaxunl, t-tye

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348922 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-12 11:20:04 +00:00
Amara Emerson e7dca1ec05 [GlobalISel] Restrict G_MERGE_VALUES capability and replace with new opcodes.
This patch restricts the capability of G_MERGE_VALUES, and uses the new
G_BUILD_VECTOR and G_CONCAT_VECTORS opcodes instead in the appropriate places.

This patch also includes AArch64 support for selecting G_BUILD_VECTOR of <4 x s32>
and <2 x s64> vectors.

Differential Revisions: https://reviews.llvm.org/D53629

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348788 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-10 18:44:58 +00:00
Neil Henning 760a278a3f [AMDGPU] Change the l1 flush instruction for AMDPAL/MESA3D.
This commit changes which l1 flush instruction is used for AMDPAL and
MESA3d workloads to flush the entire l1 cache instead of just the
volatile lines.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348771 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-10 16:35:53 +00:00
Tim Corringham c9d081f818 [AMDGPU] Add new Mode Register pass
A new pass to manage the Mode register.

Currently this just manages the floating point double precision
rounding requirements, but is intended to be easily extended to
encompass all Mode register settings.

The immediate motivation comes from the requirement to use the
round-to-zero rounding mode for the 16 bit interpolation
instructions, where the rounding mode setting is shared between
16 and 64 bit operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348754 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-10 12:06:10 +00:00
Brian Gesiak 10abda9baa [AMDGPU] Fix discarded result of addAttribute
Summary:
`llvm::AttributeList` and `llvm::AttributeSet` are immutable, and so methods
defined on these classes, such as `addAttribute`, return a new immutable
object with the attribute added. In https://reviews.llvm.org/D55217 I attempted
to annotate methods such as `addAttribute` with `LLVM_NODISCARD`, since
calling these methods has no side-effects, and so ignoring the result
that is returned is almost certainly a programmer error.

However, committing the change resulted in new warnings in the AMDGPU target.
The AMDGPU simplify libcalls pass added in https://reviews.llvm.org/D36436
attempts to add the readonly and nounwind attributes to simplified
library functions, but instead calls the `addAttribute` methods and
ignores the result.

Modify the simplify libcalls pass to actually add the nounwind and
readonly attributes. Also update the simplify libcalls test to assert
that these attributes are actually being set.

Reviewers: rampitec, vpykhtin, rnk

Reviewed By: rampitec

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348732 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-09 21:56:50 +00:00
Sanjay Patel 5d35502198 [DAGCombiner] re-enable truncation of binops
This is effectively re-committing the changes from:
rL347917 (D54640)
rL348195 (D55126)
...which were effectively reverted here:
rL348604
...because the code had a bug that could induce infinite looping
or eventual out-of-memory compilation.

The bug was that this code did not guard against transforming
opaque constants. More details are in the post-commit mailing
list thread for r347917. A reduced test for that is included
in the x86 bool-math.ll file. (I wasn't able to reduce a PPC
backend test for this, but it was almost the same pattern.)

Original commit message for r347917:

The motivating case for this is shown in:
https://bugs.llvm.org/show_bug.cgi?id=32023
and the corresponding rot16.ll regression tests.

Because x86 scalar shift amounts are i8 values, we can end up with trunc-binop-trunc
sequences that don't get folded in IR.

As the TODO comments suggest, there will be regressions if we extend this (for x86,
we mostly seem to be missing LEA opportunities, but there are likely vector folds
missing too). I think those should be considered existing bugs because this is the
same transform that we do as an IR canonicalization in instcombine. We just need
more tests to make those visible independent of this patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348706 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-08 16:07:38 +00:00