Commit Graph

211 Commits

Author SHA1 Message Date
Kazushi (Jam) Marukawa 686988a50f [VE] Optimize prologue/epilogue instructions
Optimize eliminate FP mechanism.  This time optimize a function which has
no call but fixed stack objects.  LLVM eliminates FP on such functions now.
Also, optimize GOT/PLT registers save/restore instructions if a given
function doesn't uses them.  In addition, remove generating mechanism of
`.cfi` instructions since those are taken from other architectures and not
inspected yet.  Update regression tests, also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D92251
2020-11-30 22:22:33 +09:00
Kazushi (Jam) Marukawa 44a679eaa4 [VE] Change the behaviour of truncate
Change the way to truncate i64 to i32 in I64 registers.  VE assumed
sext values previously.  Change it to zext values this time to make
it match to the LLVM behaviour.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D92226
2020-11-30 22:12:45 +09:00
Kazushi (Jam) Marukawa 33eac0f283 [VE] Specify vector alignments
Specify alignments for all vector types.  Update a regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D92256
2020-11-30 22:09:21 +09:00
Kazushi (Jam) Marukawa 3bd78b7cc0 [VE] Optimize emitSPAdjustment function
Optimize emitSPAdjustment function to generate as small as possible
instructions to adjust SP.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D92174
2020-11-28 08:06:31 +09:00
Simon Moll b955c7e630 [VE] VE Vector Predicated SDNode, vector add isel and tests
VE Vector Predicated (VVP) SDNodes form an intermediate layer between VE
vector instructions and the initial SDNodes.

We introduce 'vvp_add' with isel and tests as the first of these VVP
nodes. VVP nodes have a mask and explicit vector length operand, which
we will make proper use of later.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D91802
2020-11-23 17:17:07 +01:00
Kazushi (Jam) Marukawa 590aaa5077 [VE] Remove magic numbers 176
Remove magic numbers 176 from VE source codes and update comments.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91958
2020-11-24 00:13:24 +09:00
Kazushi (Jam) Marukawa 677e94c0f0 [VE] Clean canRealignStack implementation
Old canRealignStack calls TRI::canRealignStack and hasReservedCallFrame.
But, this hasReservedCallFrame return true whenever for VE since VE
allocates call frame all the time.  It means this canRealignStack is
identical to TRI::canRealignStack.  This patch removes VE's
canRealignStack and let caller call TRI::canRealignStack directly.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91929
2020-11-23 21:09:03 +09:00
Kazushi (Jam) Marukawa 3a302349eb [VE][NFC] Clean stack frame description
Move stack frame description from VESubtarget.cpp to VEFrameLowering.cpp
and add detail.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91946
2020-11-23 20:59:43 +09:00
Kazushi (Jam) Marukawa 4a1d230fa6 [VE][NFC] Modify function order and simplify comments 2020-11-21 16:09:37 +09:00
Kazushi (Jam) Marukawa 02b2bcd940 [VE] Correct types of return/argument values for getAdjustedFrameSize()
A getAdjustedFrameSize function may need to handle larger than 32 bits
integer, so change int to uint64_t.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91862
2020-11-21 16:08:20 +09:00
Kazushi (Jam) Marukawa 42389f1e96 [VE] Change threshold for jump table generation
Implement getMinimumJumpTableEntries() to specify threshold for jump
table genaration.  We use 8 for the case of PIC mode to relieve the
impact of PIC calculation required to implement PIC mode jump table.
Update jump table regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91785
2020-11-20 21:27:18 +09:00
Simon Moll ffe6c97f6b [VE] VEC_BROADCAST, lowering and isel
This defines the vec_broadcast SDNode along with lowering and isel code.
We also remove unused type mappings for the vector register classes (all vector MVTs that are not used in the ISA go).

