191 Commits

Author SHA1 Message Date
Matt Arsenault
9a30bf46a7 AMDGPU: Stop checking intrinsics not used by HSA for dispatch-ptr
Only the dispatch.ptr intrinsic is supposed to be used now to get
the workgroup size, and the read.local.size intrinsics do not
work correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-30 05:10:59 +00:00
Matt Arsenault
27e98d1c21 AMDGPU: Add new amdgcn workitem intrinsics
These use the correct prefix and follow the HSA naming convention
rather than the config register option names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259293 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-30 04:25:19 +00:00
Matt Arsenault
3d679fa973 AMDGPU: Remove 24-bit intrinsics
The known bit matching code seems to work reasonably well,
so these shouldn't really be needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259180 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 10:05:16 +00:00
Matt Arsenault
e26a9f0de4 AMDGPU: Match fmed3 patterns with legacy fmin/fmax
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259090 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 20:53:48 +00:00
Matt Arsenault
6a2bf372b8 AMDGPU: Match some med3 patterns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259089 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 20:53:42 +00:00
Matt Arsenault
ed6685cf17 AMDGPU: Set DX10Clamp bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259088 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 20:53:35 +00:00
Oliver Stannard
b95072ef89 Revert r259035, it introduces a cyclic library dependency
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259045 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 13:19:47 +00:00
Oliver Stannard
ef19a274ad Add backend dignostic printer for unsupported features
Re-commit of r258951 after fixing layering violation.

The related LLVM patch adds a backend diagnostic type for reporting
unsupported features, this adds a printer for them to clang.

In the case where debug location information is not available, I've
changed the printer to report the location as the first line of the
function, rather than the closing brace, as the latter does not give the
user any information. This also affects optimisation remarks.

Differential Revision: http://reviews.llvm.org/D16590



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259035 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 10:07:27 +00:00
NAKAMURA Takumi
c1aeea845d Revert r258951 (and r258950), "Refactor backend diagnostics for unsupported features"
It broke layering violation in LLVMIR.

clang r258950 "Add backend dignostic printer for unsupported features"
llvm  r258951 "Refactor backend diagnostics for unsupported features"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259016 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 04:41:32 +00:00
Oliver Stannard
bf8415a84d Refactor backend diagnostics for unsupported features
The BPF and WebAssembly backends had identical code for emitting errors
for unsupported features, and AMDGPU had very similar code. This merges
them all into one DiagnosticInfo subclass, that can be used by any
backend.

There should be minimal functional changes here, but some AMDGPU tests
have been updated for the new format of errors (it used a slightly
different format to BPF and WebAssembly). The AMDGPU error messages will
now benefit from having precise source locations when debug info is
available.

The implementation of DiagnosticInfoUnsupported::print must be in
lib/Codegen rather than in the existing file in lib/IR/ to avoid
introducing a dependency from IR to CodeGen.

Differential Revision: http://reviews.llvm.org/D16590



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258951 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 17:30:33 +00:00
Marek Olsak
73be6ab813 AMDGPU/SI: Stoney has only 16 LDS banks
Summary:
This is a candidate for stable, along with all patches that add the "stoney"
processor.

Reviewers: tstellarAMD

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D16485

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258922 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 11:19:45 +00:00
Matt Arsenault
de2c3bc98d AMDGPU: Fix default device handling
When no device name is specified, default to kaveri
for HSA since SI is not supported and it woud fail.

Default to "tahiti" instead of "SI" since these are
effectively the same, and tahiti is an actual device.

Move default device handling to the TargetMachine
rather than the AMDGPUSubtarget. The module ISA version
is computed from the device name provided with the target
machine, so the attributes printed by the AsmPrinter were
inconsistent with those computed in the subtarget.

Also remove DevName field from subtarget since it's redundant
with getCPU() in the superclass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258901 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27 02:17:49 +00:00
Matt Arsenault
ce00361269 AMDGPU: Make v32i8/v64i8 illegal types
Old intrinsics were forcing these, but they have now all
been removed. This fixes large i8 vector operations generally
being broken.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258788 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 04:43:48 +00:00
Matt Arsenault
337264a351 AMDGPU: Remove old sample intrinsics
I did my best to try to update all the uses in tests that
just happened to use the old ones to the newer intrinsics.

