mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 19:14:58 -06:00
tcg: Increase tcg_out_dupi_vec immediate to int64_t
While we don't store more than tcg_target_long in TCGTemp, we shouldn't be limited to that for code generation. We will be able to use this for INDEX_op_dup2_vec with 2 constants. Also pass along the minimal vece that may be said to apply to the constant. This allows some simplification in the various backends. Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
0a6a8bc8eb
commit
4e18617555
4 changed files with 69 additions and 33 deletions
|
@ -912,31 +912,41 @@ static void tcg_out_movi_int(TCGContext *s, TCGType type, TCGReg ret,
|
|||
}
|
||||
}
|
||||
|
||||
static void tcg_out_dupi_vec(TCGContext *s, TCGType type, TCGReg ret,
|
||||
tcg_target_long val)
|
||||
static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece,
|
||||
TCGReg ret, int64_t val)
|
||||
{
|
||||
uint32_t load_insn;
|
||||
int rel, low;
|
||||
intptr_t add;
|
||||
|
||||
low = (int8_t)val;
|
||||
if (low >= -16 && low < 16) {
|
||||
if (val == (tcg_target_long)dup_const(MO_8, low)) {
|
||||
switch (vece) {
|
||||
case MO_8:
|
||||
low = (int8_t)val;
|
||||
if (low >= -16 && low < 16) {
|
||||
tcg_out32(s, VSPLTISB | VRT(ret) | ((val & 31) << 16));
|
||||
return;
|
||||
}
|
||||
if (val == (tcg_target_long)dup_const(MO_16, low)) {
|
||||
if (have_isa_3_00) {
|
||||
tcg_out32(s, XXSPLTIB | VRT(ret) | ((val & 0xff) << 11));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case MO_16:
|
||||
low = (int16_t)val;
|
||||
if (low >= -16 && low < 16) {
|
||||
tcg_out32(s, VSPLTISH | VRT(ret) | ((val & 31) << 16));
|
||||
return;
|
||||
}
|
||||
if (val == (tcg_target_long)dup_const(MO_32, low)) {
|
||||
break;
|
||||
|
||||
case MO_32:
|
||||
low = (int32_t)val;
|
||||
if (low >= -16 && low < 16) {
|
||||
tcg_out32(s, VSPLTISW | VRT(ret) | ((val & 31) << 16));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (have_isa_3_00 && val == (tcg_target_long)dup_const(MO_8, val)) {
|
||||
tcg_out32(s, XXSPLTIB | VRT(ret) | ((val & 0xff) << 11));
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -956,14 +966,15 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, TCGReg ret,
|
|||
if (TCG_TARGET_REG_BITS == 64) {
|
||||
new_pool_label(s, val, rel, s->code_ptr, add);
|
||||
} else {
|
||||
new_pool_l2(s, rel, s->code_ptr, add, val, val);
|
||||
new_pool_l2(s, rel, s->code_ptr, add, val >> 32, val);
|
||||
}
|
||||
} else {
|
||||
load_insn = LVX | VRT(ret) | RB(TCG_REG_TMP1);
|
||||
if (TCG_TARGET_REG_BITS == 64) {
|
||||
new_pool_l2(s, rel, s->code_ptr, add, val, val);
|
||||
} else {
|
||||
new_pool_l4(s, rel, s->code_ptr, add, val, val, val, val);
|
||||
new_pool_l4(s, rel, s->code_ptr, add,
|
||||
val >> 32, val, val >> 32, val);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue