llvm-6502/lib/Target/Mips/MSA.txt
Daniel Sanders c385709d83 [mips][msa] Added support for matching bmnz, bmnzi, bmz, and bmzi from normal IR (i.e. not intrinsics)
Also corrected the definition of the intrinsics for these instructions (the
result register is also the first operand), and added intrinsics for bsel and
bseli to clang (they already existed in the backend).

These four operations are mostly equivalent to bsel, and bseli (the difference
is which operand is tied to the result). As a result some of the tests changed
as described below.

bitwise.ll:
- bsel.v test adapted so that the mask is unknown at compile-time. This stops
  it emitting bmnzi.b instead of the intended bsel.v.
- The bseli.b test now tests the right thing. Namely the case when one of the
  values is an uimm8, rather than when the condition is a uimm8 (which is
  covered by bmnzi.b)

compare.ll:
- bsel.v tests now (correctly) emits bmnz.v instead of bsel.v because this
  is the same operation (see MSA.txt).

i8.ll
- CHECK-DAG-ized test.
- bmzi.b test now (correctly) emits equivalent bmnzi.b with swapped operands
  because this is the same operation (see MSA.txt).
- bseli.b still emits bseli.b though because the immediate makes it
  distinguishable from bmnzi.b.

vec.ll:
- CHECK-DAG-ized test.
- bmz.v tests now (correctly) emits bmnz.v with swapped operands (see
  MSA.txt).
- bsel.v tests now (correctly) emits bmnz.v with swapped operands (see
  MSA.txt).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193693 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-30 15:20:38 +00:00

74 lines
3.0 KiB
Plaintext

Code Generation Notes for MSA
=============================
Intrinsics are lowered to SelectionDAG nodes where possible in order to enable
optimisation, reduce the size of the ISel matcher, and reduce repetition in
the implementation. In a small number of cases, this can cause different
(semantically equivalent) instructions to be used in place of the requested
instruction, even when no optimisation has taken place.
Instructions
============
This section describes any quirks of instruction selection for MSA. For
example, two instructions might be equally valid for some given IR and one is
chosen in preference to the other.
vshf.w:
It is not possible to emit vshf.w when the shuffle description is
constant since shf.w covers exactly the same cases. shf.w is used
instead. It is also impossible for the shuffle description to be
unknown at compile-time due to the definition of shufflevector in
LLVM IR.
vshf.[bhwd]
When the shuffle description describes a splat operation, splat.[bhwd]
instructions will be selected instead of vshf.[bhwd]. Unlike the ilv*,
and pck* instructions, this is matched from MipsISD::VSHF instead of
a special-case MipsISD node.
ilvl.d, pckev.d:
It is not possible to emit ilvl.d, or pckev.d since ilvev.d covers the
same shuffle. ilvev.d will be emitted instead.
ilvr.d, ilvod.d, pckod.d:
It is not possible to emit ilvr.d, or pckod.d since ilvod.d covers the
same shuffle. ilvod.d will be emitted instead.
splat.[bhwd]
The intrinsic will work as expected. However, unlike other intrinsics
it lowers directly to MipsISD::VSHF instead of using common IR.
splati.w:
It is not possible to emit splati.w since shf.w covers the same cases.
shf.w will be emitted instead.
copy_s.w:
On MIPS32, the copy_u.d intrinsic will emit this instruction instead of
copy_u.w. This is semantically equivalent since the general-purpose
register file is 32-bits wide.
binsri.[bhwd], binsli.[bhwd]:
These two operations are equivalent to each other with the operands
swapped and condition inverted. The compiler may use either one as
appropriate.
Furthermore, the compiler may use bsel.[bhwd] for some masks that do
not survive the legalization process (this is a bug and will be fixed).
bmnz.v, bmz.v, bsel.v:
These three operations differ only in the operand that is tied to the
result.
It is (currently) not possible to emit bmz.v, or bsel.v since bmnz.v is
the same operation and will be emitted instead.
In future, the compiler may choose between these three instructions
according to register allocation.
bmnzi.b, bmzi.b:
Like their non-immediate counterparts, bmnzi.v and bmzi.v are the same
operation with the operands swapped. bmnzi.v will (currently) be emitted
for both cases.
bseli.v:
Unlike the non-immediate versions, bseli.v is distinguishable from
bmnzi.b and bmzi.b and can be emitted.