Skip to content

Commit eeaa354

Browse files
committed
SWDEV-179954 - OpenCL/LC - Merge branch amd-master into amd-common
Conflicts: lib/Target/AMDGPU/LLVMBuild.txt Change-Id: I4f4cd4657c39d55fdfd07a816f6becc9289a9591
2 parents e571304 + 327b328 commit eeaa354

File tree

511 files changed

+11127
-4604
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

511 files changed

+11127
-4604
lines changed

docs/CommandGuide/FileCheck.rst

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ and from the command line.
105105
Sets a filecheck pattern variable ``VAR`` with value ``VALUE`` that can be
106106
used in ``CHECK:`` lines.
107107

108+
.. option:: -D#<NUMVAR>=<VALUE>
109+
110+
Sets a filecheck numeric variable ``NUMVAR`` to ``<VALUE>`` that can be used
111+
in ``CHECK:`` lines.
112+
108113
.. option:: -version
109114

110115
Show the version number of this program.
@@ -560,20 +565,61 @@ CHECK-LABEL block. Global variables are not affected by CHECK-LABEL.
560565
This makes it easier to ensure that individual tests are not affected
561566
by variables set in preceding tests.
562567

563-
FileCheck Numeric Expressions
564-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
568+
FileCheck Numeric Variables and Expressions
569+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
570+
571+
:program:`FileCheck` also allows checking for numeric values that satisfy a
572+
numeric expression constraint based on numeric variables. This allows
573+
``CHECK:`` directives to verify a numeric relation between two numbers, such as
574+
the need for consecutive registers to be used.
575+
576+
The syntax to check a numeric expression constraint is
577+
``[[#<NUMVAR><op><offset>]]`` where:
578+
579+
*``<NUMVAR>`` is the name of a numeric variable defined on the command line.
580+
581+
*``<op>`` is an optional numeric operation to perform on the value of
582+
``<NUMVAR>``. Currently supported numeric operations are ``+`` and ``-``.
583+
584+
*``<offset>`` is the immediate value that constitutes the second operand of
585+
the numeric operation <op>. It must be present if ``<op>`` is present,
586+
absent otherwise.
587+
588+
For example:
589+
590+
.. code-block:: llvm
591+
592+
; CHECK: add r[[#REG]], r[[#REG]], r[[#REG+1]]
593+
594+
The above example would match the line:
595+
596+
.. code-block:: llvm
597+
598+
add r5, r5, r6
599+
600+
but would not match the line:
601+
602+
.. code-block:: llvm
603+
604+
add r5, r5, r7
605+
606+
due to ``7`` being unequal to ``5 + 1``.
607+
608+
The ``--enable-var-scope`` option has the same effect on numeric variables as
609+
on pattern variables.
610+
611+
FileCheck Pseudo Numeric Variables
612+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
565613

566614
Sometimes there's a need to verify output that contains line numbers of the
567615
match file, e.g. when testing compiler diagnostics. This introduces a certain
568616
fragility of the match file structure, as "``CHECK:``" lines contain absolute
569617
line numbers in the same file, which have to be updated whenever line numbers
570618
change due to text addition or deletion.
571619

572-
To support this case, FileCheck allows using ``[[#@LINE]]``,
573-
``[[#@LINE+<offset>]]`` and ``[[#@LINE-<offset>]]`` numeric expressions in
574-
patterns, with an arbitrary number of spaces between each element of the
575-
expression. These expressions expand to the number of the line where a pattern
576-
is located (with an optional integer offset).
620+
To support this case, FileCheck understands the ``@LINE`` pseudo numeric
621+
variable which evaluates to the line number of the CHECK pattern where it is
622+
found.
577623

578624
This way match patterns can be put near the relevant test lines and include
579625
relative line number references, for example:

docs/LangRef.rst

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14823,6 +14823,77 @@ The result produced is the product of the first two operands added to the third
1482314823
operand computed with infinite precision, and then rounded to the target
1482414824
precision.
1482514825

14826+
'``llvm.experimental.constrained.fptrunc``' Intrinsic
14827+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14828+
14829+
Syntax:
14830+
"""""""
14831+
14832+
::
14833+
14834+
declare <ty2>
14835+
@llvm.experimental.constrained.fptrunc(<type> <value>,
14836+
metadata <rounding mode>,
14837+
metadata <exception behavior>)
14838+
14839+
Overview:
14840+
"""""""""
14841+
14842+
The '``llvm.experimental.constrained.fptrunc``' intrinsic truncates ``value``
14843+
to type ``ty2``.
14844+
14845+
Arguments:
14846+
""""""""""
14847+
14848+
The first argument to the '``llvm.experimental.constrained.fptrunc``'
14849+
intrinsic must be :ref:`floating point <t_floating>` or :ref:`vector
14850+
<t_vector>` of floating point values. This argument must be larger in size
14851+
than the result.
14852+
14853+
The second and third arguments specify the rounding mode and exception
14854+
behavior as described above.
14855+
14856+
Semantics:
14857+
""""""""""
14858+
14859+
The result produced is a floating point value truncated to be smaller in size
14860+
than the operand.
14861+
14862+
'``llvm.experimental.constrained.fpext``' Intrinsic
14863+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14864+
14865+
Syntax:
14866+
"""""""
14867+
14868+
::
14869+
14870+
declare <ty2>
14871+
@llvm.experimental.constrained.fpext(<type> <value>,
14872+
metadata <exception behavior>)
14873+
14874+
Overview:
14875+
"""""""""
14876+
14877+
The '``llvm.experimental.constrained.fpext``' intrinsic extends a
14878+
floating-point ``value`` to a larger floating-point value.
14879+
14880+
Arguments:
14881+
""""""""""
14882+
14883+
The first argument to the '``llvm.experimental.constrained.fpext``'
14884+
intrinsic must be :ref:`floating point <t_floating>` or :ref:`vector
14885+
<t_vector>` of floating point values. This argument must be smaller in size
14886+
than the result.
14887+
14888+
The second argument specifies the exception behavior as described above.
14889+
14890+
Semantics:
14891+
""""""""""
14892+
14893+
The result produced is a floating point value extended to be larger in size
14894+
than the operand. All restrictions that apply to the fpext instruction also
14895+
apply to this intrinsic.
14896+
1482614897
Constrained libm-equivalent Intrinsics
1482714898
--------------------------------------
1482814899

include/llvm/CodeGen/ISDOpcodes.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,26 @@ namespace ISD {
297297
STRICT_FRINT, STRICT_FNEARBYINT, STRICT_FMAXNUM, STRICT_FMINNUM,
298298
STRICT_FCEIL, STRICT_FFLOOR, STRICT_FROUND, STRICT_FTRUNC,
299299

300+
/// X = STRICT_FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating
301+
/// point type down to the precision of the destination VT. TRUNC is a
302+
/// flag, which is always an integer that is zero or one. If TRUNC is 0,
303+
/// this is a normal rounding, if it is 1, this FP_ROUND is known to not
304+
/// change the value of Y.
305+
///
306+
/// The TRUNC = 1 case is used in cases where we know that the value will
307+
/// not be modified by the node, because Y is not using any of the extra
308+
/// precision of source type. This allows certain transformations like
309+
/// STRICT_FP_EXTEND(STRICT_FP_ROUND(X,1)) -> X which are not safe for
310+
/// STRICT_FP_EXTEND(STRICT_FP_ROUND(X,0)) because the extra bits aren't
311+
/// removed.
312+
/// It is used to limit optimizations while the DAG is being optimized.
313+
STRICT_FP_ROUND,
314+
315+
/// X = STRICT_FP_EXTEND(Y) - Extend a smaller FP type into a larger FP
316+
/// type.
317+
/// It is used to limit optimizations while the DAG is being optimized.
318+
STRICT_FP_EXTEND,
319+
300320
/// FMA - Perform a * b + c with no intermediate rounding step.
301321
FMA,
302322

include/llvm/CodeGen/SelectionDAGNodes.h

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,8 @@ END_TWO_BYTE_PACK()
691691
case ISD::STRICT_FFLOOR:
692692
case ISD::STRICT_FROUND:
693693
case ISD::STRICT_FTRUNC:
694+
case ISD::STRICT_FP_ROUND:
695+
case ISD::STRICT_FP_EXTEND:
694696
return true;
695697
}
696698
}
@@ -2588,20 +2590,6 @@ namespace ISD {
25882590
cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
25892591
}
25902592

2591-
/// Return true if the node is a math/logic binary operator.
2592-
inline bool isBinaryOp(const SDNode *N) {
2593-
auto Op = N->getOpcode();
2594-
return (Op == ISD::ADD || Op == ISD::SUB || Op == ISD::MUL ||
2595-
Op == ISD::AND || Op == ISD::OR || Op == ISD::XOR ||
2596-
Op == ISD::SHL || Op == ISD::SRL || Op == ISD::SRA ||
2597-
Op == ISD::SDIV || Op == ISD::UDIV || Op == ISD::SREM ||
2598-
Op == ISD::UREM || Op == ISD::FADD || Op == ISD::FSUB ||
2599-
Op == ISD::FMUL || Op == ISD::FDIV || Op == ISD::FREM ||
2600-
Op == ISD::FMINNUM || Op == ISD::FMAXNUM ||
2601-
Op == ISD::FMINNUM_IEEE || Op == ISD::FMAXNUM_IEEE ||
2602-
Op == ISD::FMAXIMUM || Op == ISD::FMINIMUM);
2603-
}
2604-
26052593
/// Attempt to match a unary predicate against a scalar/splat constant or
26062594
/// every element of a constant BUILD_VECTOR.
26072595
/// If AllowUndef is true, then UNDEF elements will pass nullptr to Match.

include/llvm/CodeGen/TargetLowering.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,8 @@ class TargetLoweringBase {
891891
case ISD::STRICT_FFLOOR: EqOpc = ISD::FFLOOR; break;
892892
case ISD::STRICT_FROUND: EqOpc = ISD::FROUND; break;
893893
case ISD::STRICT_FTRUNC: EqOpc = ISD::FTRUNC; break;
894+
case ISD::STRICT_FP_ROUND: EqOpc = ISD::FP_ROUND; break;
895+
case ISD::STRICT_FP_EXTEND: EqOpc = ISD::FP_EXTEND; break;
894896
}
895897

896898
auto Action = getOperationAction(EqOpc, VT);
@@ -2170,6 +2172,39 @@ class TargetLoweringBase {
21702172
return false;
21712173
}
21722174

2175+
/// Return true if the node is a math/logic binary operator.
2176+
virtual bool isBinOp(unsigned Opcode) const {
2177+
switch (Opcode) {
2178+
case ISD::ADD:
2179+
case ISD::SUB:
2180+
case ISD::MUL:
2181+
case ISD::AND:
2182+
case ISD::OR:
2183+
case ISD::XOR:
2184+
case ISD::SHL:
2185+
case ISD::SRL:
2186+
case ISD::SRA:
2187+
case ISD::SDIV:
2188+
case ISD::UDIV:
2189+
case ISD::SREM:
2190+
case ISD::UREM:
2191+
case ISD::FADD:
2192+
case ISD::FSUB:
2193+
case ISD::FMUL:
2194+
case ISD::FDIV:
2195+
case ISD::FREM:
2196+
case ISD::FMINNUM:
2197+
case ISD::FMAXNUM:
2198+
case ISD::FMINNUM_IEEE:
2199+
case ISD::FMAXNUM_IEEE:
2200+
case ISD::FMAXIMUM:
2201+
case ISD::FMINIMUM:
2202+
return true;
2203+
default:
2204+
return false;
2205+
}
2206+
}
2207+
21732208
/// Returns true if the opcode is a commutative binary operation.
21742209
virtual bool isCommutativeBinOp(unsigned Opcode) const {
21752210
// FIXME: This should get its info from the td file.

include/llvm/DebugInfo/DWARF/DWARFFormValue.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ class DWARFFormValue {
104104
/// getAsFoo functions below return the extracted value as Foo if only
105105
/// DWARFFormValue has form class is suitable for representing Foo.
106106
Optional<uint64_t> getAsReference() const;
107+
struct UnitOffset {
108+
DWARFUnit *Unit;
109+
uint64_t Offset;
110+
};
111+
Optional<UnitOffset> getAsRelativeReference() const;
107112
Optional<uint64_t> getAsUnsignedConstant() const;
108113
Optional<int64_t> getAsSignedConstant() const;
109114
Optional<const char *> getAsCString() const;

include/llvm/ExecutionEngine/JITLink/JITLink.h

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "llvm/Support/Endian.h"
2323
#include "llvm/Support/Error.h"
2424
#include "llvm/Support/FormatVariadic.h"
25+
#include "llvm/Support/MathExtras.h"
2526
#include "llvm/Support/Memory.h"
2627
#include "llvm/Support/MemoryBuffer.h"
2728

@@ -329,9 +330,12 @@ class Section {
329330
friend class AtomGraph;
330331

331332
private:
332-
Section(StringRef Name, sys::Memory::ProtectionFlags Prot, unsigned Ordinal,
333-
bool IsZeroFill)
334-
: Name(Name), Prot(Prot), Ordinal(Ordinal), IsZeroFill(IsZeroFill) {}
333+
Section(StringRef Name, uint32_t Alignment, sys::Memory::ProtectionFlags Prot,
334+
unsigned Ordinal, bool IsZeroFill)
335+
: Name(Name), Alignment(Alignment), Prot(Prot), Ordinal(Ordinal),
336+
IsZeroFill(IsZeroFill) {
337+
assert(isPowerOf2_32(Alignment) && "Alignments must be a power of 2");
338+
}
335339

336340
using DefinedAtomSet = DenseSet<DefinedAtom *>;
337341

@@ -341,6 +345,7 @@ class Section {
341345

342346
~Section();
343347
StringRef getName() const { return Name; }
348+
uint32_t getAlignment() const { return Alignment; }
344349
sys::Memory::ProtectionFlags getProtectionFlags() const { return Prot; }
345350
unsigned getSectionOrdinal() const { return Ordinal; }
346351
size_t getNextAtomOrdinal() { return ++NextAtomOrdinal; }
@@ -388,6 +393,7 @@ class Section {
388393
}
389394

390395
StringRef Name;
396+
uint32_t Alignment = 0;
391397
sys::Memory::ProtectionFlags Prot;
392398
unsigned Ordinal = 0;
393399
unsigned NextAtomOrdinal = 0;
@@ -403,12 +409,16 @@ class DefinedAtom : public Atom {
403409
private:
404410
DefinedAtom(Section &Parent, JITTargetAddress Address, uint32_t Alignment)
405411
: Atom("", Address), Parent(Parent), Ordinal(Parent.getNextAtomOrdinal()),
406-
Alignment(Alignment) {}
412+
Alignment(Alignment) {
413+
assert(isPowerOf2_32(Alignment) && "Alignments must be a power of two");
414+
}
407415

408416
DefinedAtom(Section &Parent, StringRef Name, JITTargetAddress Address,
409417
uint32_t Alignment)
410418
: Atom(Name, Address), Parent(Parent),
411-
Ordinal(Parent.getNextAtomOrdinal()), Alignment(Alignment) {}
419+
Ordinal(Parent.getNextAtomOrdinal()), Alignment(Alignment) {
420+
assert(isPowerOf2_32(Alignment) && "Alignments must be a power of two");
421+
}
412422

413423
public:
414424
using edge_iterator = EdgeVector::iterator;
@@ -510,7 +520,7 @@ inline uint64_t SectionRange::getSize() const { return getEnd() - getStart(); }
510520
inline SectionRange Section::getRange() const {
511521
if (atoms_empty())
512522
return SectionRange();
513-
DefinedAtom *First = *DefinedAtoms.begin(), *Last = *DefinedAtoms.end();
523+
DefinedAtom *First = *DefinedAtoms.begin(), *Last = *DefinedAtoms.begin();
514524
for (auto *DA : atoms()) {
515525
if (DA->getAddress() < First->getAddress())
516526
First = DA;
@@ -602,10 +612,10 @@ class AtomGraph {
602612
support::endianness getEndianness() const { return Endianness; }
603613

604614
/// Create a section with the given name, protection flags, and alignment.
605-
Section &createSection(StringRef Name, sys::Memory::ProtectionFlags Prot,
606-
bool IsZeroFill) {
615+
Section &createSection(StringRef Name, uint32_t Alignment,
616+
sys::Memory::ProtectionFlags Prot, bool IsZeroFill) {
607617
std::unique_ptr<Section> Sec(
608-
new Section(Name, Prot, Sections.size(), IsZeroFill));
618+
new Section(Name, Alignment, Prot, Sections.size(), IsZeroFill));
609619
Sections.push_back(std::move(Sec));
610620
return *Sections.back();
611621
}

include/llvm/ExecutionEngine/Orc/LLJIT.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ class LLJIT {
5959
/// Convenience method for defining an absolute symbol.
6060
Error defineAbsolute(StringRef Name, JITEvaluatedSymbol Address);
6161

62-
/// Convenience method for defining an
63-
6462
/// Adds an IR module to the given JITDylib.
6563
Error addIRModule(JITDylib &JD, ThreadSafeModule TSM);
6664

include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ namespace orc {
3434

3535
/// Lazy-emitting IR layer.
3636
///
37-
/// This layer accepts LLVM IR Modules (via addModule), but does not
38-
/// immediately emit them the layer below. Instead, emissing to the base layer
37+
/// This layer accepts LLVM IR Modules (via addModule) but does not
38+
/// immediately emit them the layer below. Instead, emission to the base layer
3939
/// is deferred until the first time the client requests the address (via
4040
/// JITSymbol::getAddress) for a symbol contained in this layer.
4141
template <typename BaseLayerT> class LazyEmittingLayer {

0 commit comments

Comments
 (0)