Commit Graph

260 Commits

Author SHA1 Message Date
Simon Moll ae1bb44ed8 [VE] v256.32|64 setcc isel and tests
Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D119223
2022-02-08 13:20:55 +01:00
Kazu Hirata 3a3cb929ab [llvm] Use = default (NFC) 2022-02-06 22:18:35 -08:00
Simon Moll 73ac3b1371 [VE] Packed v512i32 isel and tests
Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D118332
2022-02-03 11:01:54 +01:00
Simon Moll 31cca9e6ba [VE] Packed v512f32 binop isel and tests
Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D118335
2022-02-02 10:09:39 +01:00
Simon Moll 7d926b7177 [VE] LEGALAVL and staged VVP legalization
The new LEGALAVL node annotates that the AVL refers to packs of 64bit.
We use a two-stage lowering approach with LEGALAVL:

First, standard SDNodes are translated into illegal VVP layer nodes.
Regardless of source (VP or standard), all VVP nodes have a mask and AVL
parameter. The AVL parameter refers to the element position (just as in
VP intrinsics).

Second, we legalize the AVL usage in VVP layer nodes. If the element
size is < 64bit, the EVL parameter has to be adjusted to refer to packs
of 64bits.  We wrap the legalized AVL in a LEGALAVL node to track this.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D118321
2022-02-02 09:11:41 +01:00
Benjamin Kramer f15014ff54 Revert "Rename llvm::array_lengthof into llvm::size to match std::size from C++17"
This reverts commit ef82063207.

- It conflicts with the existing llvm::size in STLExtras, which will now
  never be called.
- Calling it without llvm:: breaks C++17 compat
2022-01-26 16:55:53 +01:00
serge-sans-paille ef82063207 Rename llvm::array_lengthof into llvm::size to match std::size from C++17
As a conquence move llvm::array_lengthof from STLExtras.h to
STLForwardCompat.h (which is included by STLExtras.h so no build
breakage expected).
2022-01-26 16:17:45 +01:00
Simon Moll 5ceb0bc7ea [VE] Packed 32/64bit broadcast isel and tests
Packed-mode broadcast of f32/i32 requires the subregister to be
replicated to the full I64 register prior. Add repl_i32 and repl_f32 to
faciliate this.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D117878
2022-01-26 14:16:06 +01:00
Kazu Hirata bf039a8620 [Target] Use range-based for loops (NFC) 2022-01-23 22:53:15 -08:00
Simon Moll 7950010e49 [VE][NFC] Factor out helper functions
Factor out some helper functions to cleanup VEISelLowering.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D117683
2022-01-21 09:15:59 +01:00
Jim Lin d6b0734837 [NFC] Use Register instead of unsigned 2022-01-19 20:17:04 +08:00
Simon Moll 1b09d0c42b [VE] VECustomDAG builder class
VECustomDAG's functions simplify emitting VE custom ISD nodes. The class
is just a stub now. We add more functions, in particular for the
VP->VVP->VE lowering, to VECustomDAG as we build up vector isel.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D116103
2022-01-18 12:08:07 +01:00
Simon Moll 43994e9a4a [VE] vp_select+vectorBinOp passthru isel and tests
Extend the VE binaryop vector isel patterns to use passthru when the
result of a SDNode is used in a vector select or merge.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D117495
2022-01-18 11:31:14 +01:00
Simon Moll 95bf5ac8a8 [VE] select|vp.merge|vp.select v256 isel and tests
Use the `VMRG` for all three operations for now. `vp_select` will be
used in passthru patterns.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D117206
2022-01-17 15:58:54 +01:00
Kazu Hirata 2aed08131d [llvm] Use true/false instead of 1/0 (NFC)
Identified with modernize-use-bool-literals.
2022-01-07 00:39:14 -08:00
Qiu Chaofan c2cc70e4f5 [NFC] Fix endif comments to match with include guard 2022-01-07 15:52:59 +08:00
Kazu Hirata f3a344d212 [Target] Remove redundant member initialization (NFC)
Identified with readability-redundant-member-init.
2022-01-06 22:01:44 -08:00
Kazu Hirata e5947760c2 Revert "[llvm] Remove redundant member initialization (NFC)"
This reverts commit fd4808887e.

This patch causes gcc to issue a lot of warnings like:

  warning: base class ‘class llvm::MCParsedAsmOperand’ should be
  explicitly initialized in the copy constructor [-Wextra]
