From: Richard Henderson <richard.henderson@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [RFC PATCH] tcg: allow a target to request canonicalization of SUBI to ADDI
Date: Wed, 25 Oct 2023 13:42:18 -0700 [thread overview]
Message-ID: <a03cebdc-5659-4f62-819f-74ee9633e4ed@linaro.org> (raw)
In-Reply-To: <20231025185956.72677-1-pbonzini@redhat.com>
On 10/25/23 11:59, Paolo Bonzini wrote:
> On x86, this is more efficient because it enables generation of
> more LEA instructions.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/tcg/tcg.h | 4 ++++
> tcg/i386/tcg-target.h | 2 ++
> tcg/tcg-op.c | 20 ++++++++++++++++----
> 3 files changed, 22 insertions(+), 4 deletions(-)
>
> diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
> index a9282cdcc60..48e5aeef173 100644
> --- a/include/tcg/tcg.h
> +++ b/include/tcg/tcg.h
> @@ -109,6 +109,10 @@ typedef uint64_t TCGRegSet;
> #define TCG_TARGET_HAS_sub2_i32 1
> #endif
>
> +#ifndef TCG_TARGET_PREFERS_addi
> +#define TCG_TARGET_PREFERS_addi 0
> +#endif
I would rather do this unconditionally.
Many of the tcg backends do this manually, e.g. s390x:
case INDEX_op_sub_i64:
a0 = args[0], a1 = args[1], a2 = args[2];
if (const_args[2]) {
a2 = -a2;
goto do_addi_64;
} else {
tcg_out_insn(s, RRFa, SGRK, a0, a1, a2);
}
break;
While we could do something similar for i386, it would be better to not require such hoops
in each backend.
We would also want to perform this transformation in optimize.c.
r~
prev parent reply other threads:[~2023-10-25 20:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 18:59 [RFC PATCH] tcg: allow a target to request canonicalization of SUBI to ADDI Paolo Bonzini
2023-10-25 20:42 ` Richard Henderson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a03cebdc-5659-4f62-819f-74ee9633e4ed@linaro.org \
--to=richard.henderson@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).