[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 01/64] tcg: Add field extraction primitives
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v4 01/64] tcg: Add field extraction primitives |
Date: |
Mon, 5 Dec 2016 07:14:26 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 12/05/2016 05:17 AM, Alex Bennée wrote:
>> + /* ??? Ideally we'd know what values are available for immediate AND.
>> + Assume that 8 bits are available, plus the special case of 16,
>> + so that we get ext8u, ext16u. */
>> + switch (len) {
>> + case 1 ... 8: case 16:
>> + tcg_gen_shri_i32(ret, arg, ofs);
>> + tcg_gen_andi_i32(ret, ret, (1u << len) - 1);
>> + break;
>> + default:
>> + tcg_gen_shli_i32(ret, arg, 32 - len - ofs);
>> + tcg_gen_shri_i32(ret, ret, 32 - len);
>> + break;
>> + }
>
> Hmm is this starting to make a case for backend specific optimisation
> passes which have a better idea of the code that can be generated or
> exposing a TCG_TARGET_HAS_8IMM_BITS or some such from the backend to the
> generators?
Thanks for the prod. In theory the information is already available.
tcg_target_const_match((1u << len) - 1, TCG_TYPE_I32,
&tcg_op_defs[INDEX_op_and_i32].args_ct[2]);
That's currently static in tcg.c, but that could be fixed.
There could well be a call for backend-specific passes. I've been thinking of
the problems surrounding constant generation and reverse-endian stores for a
while now, which also sort of fall into this category.
r~