We will implement support for short vectors later by intercepting nodes with illegal vector EVTs before LLVM has had a chance to widen them.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D91646
2020-11-19 09:44:56 +01:00
Kazushi (Jam) Marukawa 132d6d73ea [VE] Add vmv intrinsic instructions
Add vmv intrinsic instructions and regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91700
2020-11-19 08:05:35 +09:00
Kazushi (Jam) Marukawa f4517bbd73 [VE] Implement JumpTable
Implement JumpTable to make BRIND work on VE.  Update an existing
br_jt regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91582
2020-11-17 22:43:10 +09:00
Kazushi (Jam) Marukawa 5872cab849 [VE] Correct getMnemonic
https://reviews.llvm.org/D90039 breaks VE backend.  So, fix it.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91619
2020-11-17 22:33:29 +09:00
Kazushi (Jam) Marukawa 3a5c0ea895 [VE] Add vbrd intrinsic instructions
Add vbrd intrinsic instructions and a regression test.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91569
2020-11-17 19:04:18 +09:00
Kazushi (Jam) Marukawa 38621c45a8 [VE] Add lvm/svm intrinsic instructions
Add lvm/svm intrinsic instructions and a regression test.  Change
RegisterInfo to specify that VM0/VMP0 are constant and reserved
registers.  This modifies a vst regression test, so update it.
Also add pseudo instructions for VM512 register classes
and mechanism to expand them after register allocation.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91541
2020-11-17 07:05:36 +09:00
Kazushi (Jam) Marukawa 44a4f93925 [VE] Optimize leaf functions
Optimize leaf functions by not generating save/restore for callee saved
registers.  Update regression tests also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91539
2020-11-17 00:38:01 +09:00
Simon Moll a598c08ac8 [VE] fastcc and vreg-to-vreg copy
This defines a 'fastcc' for the VE target and implements vreg-to-vreg
copy for parameter passing.  The 'fastcc' extends the standard CC for
SX-Aurora with register passing of vector-typed parameters and return
values.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D90842
2020-11-16 16:24:22 +01:00
Kazushi (Jam) Marukawa 37e7a80aed [VE] Add lsv/lvs intrinsic instructions
Add lsv/lvs intrinsic instructions and a regression test.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91526
2020-11-16 23:42:51 +09:00
Kazushi (Jam) Marukawa e0c92c6c03 [VE] Add pfchv intrinsic instructions
Add pfchv intrinsic instructions and a regression test.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91522
2020-11-16 20:10:44 +09:00
Kazushi (Jam) Marukawa 15a2bacab6 [VE] Change variable capitalization
Change dl to DL in VEFrameLowering.cpp.  And clean some comments.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91490
2020-11-16 18:25:23 +09:00
Simon Moll 1c00d096a6 [VE] LVLGen sets VL before vector insts
The VE backend represents vector instructions with an explicit 'i32'
vector length operand.  In the VE ISA, the vector length is always read
from the VL hardware register.  The LVLGen pass inserts 'lvl'
instructions as necessary to set VL to the right value before each
vector instruction.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D91416
2020-11-16 09:19:14 +01:00
Kazushi (Jam) Marukawa 02ab46ef73 [VE] Add vst intrinsic instructions
Add vst intrinsic instructions and a regression test.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91406
2020-11-13 19:11:57 +09:00
serge-sans-paille 9218ff50f9 llvmbuildectomy - replace llvm-build by plain cmake
No longer rely on an external tool to build the llvm component layout.

Instead, leverage the existing `add_llvm_componentlibrary` cmake function and
introduce `add_llvm_component_group` to accurately describe component behavior.

These function store extra properties in the created targets. These properties
are processed once all components are defined to resolve library dependencies
and produce the header expected by llvm-config.