2022-01-03 11:28:47 -08:00
Kazu Hirata 7e163afd9e Remove redundant void arguments (NFC)
Identified by modernize-redundant-void-arg.
2022-01-02 10:20:19 -08:00
Kazu Hirata 41bfac6aed [Target] Remove unused forward declarations (NFC) 2022-01-02 10:20:15 -08:00
Kazu Hirata fd4808887e [llvm] Remove redundant member initialization (NFC)
Identified with readability-redundant-member-init.
2022-01-01 16:18:18 -08:00
Simon Moll b2cea573c9 [VE] FADD,FSUB,FMUL,FDIV v256f32|f64 isel and tests
Depends on D115940 for the `Binary_rv_vr_vv` pattern class op isel
fragment used for divisions.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D116035
2021-12-21 09:15:31 +01:00
Simon Moll 8c51812913 [VE] U|SDIV v256i32|64 isel and tests
Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D115940
2021-12-21 08:51:01 +01:00
Simon Moll 676af1272b [VE] SHL,SRA,SRL v256i32|64 isel and tests
Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D115734
2021-12-15 11:32:18 +01:00
Simon Moll 6847379e89 [VE] MUL,SUB,OR,XOR v256i32|64 isel
v256i32|i64 isel patterns and tests.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D115643
2021-12-14 13:23:48 +01:00
Kazushi (Jam) Marukawa cffce86a1c [VE] Support srel32 in symbol reference
Support R_VE_SREL32 in symbol references in MC layer.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D115591
2021-12-13 20:29:17 +09:00
Simon Moll 9feeb2fb61 [VE][NFC] Cleanup vector patterns
Cleanup VE vector isel patterns and follow the downstream LLVM-VE
pattern naming convention.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D115516
2021-12-13 10:12:27 +01:00
Kazushi (Jam) Marukawa e71fa0336f [VE] Change error handling of data references
Change to use Ctx.reportError() instead of llvm_unreachable for
better error handling.  Also correct evaluateAsRelocatableImpl().

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D115251
2021-12-08 21:06:57 +09:00
Kazushi (Jam) Marukawa 9d20fa09eb [VE] Support VE specific data directives in MC
Support VE specific data directives, .word/.long/.llong, in MC layer.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D115120
2021-12-06 20:07:44 +09:00
Kazushi (Jam) Marukawa 6b41eb7f26 [VE] Change to use R_VE_SREL32
Change to use R_VE_SREL32 for relative branch instructions instead of
R_VE_PC_LO32 in order to check ranges of relative branch isntructions
at link time correctly.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D115097
2021-12-06 20:06:37 +09:00
Simon Moll e92429d99b [VE][NFC] Cleanup redundant namespace wrapper 2021-12-02 15:23:37 +01:00
Simon Moll e37000f3bf [VE][NFC] Fix use-after-free in PVFMK expansion
There is custom expansion code for packed VFMK Pseudos in the VE
backend.  This code erased the Pseudo without telling
ExpandPostRAPseudos about it, causing the generic expansion function to
access the erased Pseudo.  This bug triggered in the
test/CodeGen/VE/VELIntrinsics/vfmk.ll test with asan-enabled builds.