I'm not sure I got all of the immediate operand conversions
correct, since the value seems to have been ignored by the
old pattern but I don't think it really matters.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258787 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 04:38:08 +00:00
Matt Arsenault
2aa06ab7ea AMDGPU: Add new amdgcn intrinsics for cube instructions
More cleanup to try to get all intrinsics using the correct
amdgcn prefix that are as close to the instruction as possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258786 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 04:29:56 +00:00
Matt Arsenault
c024d32472 AMDGPU: Implement read_register and write_register intrinsics
Some of the special intrinsics now that now correspond to a instruction
also have special setting of some registers, e.g. llvm.SI.sendmsg sets
m0 as well as use s_sendmsg. Using these explicit register intrinsics
may be a better option.

Reading the exec mask and others may be useful for debugging. For this
I'm not sure this is entirely correct because we would want this to
be convergent, although it's possible this is already treated
sufficently conservatively.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258785 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 04:29:24 +00:00
Matt Arsenault
ae4d40b742 AMDGPU: Restore AMDGPU prefixed rsq intrinsic for now
Also move into backend intrinsics to discourage use of the old name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258783 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 04:14:16 +00:00
Dan Gohman
f4e788949d [MC] Use .p2align instead of .align
For historic reasons, the behavior of .align differs between targets.
Fortunately, there are alternatives, .p2align and .balign, which make the
interpretation of the parameter explicit, and which behave consistently across
targets.

This patch teaches MC to use .p2align instead of .align, so that people reading
code for multiple architectures don't have to remember which way each platform
does its .align directive.

Differential Revision: http://reviews.llvm.org/D16549


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258750 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 00:03:25 +00:00
Matt Arsenault
ba78f314e9 AMDGPU: Replace some deprecated intrinsic uses in tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258614 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-23 05:42:49 +00:00
Matt Arsenault
ed7be7aac6 AMDGPU: Run instnamer on a few tests
This will make future test updates easier

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258613 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-23 05:42:43 +00:00
Matt Arsenault
78c5400038 AMDGPU: Remove more unused intrinsics
Replace tests with lrp with basic IR expansion

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258612 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-23 05:42:38 +00:00
Matt Arsenault
c5d9da7bab AMDGPU: Add new name for barrier intrinsic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258558 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 21:30:43 +00:00
Matt Arsenault
faf8ffaefd AMDGPU: Rename intrinsics to use amdgcn prefix
The intrinsic target prefix should match the target name
as it appears in the triple.

This is not yet complete, but gets most of the important ones.
llvm.AMDGPU.* intrinsics used by mesa and libclc are still handled
for compatability for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258557 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 21:30:34 +00:00
Matt Arsenault
584bbb20e9 AMDGPU: Fix crash with invariant markers
The promote alloca pass didn't handle these intrinsics and crashed.
These intrinsics should accept any address space, but for now just
erase them to avoid breaking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258537 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 19:47:54 +00:00
Matt Arsenault
a75de8d6ed AMDGPU: Rename some r600 intrinsics to use correct TargetPrefix
These ones aren't directly emitted by mesa and inserted by a pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258523 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 19:00:09 +00:00
Matt Arsenault
eb3f71fe95 AMDGPU: Remove AMDGPU.fract intrinsic
Mesa doesn't use this, and this is pattern matched already
from fsub x, (ffloor x)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258513 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 18:42:38 +00:00
Tom Stellard
221c8b9773 AMDGPU/SI: Promote i1 SETCC operations
Summary:
While working on uniform branching, I've hit a few cases where we emit
i1 SETCC operations.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D16233

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258352 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 21:48:24 +00:00
Matt Arsenault
a98abc22cb AMDGPU: Remove AMDGPU.trunc intrinsic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258348 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 21:05:53 +00:00
Matt Arsenault
1cbcadaf34 AMDGPU: Remove AMDIL.fraction intrinsic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258347 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 21:05:49 +00:00
Matt Arsenault
8cafd8eeaa AMDGPU: Remove AMDIL.round.nearest intrinsic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258346 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 21:05:40 +00:00
Matt Arsenault
f70b08b399 AMDGPU: Remove abs intrinsic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258343 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 20:58:29 +00:00
Matt Arsenault
68886ef2dc AMDGPU: Remove min/max intrinsics
This removes support for mesa 11.0.x

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258342 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 20:50:19 +00:00
Tom Stellard
76c5275226 AMDGPU/SI: Prevent the DAGCombiner from creating setcc with i1 inputs
Reviewers: arsenm

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D15035

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258256 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 00:13:22 +00:00
Matt Arsenault
67893e08de AMDGPU: Reduce 64-bit SRAs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258096 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 22:09:04 +00:00
Matt Arsenault
a60d27cb35 AMDGPU: Split 64-bit and of constant up
This breaks the tests that were meant for testing
64-bit inline immediates, so move those to shl where
they won't be broken up.