Differential Revision: https://reviews.llvm.org/D90848
2020-11-13 10:35:24 +01:00
Kazushi (Jam) Marukawa 410626c9b5 [VE] Support vld intrinsics
Add intrinsics for vector load instructions.  Add a regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91332
2020-11-13 07:34:42 +09:00
Kazushi (Jam) Marukawa a72d384249 [VE] Change the default type of v64 register class
Change the default type of v64 register class from v512i32 to v256f64.
Add a regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91301
2020-11-12 19:07:07 +09:00
Kazushi (Jam) Marukawa dd6f607ea8 [VE] Implement FoldImmediate
Implement FoldImmediate for only integer aritihmetic operations.
Add regression tests also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91150
2020-11-11 08:08:32 +09:00
Kazushi (Jam) Marukawa 543b30db06 [VE][NFC] Change cast to dyn_cast
We used cast where we should use dyn_cast.  So, change it this time.
Old code cause problems if I implement brind instruction and compile
openmp using new compiler.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91151
2020-11-10 21:49:16 +09:00
Kazushi (Jam) Marukawa c84b2c49be [VE] Support inline assembly with vector regsiters
Support inline assembly with vector registers.  Add a regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91146
2020-11-10 20:55:38 +09:00
Kazushi (Jam) Marukawa b65ef65b22 [VE] Support inline assembly
Support inline assembly with scalar registers.  Add a regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D91119
2020-11-10 18:56:22 +09:00
Simon Moll 7914e4f0fa [VE] Add v(m)regs to preserve_all reg mask
V(m)regs where defined before CSR_preserve_all was, add them now.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D90912
2020-11-06 15:16:11 +01:00
Simon Moll adc69743d2 [VE][NFC] Refactor to support more than one calling conv
Prepare for supporting  different calling conventions by factoring out
things into CC-dependent selection functions (getParamCC, getReturnCC).

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D90911
2020-11-06 14:25:25 +01:00
Kazushi (Jam) Marukawa 43df29e206 [VE] Optimize address calculation
Optimize address calculations using LEA/LEASL instructions.
Update comments in VEISelLowering.cpp also.  Update an
existing regression test optimized by this modification.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90878
2020-11-06 19:46:59 +09:00
Simon Moll d3b33a7810 [VE][TTI] don't advertise vregs/vops
Claim to not have any vector support to dissuade SLP, LV and friends
from generating SIMD IR for the VE target.  We will take this back once
vector isel is stable.

Reviewed By: kaz7, fhahn

Differential Revision: https://reviews.llvm.org/D90462
2020-11-06 11:12:10 +01:00
Kazushi (Jam) Marukawa f0e585d585 [VE] Add isReMaterializable and isAsCheapAsAMove flags
Add isReMaterializable and isCheapAsAMove flags to integer instructions
which cost cheap.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90833
2020-11-06 06:09:10 +09:00
Sander de Smalen d57bba7cf8 [SVE] Return StackOffset for TargetFrameLowering::getFrameIndexReference.
To accommodate frame layouts that have both fixed and scalable objects
on the stack, describing a stack location or offset using a pointer + uint64_t
is not sufficient. For this reason, we've introduced the StackOffset class,
which models both the fixed- and scalable sized offsets.

The TargetFrameLowering::getFrameIndexReference is made to return a StackOffset,
so that this can be used in other interfaces, such as to eliminate frame indices
in PEI or to emit Debug locations for variables on the stack.

