> -----Original Message-----
> From: Richard Henderson <richard.hender...@linaro.org>
> Sent: Sunday, February 26, 2023 10:42 PM
> To: qemu-devel@nongnu.org
> Cc: qemu-...@nongnu.org; qemu-...@nongnu.org; qemu-
> ri...@nongnu.org; qemu-s3...@nongnu.org; jcmvb...@gmail.com;
> kbast...@mail.uni-paderborn.de; ys...@users.sourceforge.jp;
> gaos...@loongson.cn; jiaxun.y...@flygoat.com; Taylor Simpson
> <tsimp...@quicinc.com>; a...@rev.ng; mrol...@gmail.com;
> edgar.igles...@gmail.com
> Subject: [PATCH 19/70] target/hexagon/idef-parser: Use gen_constant for
> gen_extend_tcg_width_op
>
> We already have a temporary, res, which we can use for the intermediate
> shift result. Simplify the constant to -1 instead of 0xf*f.
> This was the last use of gen_tmp_value, so remove it.
>
> Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
> ---
> target/hexagon/idef-parser/parser-helpers.c | 30 +++------------------
> 1 file changed, 3 insertions(+), 27 deletions(-)
>
> diff --git a/target/hexagon/idef-parser/parser-helpers.c
> b/target/hexagon/idef-parser/parser-helpers.c
> index c0e6f2190c..e1a55412c8 100644
> --- a/target/hexagon/idef-parser/parser-helpers.c
> +++ b/target/hexagon/idef-parser/parser-helpers.c
> @@ -1120,15 +1100,11 @@ static
> HexValue gen_extend_tcg_width_op(Context *c,
> OUT(c, locp, "tcg_gen_subfi_i", &dst_width);
> OUT(c, locp, "(", &shift, ", ", &dst_width, ", ", &src_width_m, ");\n");
> if (signedness == UNSIGNED) {
> - const char *mask_str = (dst_width == 32)
> - ? "0xffffffff"
> - : "0xffffffffffffffff";
> - HexValue mask = gen_tmp_value(c, locp, mask_str,
> - dst_width, UNSIGNED);
> + HexValue mask = gen_constant(c, locp, "-1", dst_width,
> + UNSIGNED);
> OUT(c, locp, "tcg_gen_shr_i", &dst_width, "(",
> - &mask, ", ", &mask, ", ", &shift, ");\n");
> + &res, ", ", &mask, ", ", &shift, ");\n");
> OUT(c, locp, "tcg_gen_and_i", &dst_width, "(",
> - &res, ", ", value, ", ", &mask, ");\n");
> + &res, ", ", &res, ", ", value, ");\n");
What's the advantage of putting the result of the tcg_gen_shr into res instead
of mask? Is there something in TCG code generation that takes advantage?
> } else {
> OUT(c, locp, "tcg_gen_shl_i", &dst_width, "(",
> &res, ", ", value, ", ", &shift, ");\n");