Skip to content

Commit

Permalink
[ARM,MVE] Add intrinsics for the VQDMLAD family.
Browse files Browse the repository at this point in the history
Summary:
This is another set of instructions too complicated to be sensibly
expressed in IR by anything short of a target-specific intrinsic.
Given input vectors a,b, the instruction generates intermediate values
2*(a[0]*b[0]+a[1]+b[1]), 2*(a[2]*b[2]+a[3]+b[3]), etc; takes the high
half of each double-width values, and overwrites half the lanes in the
output vector c, which you therefore have to provide the input value
of. Optionally you can swap the elements of b so that the are things
like a[0]*b[1]+a[1]*b[0]; optionally you can round to nearest when
taking the high half; and optionally you can take the difference
rather than sum of the two products. Finally, saturation is applied
when converting back to a single-width vector lane.

Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard

Reviewed By: miyuki

Subscribers: kristof.beyls, hiraditya, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76359
  • Loading branch information
statham-arm committed Mar 18, 2020
1 parent 881f5b5 commit e13d153
Show file tree
Hide file tree
Showing 5 changed files with 1,315 additions and 3 deletions.
20 changes: 20 additions & 0 deletions clang/include/clang/Basic/arm_mve.td
Expand Up @@ -243,6 +243,26 @@ let params = T.Signed, pnt = PNT_NType in {
defm vqrdmla: VQDMLA;
}

multiclass VQDMLAD<int exchange, int round, int subtract> {
def "": Intrinsic<Vector, (args Vector:$a, Vector:$b, Vector:$c),
(IRInt<"vqdmlad", [Vector]> $a, $b, $c,
(u32 exchange), (u32 round), (u32 subtract))>;
def _m: Intrinsic<Vector, (args Vector:$a, Vector:$b, Vector:$c,
Predicate:$pred),
(IRInt<"vqdmlad_predicated", [Vector, Predicate]> $a, $b, $c,
(u32 exchange), (u32 round), (u32 subtract), $pred)>;
}
let params = T.Signed in {
defm vqdmladhq: VQDMLAD<0, 0, 0>;
defm vqdmladhxq: VQDMLAD<1, 0, 0>;
defm vqdmlsdhq: VQDMLAD<0, 0, 1>;
defm vqdmlsdhxq: VQDMLAD<1, 0, 1>;
defm vqrdmladhq: VQDMLAD<0, 1, 0>;
defm vqrdmladhxq: VQDMLAD<1, 1, 0>;
defm vqrdmlsdhq: VQDMLAD<0, 1, 1>;
defm vqrdmlsdhxq: VQDMLAD<1, 1, 1>;
}

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 e13d153

Please sign in to comment.