Detected by:
sanitizer-x86_64-linux-fast
(https://lab.llvm.org/buildbot/#/builders/5/builds/15393)
2021-12-02 10:41:11 +01:00
Simon Moll 435d44bf8a [VE][NFC] Fix use-after-free in VEInstrInfo
First call getOperand, then erase the MachineInstr. Not the other way
round.

Expected to fix test/CodeGen/VE/VELIntrinsics/lvm.ll

Detected by asan buildbot:

  sanitizer-x86_64-linux-fast
  (https://lab.llvm.org/buildbot/#/builders/5/builds/15384)
2021-12-01 19:30:27 +01:00
Simon Pilgrim 1bd01defff [VE] Remove switch with only default case statement to fix MSVC warning. NFC. 2021-12-01 16:37:48 +00:00
Zarko Todorovski 5b8bbbecfa [NFC][llvm] Inclusive language: reword and remove uses of sanity in llvm/lib/Target
Reworded removed code comments that contain `sanity check` and `sanity
test`.
2021-11-17 21:59:00 -05:00
Simon Moll 7cf887b950 [VE] Fix SDNode user loop after efa896e5f7
Rewriting SDNode user loops broke VEISelLowering (commit efa896e5f7).
This fixes it.
2021-11-15 09:53:09 +01:00
Kazu Hirata efa896e5f7 [Target] Use SDNode::uses (NFC) 2021-11-12 21:23:04 -08:00
Simon Moll 751aa6c280 [VE][NFCi] Remove unused tablegen parameters
TableGen has started warning about unused template parameters in the isel patterns.  Remove those.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D113675
2021-11-12 08:19:50 +01:00
Simon Moll c2b91eef27 [VE] default to integrated asm in AsmInfo
VE integrated asm has been the default in Clang. Also use the default setting for integrated asm in the backend.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D113384
2021-11-08 11:58:29 +01:00
Reid Kleckner b3a6d096d7 Fix shlib builds for all lib/Target/*/TargetInfo libs
They all must depend on MC now that the target registry is in MC.
Also fix llvm-cxxdump
2021-10-08 15:21:13 -07:00
Reid Kleckner 89b57061f7 Move TargetRegistry.(h|cpp) from Support to MC
This moves the registry higher in the LLVM library dependency stack.
Every client of the target registry needs to link against MC anyway to
actually use the target, so we might as well move this out of Support.

This allows us to ensure that Support doesn't have includes from MC/*.

Differential Revision: https://reviews.llvm.org/D111454
2021-10-08 14:51:48 -07:00
Peter Smith e63455d5e0 [MC] Use local MCSubtargetInfo in writeNops
On some architectures such as Arm and X86 the encoding for a nop may
change depending on the subtarget in operation at the time of
encoding. This change replaces the per module MCSubtargetInfo retained
by the targets AsmBackend in favour of passing through the local
MCSubtargetInfo in operation at the time.

On Arm using the architectural NOP instruction can have a performance
benefit on some implementations.

For Arm I've deleted the copy of the AsmBackend's MCSubtargetInfo to
limit the chances of this causing problems in the future. I've not
done this for other targets such as X86 as there is more frequent use
of the MCSubtargetInfo and it looks to be for stable properties that
we would not expect to vary per function.

This change required threading STI through MCNopsFragment and
MCBoundaryAlignFragment.

I've attempted to take into account the in tree experimental backends.

Differential Revision: https://reviews.llvm.org/D45962
2021-09-07 15:46:19 +01:00
Kazushi (Jam) Marukawa 4ee28b4fec [VE] Set getExtendForAtomicOps to ISD::ANY_EXTEND
The implementation of subword atomics does not actually
guarantee the result is zero-extended, which now caused
failures after https://reviews.llvm.org/D101342 was landed.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D106225
2021-07-19 19:58:44 +09:00
Kazushi (Jam) Marukawa b28e5b7910 [VE] Disable relative lookup table converter pass for VE
VE's linker, /opt/nec/ve/bin/nld, doesn't implement relative lookup table.
The relative lookup table is introduced by https://reviews.llvm.org/D94355,
but we need to disable it at the moment.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D106224
2021-07-19 19:25:33 +09:00
Simon Moll 2b626aba44 [VE][NFC] IRBuilder<> -> IRBuilderBase
VE's TTI broke with the switch from IRBuilder<> to IRBuilderBase.
Following that change to compile again.
2021-06-08 13:55:49 +02:00
Simon Moll 7a86645611 [VE] VP intrinsics are legal 2021-04-30 15:47:55 +02:00
Tomas Matheson a9968c0a33 [NFC][CodeGen] Tidy up TargetRegisterInfo stack realignment functions
Currently needsStackRealignment returns false if canRealignStack returns false.
This means that the behavior of needsStackRealignment does not correspond to
it's name and description; a function might need stack realignment, but if it
is not possible then this function returns false. Furthermore,
needsStackRealignment is not virtual and therefore some backends have made use
of canRealignStack to indicate whether a function needs stack realignment.

This patch attempts to clarify the situation by separating them and introducing
new names:

 - shouldRealignStack - true if there is any reason the stack should be
   realigned

 - canRealignStack - true if we are still able to realign the stack (e.g. we
   can still reserve/have reserved a frame pointer)

 - hasStackRealignment = shouldRealignStack && canRealignStack (not target
   customisable)

Targets can now override shouldRealignStack to indicate that stack realignment
is required.

This change will make it easier in a future change to handle the case where we
need to realign the stack but can't do so (for example when the register
allocator creates an aligned spill after the frame pointer has been
eliminated).

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

Change-Id: Ib9a4d21728bf9d08a545b4365418d3ffe1af4d87
2021-03-30 17:31:39 +01:00
Sander de Smalen 55d18b3cc2 [TTI] Return a TypeSize from getRegisterBitWidth.
This patch changes the interface to take a RegisterKind, to indicate
whether the register bitwidth of a scalar register, fixed-width vector
register, or scalable vector register must be returned.

Reviewed By: paulwalker-arm

Differential Revision: https://reviews.llvm.org/D98874
2021-03-24 14:45:13 +00:00
Fangrui Song 879760c245 [VE] Fix types of multiclass template arguments in TableGen files
There were not properly checked before `[TableGen] Improve handling of template arguments`.
2021-03-20 10:36:51 -07:00
Fangrui Song dc6a5e070d [VE] Fix allowsMisalignedMemoryAccesses after D96097 2021-02-04 20:46:18 -08:00