This patch is purely mechanical and doesn't change the behaviour of how
the result of this function is used for fixed-sized offsets. The patch adds
various checks to assert that the offset has no scalable component, as frame
offsets with a scalable component are not yet supported in various places.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D90018
2020-11-05 11:02:18 +00:00
Simon Moll 351c10cc72 [VE] Add +vpu attribute
`+vpu` controls whether VEISelLowering adds any vregs.  This defaults to
`-vpu` to have scalar code generation out of the box.  We bring up
vector isel under the `+vpu` flag. Once vector isel is stable we switch
to `+vpu` and advertise vregs and vops in TTI.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D90465
2020-11-04 12:42:00 +01:00
Simon Moll 4474d4d49c [VE][NFC] Split up lowering init
Split up the monolithic VETargetLowering ctor into three initialization phases:
1. initRegisterClasses()
2. initSPUActions()
3. // TODO initVPUActions()

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D90463
2020-10-30 16:18:27 +01:00
Kazushi (Jam) Marukawa 58a6b7bcde [VE] Add missing BCR format
Add missing "BCR %sy, 0, target" format instruction and a regression
test for this format.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90387
2020-10-29 23:30:49 +09:00
Kazushi (Jam) Marukawa 07d1996601 [VE] Support register aliases in llvm-mc
Support register aliases in MC layer to compile existing assembly
files with clang and integrated assembler.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90383
2020-10-29 23:28:32 +09:00
Kazushi (Jam) Marukawa 9c82944b2d [VE] Add vector control instructions
Add LVL/SVL/SMVL/LVIX isntructions.  Add regression tests too.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90355
2020-10-29 19:24:31 +09:00
Kazushi (Jam) Marukawa 7942960199 [VE] Add vector mask operation instructions
Add VFMK/VFMS/VFMF/ANDM/ORM/XORM/EQVM/NNDM/NEGM/PCVM/LZVM/TOVM
isntructions.  Add regression tests too.  Also add new patterns
to parse VFMK/VFMS/VFMF mnemonics.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90297
2020-10-29 08:42:41 +09:00
Kazushi (Jam) Marukawa cbdee7df06 [VE] Add vector merger operation instructions
Add VMRG/VSHF/VCP/VEX isntructions.  Add regression tests too.
Also add new patterns to parse new UImm4 oeprand.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90292
2020-10-28 19:57:10 +09:00
Kazushi (Jam) Marukawa 7ce2b93cbe [VE] Add vector iterative operation instructions
Add VFIA/VFIS/VFIM/VFIAM/VFISM/VFIMA/VFIMS isntructions.
Add regression tests too.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90252
2020-10-28 19:06:46 +09:00
Kazushi (Jam) Marukawa 15f6250bed [VE][NFC] Fix typo in comment 2020-10-28 18:51:07 +09:00
Kazushi (Jam) Marukawa b22e32a9c8 [VE] Specify to expand BRIND and BR_JT
BRIND and BR_JT are not implmented yet, so expand them atm.
Add regression tests too.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90283
2020-10-28 18:50:20 +09:00
Kazushi (Jam) Marukawa a65883a78a [VE] Add vector reduction instructions
Add VSUMS/VSUMX/VFSUM/VMAXS/VMAXX/VFMAX/VRAND/VROR/VRXOR isntructions.
Add regression tests too.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90227
2020-10-28 02:33:21 +09:00
Kazushi (Jam) Marukawa c5fa6bae12 [VE] Add vector float instructions
Add VFAD/VFSB/VFMP/VFDV/VFSQRT/VFCP/VFCM/VFMAD/VFMSB/VFNMAD/VFNMSB/
VRCP/VRSQRT/VRSQRTNEX/VFIX/VFIXX/VFLT/VFLTX/VCVS/VCVD instructions.
Add regression tests too.  Also add additional AsmParser for VFIX
and VFIXX instructions to parse their mnemonic.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90166
2020-10-27 20:42:24 +09:00
Kazushi (Jam) Marukawa 9d0db405b5 [VE] Add vector shift instructions
Add VSLL/VSLD/VSRL/VSLA/VSLAX/VSRA/VSRAX/VSFA instructionss.  Add
additonal AsmParser for VSLD special operand.  Also add regression
tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90143
2020-10-27 00:30:27 +09:00
Kazushi (Jam) Marukawa 83cb423c6e [VE] Add vector logical instructions
Add VAND/VOR/VXOE/VEQV/VLDZ/VPCNT/VBRV/VSEQ instrucitons and regression
tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90141
2020-10-27 00:29:33 +09:00
Kazushi (Jam) Marukawa cfefef50c1 [VE] Support atomic store
Support atomic store instructions and add a regression test.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90137
2020-10-27 00:28:11 +09:00
Kazushi (Jam) Marukawa 8aa60f67dc [VE] Add vector comparison and min/max
Add VCMP/VCPS/VCPX/VCMS/VCMX vector instructions.  Also add regression
tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89643
2020-10-26 18:32:04 +09:00
Kazushi (Jam) Marukawa 0acf700243 [VE] Add integer arithmetic vector instructions
Add VADD/VADS/VADX/VSUB/VSBS/VSBX/VMPY/VMPS/VMPX/VMPD/VDIV/VDVS/VDVX
instructions.  Also add regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89642
2020-10-26 18:30:11 +09:00
Kazushi (Jam) Marukawa f32992ad24 [VE] Support atomic load
Support atomic load instruction and add a regression test.
VE uses release consitency, so need to insert fence around
atomic instructions.  This patch enable AtomicExpandPass
and use emitLeadingFence and emitTrailingFence mechanism
for such purpose.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90135
2020-10-26 18:02:45 +09:00
Kazushi (Jam) Marukawa 52f03fe115 [VE] Support atomic fence
Support atomic fence instruction and add a regression test.
Add MEMBARRIER pseudo insturction also to use it as a barrier
against to the compiler optimizations.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D90112
2020-10-26 17:03:09 +09:00
Sergei Trofimovich 1eb812e06d [VE] Fix initializer visibility
Before the change attempt to link libLTO.so against shared
LLVM library failed as:

```
[ 76%] Linking CXX shared library ../../lib/libLTO.so
... /usr/bin/cmake -E cmake_link_script CMakeFiles/LTO.dir/link.txt --verbose=1
c++ -o ...libLTO.so.12git ...ibLLVM-12git.so
ld: CMakeFiles/LTO.dir/lto.cpp.o: in function `llvm::InitializeAllTargetInfos()':
include/llvm/Config/Targets.def:31: undefined reference to `LLVMInitializeVETargetInfo'
```

It happens because on linux llvm build system sets default
symbol visibility to "hidden". The fix is to set visibility
back to "default" for exported APIs with LLVM_EXTERNAL_VISIBILITY.

Bug: https://bugs.llvm.org/show_bug.cgi?id=47847

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89633
2020-10-19 22:54:41 +01:00
Kazushi (Jam) Marukawa 6bb60d3e26 [VE] Add setcc for fp128
Add setcc for fp128 and clean existing ISel patterns.  Also add
a regression test.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89683
2020-10-19 21:36:57 +09:00
Kazushi (Jam) Marukawa fb2bb6fad4 [VE] Add cast to/from fp128 patterns
Add cast to/from fp128 patterns.  Clean other cast patterns too.
Update a regression test by adding missing tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89682
2020-10-19 21:35:27 +09:00
Kazushi (Jam) Marukawa 8796746b2a [VE] Support select_cc
Add missing ISel patterns related to select_cc DAG nodes.
Add regression test of all combination of possible scalar types.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89672
2020-10-19 18:54:25 +09:00
Kazushi (Jam) Marukawa f2fd42098c [VE] Add VBRD/VMV instructions
Add VBRD/VMV vector instructions.  In order to do that, also support
VM512 registers and RV instruction format in MC layer.  Also add
regression tests for new instructions.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89641
2020-10-19 18:33:54 +09:00
Kazushi (Jam) Marukawa 7a09aec804 [VE] Add LSV/LVS/LVM/SVM instructions
Add LSV/LVS/LVM/SVM vector instructions and regression tests.
Also update AsmParser to support new format of operands.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89499
2020-10-19 18:32:48 +09:00
Kazushi (Jam) Marukawa 25955cbae4 [VE] Support br_cc comparing fp128
Support br_cc instruction comparing fp128 values.  Add a br_cc.ll
regression test for all kind of br_cc instructions.  And, clean
existing branch regression tests, this time.  Clean a brcond.ll
regression test for brcond instruction.  Remove mixed branch1.ll
regression test.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89627
2020-10-19 18:29:39 +09:00
Kazushi (Jam) Marukawa af8b444de3 [VE] Update ISel patterns for select instruction
Add an ISel pattern for fp128 select instruction and optimize generated
code for other types' select. instructions.  Add a regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89509
2020-10-19 18:28:21 +09:00
Kazushi (Jam) Marukawa a91dd3d37d [VE] Add VGT/VSC/PFCHV instructions
Add VGT/VSC/PFCHV vector instructions and regression tests.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89471
2020-10-16 06:28:22 +09:00
Kazushi (Jam) Marukawa 410e5b17cf [VE] Support fabs/fcos/fsin/fsqrt math functions
VE doesn't have instruction for fabs/fcos/fsin/fsqrt, so expand them.
Add regression tests also.  Update fcopysign regression test, also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89457
2020-10-16 06:27:38 +09:00
Kazushi (Jam) Marukawa 94c18d91d2 [VE] Add vector load/store instructions
Add vector registers and vector load/store instructions.  Add
regression tests for vector load/store instructions too.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89183
2020-10-15 09:26:55 +09:00
Kazushi (Jam) Marukawa 8e7b108e80 [VE] Change to expand SHL_PARTS/SRA_PARTS/SRL_PARTS
VE doesn't have SHL_PARTS/SRA_PARTS/SRL_PARTS instructions, so need
to expand them.  Add regression tests too.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89396
2020-10-15 09:04:34 +09:00
Kazushi (Jam) Marukawa 66be2e00ef [VE] Support copysign math function
VE doesn't have instruction for copysign, so expand it.  Add a
regression test also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89228
2020-10-12 21:06:19 +09:00
Kazushi (Jam) Marukawa 9d6d4b07a2 [VE] Support fneg and frem
VE doesn't have fneg or frem instruction, so change them to expand.  Add
regression tests also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89205
2020-10-12 19:19:29 +09:00
Kazushi (Jam) Marukawa 6c32bc4875 [VE] Change to expand BRCOND
VE doesn't have BRCOND instruction, so need to expand it.  Also add
a regression test.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D89173
2020-10-12 19:18:37 +09:00
Kazushi (Jam) Marukawa 86f69689f9 [VE][NFC] Clean VEISelLowering.cpp
Clean the order of setOperationActions and others.

