mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
tcg: Add field extraction primitives
Adds tcg_gen_extract_* and tcg_gen_sextract_* for extraction of fixed position bitfields, much like we already have for deposit. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
parent
41a0e54756
commit
7ec8bab3de
15 changed files with 426 additions and 2 deletions
|
@ -878,6 +878,19 @@ void tcg_optimize(TCGContext *s)
|
|||
temps[args[2]].mask);
|
||||
break;
|
||||
|
||||
CASE_OP_32_64(extract):
|
||||
mask = extract64(temps[args[1]].mask, args[2], args[3]);
|
||||
if (args[2] == 0) {
|
||||
affected = temps[args[1]].mask & ~mask;
|
||||
}
|
||||
break;
|
||||
CASE_OP_32_64(sextract):
|
||||
mask = sextract64(temps[args[1]].mask, args[2], args[3]);
|
||||
if (args[2] == 0 && (tcg_target_long)mask >= 0) {
|
||||
affected = temps[args[1]].mask & ~mask;
|
||||
}
|
||||
break;
|
||||
|
||||
CASE_OP_32_64(or):
|
||||
CASE_OP_32_64(xor):
|
||||
mask = temps[args[1]].mask | temps[args[2]].mask;
|
||||
|
@ -1048,6 +1061,22 @@ void tcg_optimize(TCGContext *s)
|
|||
}
|
||||
goto do_default;
|
||||
|
||||
CASE_OP_32_64(extract):
|
||||
if (temp_is_const(args[1])) {
|
||||
tmp = extract64(temps[args[1]].val, args[2], args[3]);
|
||||
tcg_opt_gen_movi(s, op, args, args[0], tmp);
|
||||
break;
|
||||
}
|
||||
goto do_default;
|
||||
|
||||
CASE_OP_32_64(sextract):
|
||||
if (temp_is_const(args[1])) {
|
||||
tmp = sextract64(temps[args[1]].val, args[2], args[3]);
|
||||
tcg_opt_gen_movi(s, op, args, args[0], tmp);
|
||||
break;
|
||||
}
|
||||
goto do_default;
|
||||
|
||||
CASE_OP_32_64(setcond):
|
||||
tmp = do_constant_folding_cond(opc, args[1], args[2], args[3]);
|
||||
if (tmp != 2) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue