Commit Graph

226 Commits

Author SHA1 Message Date
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
Kazushi (Jam) Marukawa 4648098f97 [VE] Change inetger constants 32-bit friendly
Correct integer constants like `1UL << 63` to `UINT64_C(1) << 63` in
order to make them work on 32-bit machines.  Tested on both an i386
and x86_64 machines.

Reviewed By: mgorny

Differential Revision: https://reviews.llvm.org/D95724
2021-02-01 19:00:47 +09:00
Kazu Hirata 177b8d1ad3 [VE] Fix compiler warnings (NFC) 2021-01-31 10:23:39 -08:00
Kazu Hirata 8ed1636184 [llvm] Use isa instead of dyn_cast (NFC) 2021-01-29 23:23:37 -08:00
Fangrui Song ee4f8860e5 [VE] Add include for formatted_raw_ostream after 046cfb8565 2021-01-29 11:18:30 -08:00
Kazu Hirata 8a20e2b3d3 [llvm] Use Optional::getValueOr (NFC) 2021-01-12 21:43:50 -08:00
Kazushi (Jam) Marukawa d02de13932 [VE] Support additional VMRGW and VMV intrinsic instructions
Support missing VMRGW and VMV intrinsic instructions and add regression
tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D94300
2021-01-11 20:50:31 +09:00
Kazushi (Jam) Marukawa b72ca79982 [VE] Support intrinsic to isnert/extract_subreg of v512i1
Support insert/extract_subreg intrinsic instructions for v512i1
registers and add regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D94298
2021-01-11 20:40:10 +09:00
Kazushi (Jam) Marukawa 5ead757f1d [VE] Support pack_f32p and pack_f32a intrinsic instructions
Support pack_f32p and pack_f32a intrinsic instructions and regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D94296
2021-01-08 22:59:11 +09:00
Simon Moll 611d3c63f3 [VP] ISD helper functions [VE] isel for vp_add, vp_and
This implements vp_add, vp_and for the VE target by lowering them to the
VVP_* layer. We also add helper functions for VP SDNodes (isVPSDNode,
getVPMaskIdx, getVPExplicitVectorLengthIdx).

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D93766
2021-01-08 14:29:45 +01:00
Kazushi (Jam) Marukawa 99c84af1a2 [VE][NFC] Clean ISel patterns for LSV and LVS
Clean ISel patterns for LSV and LVS before upstream more hand-written
ISel patterns.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D94291
2021-01-08 21:47:33 +09:00
Simon Moll eeba70a463 [VE] Expand single-element BUILD_VECTOR to INSERT_VECTOR_ELT
We do this mostly to be able to test the insert_vector_elt isel
patterns. As long as we don't, most single element insertions show up as
`BUILD_VECTOR` in the backend.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D93759
2021-01-08 11:48:01 +01:00
Simon Moll d1b606f897 [VE] Extract & insert vector element isel
Isel and tests for extract_vector_elt and insert_vector_elt.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D93687
2021-01-08 11:46:59 +01:00
Kazushi (Jam) Marukawa 12167632bc [VE] Add SVOB intrinsic instruction
Add SVOB intrinsic instruction and a regression test.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D94279
2021-01-08 18:49:17 +09:00
Kazushi (Jam) Marukawa 3bfc9bb8ef [VE][NFC] Update comments to match the generated instructions 2021-01-07 15:13:24 +09:00
Kazushi (Jam) Marukawa f784be0777 [VE] Support SJLJ exception related instructions
Support EH_SJLJ_LONGJMP, EH_SJLJ_SETJMP, and EH_SJLJ_SETUP_DISPATCH
for SjLj exception handling.  NC++ uses SjLj exception handling, so
implement it first.  Add regression tests also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D94071
2021-01-05 20:19:15 +09:00
Kazushi (Jam) Marukawa 53a341a61d [VE][NFC] Fix typo in comments 2021-01-05 18:55:28 +09:00
Kazushi (Jam) Marukawa 2654f33c47 [VE] Support llvm.eh.sjlj.lsda
In order to support SJLJ exception, implement llvm.eh.sjlj.lsda first.
Add regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93811
2021-01-05 18:06:14 +09:00
Kazushi (Jam) Marukawa c287f90ccd [VE] Change default CPU name to "generic"
Change default CPU name of SX-Aurora VE from "ve" to "generic" similar
to other architectures.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93836
2021-01-04 20:09:57 +09:00
Kazushi (Jam) Marukawa 74e7cb26b9 [VE] Remove VA.needsCustom checks
Remove VA.needsCustom checks which are copied from Sparc implementation
at the very beginning of VE implementation.  Add assert to sanity-check
VA.needsCustom flag, also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93847
2021-01-04 18:19:18 +09:00
Simon Moll c3acda0798 [VE] Vector 'and' isel and tests
Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D93709
2020-12-23 13:29:29 +01:00
Kazushi (Jam) Marukawa 8c2ad9e85f [VE] Correct VMP allocation in calling conv
VE used to allocate VM1, VM2, VMP2 (VM4+VM5), and VM3.  This patch
corrects to allocate VM1, VM2, VMP2 (VM4+VM5), and VM6.  Also add
a regression test.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93570
2020-12-21 22:42:24 +09:00
Kazushi (Jam) Marukawa a3a896d1cd [VE] Optimize LEA combinations
Change to optimize references of elements of aggregate data.  Also
add regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93627
2020-12-21 22:21:10 +09:00
Kazushi (Jam) Marukawa 5e273b845b [VE] Support STACKSAVE and STACKRESTORE
Change to use default expanded code.  Add regression tests also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93539
2020-12-21 20:15:50 +09:00
Kazushi (Jam) Marukawa d99e4a4840 [VE] Support RETURNADDR
Implement RETURNADDR for VE.  Add a regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93545
2020-12-21 20:06:03 +09:00
Kazushi (Jam) Marukawa af83b74dc2 [VE] Support copy of vector mask registers
Support VM and VMP registers in copyPhysReg() function.  Also add
regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93547
2020-12-19 09:16:43 +09:00
Kazushi (Jam) Marukawa 697226550e [VE] Support FRAMEADDR
Implement FRAMEADDR for VE.  Add a regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93295
2020-12-15 23:31:19 +09:00
Kazushi (Jam) Marukawa 2a2268a6db [VE][NFC] Sort VEISD operations
Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93294
2020-12-15 23:29:16 +09:00
Kazushi (Jam) Marukawa a2eb07aa55 [VE] Support atomic exchange instructions
Support atomic exchange and atomic compare and exchange instructions.
Change CAS and TS1AM instructions for ISel patterns.  Add selectADDRzi
pattern for them.  Add TS1AM pseudo instruction also for better ISel.
Add shouldExpandAtomicRMWInIR() function to expand all atomicrmw
instructions except atomicrmw xchg.  Add custom lower for i8/i16
atomicrmw xchg.  Modify replaceFI to support CAS/TS1AM instructions
which use "reg+disp" operands instead of "reg+imm+disp" operands.
And, add several regression tests to check the correctness.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93161
2020-12-15 17:43:11 +09:00
Kazushi (Jam) Marukawa aefedb1707 [VE] Add logical mask intrinsic instructions
Add andm, orm, xorm, eqvm, nndm, negm, pcvm, lzvm, and tovm intrinsic
instructions, a few pseudo instructions to expand logical intrinsic
using VM512, a mechnism to expand such pseudo instructions, and
regression tests.  Also, assign vector mask types and vector mask
register classes correctly.  This is required to use VM512 registers
as function arguments.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93093
2020-12-15 01:34:31 +09:00
Kazushi (Jam) Marukawa c9213e1b29 [VE] Correct addRegisterClass calls
Correct addRegisterClass calls for vector mask registers.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93212
2020-12-15 01:16:56 +09:00
Kazushi (Jam) Marukawa 87f308ab3d [VE] Add vgt and vsc intrinsic instructions
Add vgt and vsc intrinsic instructions and regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D93032
2020-12-11 18:23:43 +09:00
Kazushi (Jam) Marukawa 4b1e329255 [VE] Add vector reduce intrinsic instructions
Add vrmax, vrmin, vfrmax, vfrmin, vrand, vror, and vrxor intrinsic
instructions and regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D92941
2020-12-10 22:21:17 +09:00
Kazushi (Jam) Marukawa 1a2147fead [VE] Add vsum and vfsum intrinsic instructions
Add vsum and vfsum intrinsic instructions and regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D92938
2020-12-10 01:11:53 +09:00
Kazushi (Jam) Marukawa 398f29fbb0 [VE] Add vfmk intrinsic instructions
Add vfmk intrinsic instructions, a few pseudo instructions to expand
vfmk intrinsic using VM512 correctly, and regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D92758
2020-12-10 00:08:20 +09:00