Differential Revision: https://reviews.llvm.org/D89203
2020-10-11 21:47:50 +09:00
Kazushi (Jam) Marukawa 5b5e78a431 [VE] Support register and frame-index pair correctly
Support register and frame-index pair correctly as operands of
generic load/store instrucitons, e.g. LD1BZXrri, STLrri, and etc.
Add regression tests also.

Differential Revision: https://reviews.llvm.org/D88779
2020-10-05 18:36:53 +09:00
Kazushi (Jam) Marukawa 1034262e0a [VE] Support TargetBlockAddress
Change to handle TargetBlockAddress and add a regression test for it.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D88576
2020-10-01 00:48:21 +09:00
Kazushi (Jam) Marukawa 68cb29eff1 [VE] Modify ISelLoweirng following clang-tidy
Modify case style of function names following clang-tidy.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D86076
2020-08-18 07:43:19 +09:00
Kazushi (Jam) Marukawa 40f1e7e804 [VE] Support f128
Support f128 using VE instructions.  Update regression tests.
I've noticed there is no load or store i128 test, so I add them too.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D86035
2020-08-17 17:26:52 +09:00
Fangrui Song 58f5966d5b Fix TargetSubtargetInfo derivatives after D85165 2020-08-14 15:50:53 -07:00
Kazushi (Jam) Marukawa 2f01af764b [VE] Remove obsolete I8/I16 register classes
Remove I8/I16 register classes which are prepared to implement previously
to implement VE ABI.  However, it is possible to implement VE ABI correctly
without them.  Therefore, removing them now.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D85905
2020-08-14 21:52:22 +09:00
Kazushi (Jam) Marukawa 5d549219df [VE] Change to promote i32 AND/OR/XOR operations
VE has only 64 bits AND/OR/XOR instructions.  We pretended that VE has 32 bits
instructions also, but doing it increase the number of generated instructions.
Therefore, we decide to promote 32 bits operations and use only 64 bits
instructions in back end.  We also avoid pretending that VE has 32 bits LEA
instruction.  Update regression tests also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D85726
2020-08-12 16:23:50 +09:00
Kazushi (Jam) Marukawa 59703f1736 [VE] Update bit operations
Change bitreverse/bswap/ctlz/ctpop/cttz regression tests to support i128
and signext/zeroext i32 types.  This patch also change the way to support
i32 types using 64 bits VE instructions.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D85712
2020-08-11 19:42:12 +09:00
Kazushi (Jam) Marukawa 63bc5d7863 [VE] Change to expand multiply related instructions
Change to expand MULHU/MULHS/UMUL_LOHI/SMUL_LOHI for i32 and i64 since
those instructions are not available on Aurora SX VE.  Some of them
are used in expansion of i128 multiply, so need to modify them to
support i128.  Then, update basic arithmetic regression tests of
i128 and signed/unsigned i32 typed integer values.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D85490
2020-08-07 18:22:25 +09:00
Kazushi (Jam) Marukawa f92e0d9384 [VE] Optimize trunc related instructions
Change to not generate truncate instructions if all use of a truncate
operation don't care about higher bits.  For example, an i32 add
instruction doesn't care about higher 32 bits in 64 bit registers.
Updates regression tests also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D85418
2020-08-07 09:21:05 +09:00
Kazushi (Jam) Marukawa 605fd4d77c [VE] Change calling convention to follow ABI
Change to expand all arguments and return values to i64 to follow ABI.
Update regression tests also.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D84581
2020-08-01 10:08:54 +09:00
Kazushi (Jam) Marukawa fa1fecc73d [VE] Support symbol with offset in assembly
Summary:
Change MCExpr to support Aurora VE's modifiers.  Change asmparser to use
existing MCExpr parser (parseExpression) to parse an expression contining
symbols with modifiers and offsets.  Also add several regression tests
of MC layer.

Reviewers: simoll, k-ishizaka

Reviewed By: simoll

Subscribers: hiraditya, llvm-commits

Tags: #llvm, #ve

Differential Revision: https://reviews.llvm.org/D83170
2020-07-07 04:16:51 +09:00
Kazushi (Jam) Marukawa af8389e131 [VE] Change to use isa
Summary: Change to use isa instead of dyn_cast to avoid a warning.

Reviewers: simoll, k-ishizaka

Reviewed By: simoll

Subscribers: hiraditya, llvm-commits

Tags: #llvm, #ve

Differential Revision: https://reviews.llvm.org/D83200
2020-07-07 03:48:49 +09:00
Kazushi (Jam) Marukawa df3bda047d [VE] Correct stack alignment
Summary:
Change stack alignment from 64 bits to 128 bits to follow ABI correctly.
And add a regression test for datalayout.

Reviewers: simoll, k-ishizaka

Reviewed By: simoll

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #llvm, #ve, #clang

Differential Revision: https://reviews.llvm.org/D83173
2020-07-06 17:25:29 +09:00
Kazushi (Jam) Marukawa 1952055892 [VE] Support symbol with offset value
Summary: Support symbol with offset value as a VEMCExpr.

Reviewers: simoll, k-ishizaka

Reviewed By: simoll

Subscribers: hiraditya, llvm-commits

Tags: #llvm, #ve

Differential Revision: https://reviews.llvm.org/D82734
2020-07-01 23:55:27 +09:00
Kazushi (Jam) Marukawa e026f147f7 [VE] Support relocation information in MC layer
Summary:
Change VEAsmParser to support identification with relocation information
in assmebler.  Change VEAsmBackend to support relocation information in
MC layer.  Change VEDisassembler and VEMCCodeEmitter to support binary
generation of branch target operands.  Add REFLONG fixup and variant kind
to support new R_VE_REFLONG ELF symbol.  And, add regression test in both
MC and CodeGen to check binary genaration with relocation information.

Differential Revision: https://reviews.llvm.org/D81553
2020-06-15 11:24:53 +02:00
Kazushi (Jam) Marukawa 34fef0c980 [VE] Support convert instructions in MC layer
Summary:
Add CVTSQ/CVTDQ/CVTQD/CVTQS instructions.  Add regression tests for
them and other convert instructions of asmparser, mccodeemitter, and
disassembler.  In order to add those instructions, support RD operands
in asmparser, mccodeemitter, and disassembler.

Differential Revision: https://reviews.llvm.org/D81536
2020-06-10 12:22:33 +02:00
Kazushi (Jam) Marukawa 49e4faa010 [VE] Support host memory access instructions in MC layer
Summary:
Add LHM/SHM instructions.  Add regression tests for them of asmparser,
mccodeemitter, and disassembler.  In order to add those instructions,
add new decode functions to disassembler, and add new print functions
to instprinter.