This should be repeated for the other related bit ops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258095 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 22:01:13 +00:00
Matt Arsenault
deaace45d6 AMDGPU: Generalize shl combine
Reduce 64-bit shl with constant > 32. We already special cased
this for the == 32 case, but this also works for any >= 32 constant.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258092 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 21:55:14 +00:00
Matt Arsenault
cc893f0656 AMDGPU: Reduce 64-bit lshr by constant to 32-bit
64-bit shifts are very slow on some subtargets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258090 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 21:43:36 +00:00
Matt Arsenault
305d0ffc6b AMDGPU: Cleanup sra test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258086 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 21:13:56 +00:00
Changpeng Fang
a1f41aa652 AMDGPU/SI: Update ISA version for FIJI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257666 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13 20:39:25 +00:00
Marek Olsak
1c18e5b909 AMDGPU/SI: Fix a GPU hang with POS_W_FLOAT enabled
Reviewers: tstellarAMD, arsenm

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D16037

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257625 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13 17:23:20 +00:00
Marek Olsak
fdcecead28 AMDGPU/SI: Add tests for non-void functions and InitialPSInputAddr
Reviewers: tstellarAMD, arsenm

Differential Revision: http://reviews.llvm.org/D16036

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257624 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13 17:23:15 +00:00
Nicolai Haehnle
cead1b4a6d AMDGPU/SI: Add SI Machine Scheduler
Summary:
It is off by default, but can be used
with --misched=si

Patch by: Axel Davy

Reviewers: arsenm, tstellarAMD, nhaehnle

Subscribers: nhaehnle, solenskiner, arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D11885

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257609 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13 16:10:10 +00:00
Tom Stellard
e395458a4f AMDGPU: Emit note directive for HSA even if there are no functions
Reviewers: arsenm, echristo

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D16010

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257488 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-12 17:18:17 +00:00
Matt Arsenault
6e3a667705 AMDGPU: Implement {{s|u}}int_to_fp i64 -> f32
The old lowering for uint_to_fp failed opencl conformance.
It might be OK for fast math mode, but I'm not sure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257393 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 22:01:48 +00:00
Matt Arsenault
ea5802f212 AMDGPU: Cleanup udiv test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257387 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 21:18:40 +00:00
Matt Arsenault
7717a8b940 AMDGPU: Fix crash with dispatch.ptr intrinsic with non-HSA target
It might be better to let this be a select failure instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257386 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 21:18:33 +00:00
Matt Arsenault
3f2e0d9a1f AMDGPU: int_to_fp test cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257354 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 17:02:10 +00:00
Matt Arsenault
68f559ea61 AMDGPU: Fix ctlz combine for sub 32-bit types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257353 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 17:02:06 +00:00
Matt Arsenault
f12a12cd25 AMDGPU: Pattern match ffbh pattern to instruction.
The hardware instruction's output on 0 is -1 rather than 32.
Eliminate a test and select to -1. This removes an extra instruction
from the compatability function with HSAIL's firstbit instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257352 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 17:02:00 +00:00
Matt Arsenault
01a6cb6ce3 AMDGPU: Custom lower i64 ctlz
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257348 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 16:50:29 +00:00