Skip to content

Commit

Permalink
[ARM,MVE] Add intrinsics and isel for MVE integer VMLA.
Browse files Browse the repository at this point in the history
Summary:
These instructions compute multiply+add in integers, with one of the
operands being a splat of a scalar. (VMLA and VMLAS differ in whether
the splat operand is a multiplier or the addend.)

I've represented these in IR using existing standard IR operations for
the unpredicated forms. The predicated forms are done with target-
specific intrinsics, as usual.

When operating on n-bit vector lanes, only the bottom n bits of the
i32 scalar operand are used. So we have to tell that to isel lowering,
to allow it to remove a pointless sign- or zero-extension instruction
on that input register. That's done in `PerformIntrinsicCombine`, but
first I had to enable `PerformIntrinsicCombine` for MVE targets
(previously all the intrinsics it handled were for NEON), and make it
a method of `ARMTargetLowering` so that it can get at
`SimplifyDemandedBits`.

Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard

Reviewed By: dmgreen

Subscribers: kristof.beyls, hiraditya, danielkiss, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76122
  • Loading branch information
statham-arm committed Mar 18, 2020
1 parent 8d019cd commit 28c5d97
Show file tree
Hide file tree
Showing 7 changed files with 811 additions and 42 deletions.
18 changes: 18 additions & 0 deletions clang/include/clang/Basic/arm_mve.td
Expand Up @@ -202,6 +202,24 @@ let params = T.Float in {
defm vfms: FMA<0>;
}

let params = T.Int, pnt = PNT_NType in {
def vmlaq_n: Intrinsic<
Vector, (args Vector:$addend, Vector:$m1, unpromoted<Scalar>:$m2_s),
(add (mul $m1, (splat $m2_s)), $addend)>;
def vmlasq_n: Intrinsic<
Vector, (args Vector:$m1, Vector:$m2, unpromoted<Scalar>:$addend_s),
(add (mul $m1, $m2), (splat $addend_s))>;

def vmlaq_m_n: Intrinsic<
Vector, (args Vector:$addend, Vector:$m1, Scalar:$m2_s, Predicate:$pred),
(IRInt<"vmla_n_predicated", [Vector, Predicate]>
$addend, $m1, $m2_s, $pred)>;
def vmlasq_m_n: Intrinsic<
Vector, (args Vector:$m1, Vector:$m2, Scalar:$addend_s, Predicate:$pred),
(IRInt<"vmlas_n_predicated", [Vector, Predicate]>
$m1, $m2, $addend_s, $pred)>;
}

let params = !listconcat(T.Int16, T.Int32) in {
let pnt = PNT_None in {
def vmvnq_n: Intrinsic<Vector, (args imm_simd_vmvn:$imm),
Expand Down

0 comments on commit 28c5d97

Please sign in to comment.