[GCC][PATCH][AArch64]Add ACLE intrinsics for dot product (usdot - vector, <us/su>dot - by element) for AArch64 AdvSIMD ARMv8.6 Extension

Richard Sandiford richard.sandiford@arm.com
Fri Dec 13 11:03:00 GMT 2019


Stam Markianos-Wright <Stam.Markianos-Wright@arm.com> writes:
> @@ -573,6 +586,44 @@
>    [(set_attr "type" "neon_dot<q>")]
>  )
>  
> +;; These instructions map to the __builtins for the armv8.6a I8MM usdot, sudot
> +;; (by element) Dot Product operations.
> +(define_insn "aarch64_<sur>dot_lane<vsi2qi>"
> +  [(set (match_operand:VS 0 "register_operand" "=w")
> +	(plus:VS (match_operand:VS 1 "register_operand" "0")
> +		(unspec:VS [(match_operand:<VSI2QI> 2 "register_operand" "w")
> +			    (match_operand:V8QI 3 "register_operand" "<h_con>")
> +			    (match_operand:SI 4 "immediate_operand" "i")]
> +		DOTPROD_I8MM)))]
> +  "TARGET_SIMD && TARGET_I8MM"
> +  {
> +    int nunits = GET_MODE_NUNITS (V8QImode).to_constant ();
> +    int lane = INTVAL (operands[4]);
> +    operands[4]
> +    =  gen_int_mode (ENDIAN_LANE_N (nunits / 4, lane), SImode);
> +    return "<sur>dot\\t%0.<Vtype>, %2.<Vdottype>, %3.4b[%4]";
> +  }
> +  [(set_attr "type" "neon_dot<q>")]
> +)
> +
> +(define_insn "aarch64_<sur>dot_laneq<vsi2qi>"
> +  [(set (match_operand:VS 0 "register_operand" "=w")
> +	(plus:VS (match_operand:VS 1 "register_operand" "0")
> +		(unspec:VS [(match_operand:<VSI2QI> 2 "register_operand" "w")
> +			    (match_operand:V16QI 3 "register_operand" "<h_con>")

Using <h_con> seems a bit redundant when it's always "w" in this context,
but either's fine.

> +			    (match_operand:SI 4 "immediate_operand" "i")]
> +		DOTPROD_I8MM)))]
> +  "TARGET_SIMD && TARGET_I8MM"
> +  {
> +    int nunits = GET_MODE_NUNITS (V16QImode).to_constant ();
> +    int lane = INTVAL (operands[4]);
> +    operands[4]
> +    =  gen_int_mode (ENDIAN_LANE_N (nunits / 4, lane), SImode);

Nit: = should be indented two spaces more, and there should be only
one space afterwards.  But the statement fits on one line, so probably
better not to have the line break at all.

> +    return "<sur>dot\\t%0.<Vtype>, %2.<Vdottype>, %3.4b[%4]";
> +  }
> +  [(set_attr "type" "neon_dot<q>")]
> +)

These two patterns can be merged using :VB for operand 3.

LGTM otherwise, thanks.

Richard



More information about the Gcc-patches mailing list