Differential Revision: https://reviews.llvm.org/D81535
2020-06-10 10:02:14 +02:00
Kazushi (Jam) Marukawa b641c9f729 [VE] Support rest of load/store instructions in MC layer
Summary:
Add DLD/DLDU/DLDL/PFCH/TS1AM/TS2AM/TS3AM/ATMAM/CAS instructions newly.
Add regression tests for them to asmparser, mccodeemitter, and disassembler.
In order to add those instructions, change asmparser to support UImm0to2 and
UImm1 operands, add new decode functions to disassembler, and add new print
functions to instprinter.

Differential Revision: https://reviews.llvm.org/D81454
2020-06-09 14:21:00 +02:00
Kazushi (Jam) Marukawa e9eafb7be9 [VE] Support Transfer Control Instructions in MC layer
Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
transfer control instructions.  Add FENCEI/FENCEM/FENCEC/SVOB instructions
also.  Add new instruction format to represent FENCE* instructions too.

Differential Revision: https://reviews.llvm.org/D81440
2020-06-09 10:41:42 +02:00
Kazushi (Jam) Marukawa 0d989cb6ab [VE] Support lowering to NND instruction
Summary:
Support NND instruction of Aurora VE.  Add hasAndNot function also
for optimization.

Differential Revision: https://reviews.llvm.org/D81383
2020-06-09 10:18:14 +02:00
Kazushi (Jam) Marukawa b60404a666 [VE] Support floating-point arithmetic instructions in MC layer
Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
floating-point arithmetic instructions.  Add FADDQ, FSUBQ, FMULQ, and
FCMPQ instructions and F128 register class too.

Differential Revision: https://reviews.llvm.org/D81386
2020-06-08 15:58:57 +02:00
Kazushi (Jam) Marukawa c95ba11a3d [VE] Support control instructions in MC layer
Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
control instructions.  Add not defined LPM/SPM/LFR/SFR/SMIR/NOP/LCR/
SCR/TSCR/FIDCR control isntructions newly.  Define MISC registers which
SMIR instruction reads and IC register which SIC instruction reads.
Change asmparser to support Zero, UImm3, and UImm6 operands and MISC
registers.  Change instprinter to support MISC registers also.
Change to use auto to receive dyn_cast also.

Differential Revision: https://reviews.llvm.org/D81370
2020-06-08 11:41:57 +02:00
Kazushi (Jam) Marukawa 385adc4720 [VE] Support shift operation instructions in MC layer
Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
shift operation instructions. Also change asmparser to support UImm7
operand. And, add new SLD/SRD/SLA instructions also.

Differential Revision: https://reviews.llvm.org/D81324
2020-06-08 10:19:14 +02:00
Guillaume Chatelet 1778564f91 [Alignment][NFC] Migrate the rest of backends
Summary: This is a followup on D81196

Reviewers: courbet

Subscribers: arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, kerbowa, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81278
2020-06-08 07:17:20 +00:00
Kazushi (Jam) Marukawa 8948eab28a [VE] Support logical operation instructions in MC layer
Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
logical operation instructions. Also change asmparser to support CMOV
instruction. And, add new EQV/MRG/NND isntructions also.

Differential Revision: https://reviews.llvm.org/D81219
2020-06-05 16:59:05 +02:00
Kazushi (Jam) Marukawa 117c0d7c1c [VE] Support branch instructions in MC layer
Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
branch instructions.  In order to support them, we enhance asmparser
by adding splitting mnemonic mechanism, e.g. "bgt.l.t" into "b", "gt",
and ".l.t", and parsing mechanism for AS style memory addressing.
We also implment encoding and decoding mechanism for branch instructions.

Differential Revision: https://reviews.llvm.org/D81215
2020-06-05 15:44:02 +02:00
Kazushi (Jam) Marukawa 58b810b579 [VE] Support fixed-point operation instructions in MC layer
Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
fixed-point operation instructions.  In order to support them, we add
MImm parser to asmparser.  Also add a new MPD instruction which is one
of multiply instructions.

Differential Revision: https://reviews.llvm.org/D81207
2020-06-05 11:56:26 +02:00