Hi,
And a few more comments:
> +/* If X is a positive CONST_DOUBLE with a value that is the reciprocal of a
> + power of 2 (i.e 1/2^n) return the number of float bits. e.g. for
> x==(1/2^n)
> + return n. Otherwise return -1. */
> +int
> +aarch64_fpconst_pow2_recip (rtx x)
> +{
> + REAL_VALUE_TYPE r0;
> +
> + if (!CONST_DOUBLE_P (x))
> + return -1;
> CONST_DOUBLE can be used for things other than floating point. You
> should really check that the mode on the double in is in class MODE_FLOAT.
Several other functions (eg aarch64_fpconst_pow_of_2) do the same since
this function is only called with HF/SF/DF mode. We could add an assert for
SCALAR_FLOAT_MODE_P (but then aarch64_fpconst_pow_of_2 should do
the same).
> +
> + r0 = *CONST_DOUBLE_REAL_VALUE (x);
> + if (exact_real_inverse (DFmode, &r0)
> + && !REAL_VALUE_NEGATIVE (r0))
> + {
> + int ret = exact_log2 (real_to_integer (&r0));
> + if (ret >= 1 && ret <= 31)
> + {
> + return ret;
> + }
Redundant braces
> + else
> + {
> + return -1;
> + }
The else is redundant because...
> + }
> + return -1;
... of this.
> +}
> +
> /* If X is a vector of equal CONST_DOUBLE values and that value is
> Y, return the aarch64_fpconst_pow_of_2 of Y. Otherwise return -1. */
>
> diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
> index 526c7fb0dab..d9812aa238e 100644
> --- a/gcc/config/aarch64/aarch64.md
> +++ b/gcc/config/aarch64/aarch64.md
> @@ -6016,6 +6016,44 @@
> [(set_attr "type" "f_cvtf2i")]
> )
>
> +;; equal width integer to fp combine
> +(define_insn "*aarch64_<su_optab>cvtf_<fcvt_target>_<GPF:mode>2_mult"
> + [(set (match_operand:GPF 0 "register_operand" "=w,w")
> + (mult:GPF (FLOATUORS:GPF
> + (match_operand:<FCVT_TARGET> 1 "register_operand" "w,?r"))
> + (match_operand 2 "aarch64_fp_pow2_recip""Dt,Dt")))]
> Missing mode on operand 2. Missing white space between constraint and
> predicate.
Yes, operand 2 should use GPF as well (odd this doesn't give a warning at
least).
Also the indentation is off - the multiply operands should be indented to the
same level - match operand 1 should be indented more to the right.
Wilco