tcg/mips: fix invalid op definition errors
PATCH 1/1 tcg/mips: fix invalid op definition errors
tcg/mips/tcg-target.h defines various operations conditionally depending upon the isa revision, however these operations are included in mips_op_defs[] unconditionally resulting in the following runtime errors if CONFIG_DEBUG_TCG is defined:
Invalid op definition for movcond_i32
Invalid op definition for rotl_i32
Invalid op definition for rotr_i32
Invalid op definition for deposit_i32
Invalid op definition for bswap16_i32
Invalid op definition for bswap32_i32tcg/tcg.c:1196: tcg fatal error
Fix with ifdefs like the i386 backend does for movcond_i32.
--- tcg/mips/tcg-target.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
tcg/mips/tcg-target.c +10 -0
@@ -1617,19 +1617,29 @@ static const TCGTargetOpDef mips_op_defs[] = { { INDEX_op_shl_i32, { "r", "rZ", "ri" } }, { INDEX_op_shr_i32, { "r", "rZ", "ri" } }, { INDEX_op_sar_i32, { "r", "rZ", "ri" } }, +#if TCG_TARGET_HAS_rot_i32 { INDEX_op_rotr_i32, { "r", "rZ", "ri" } }, { INDEX_op_rotl_i32, { "r", "rZ", "ri" } }, +#endif +#if TCG_TARGET_HAS_bswap16_i32 { INDEX_op_bswap16_i32, { "r", "r" } }, +#endif +#if TCG_TARGET_HAS_bswap32_i32 { INDEX_op_bswap32_i32, { "r", "r" } }, +#endif { INDEX_op_ext8s_i32, { "r", "rZ" } }, { INDEX_op_ext16s_i32, { "r", "rZ" } }, +#if TCG_TARGET_HAS_deposit_i32 { INDEX_op_deposit_i32, { "r", "0", "rZ" } }, +#endif { INDEX_op_brcond_i32, { "rZ", "rZ" } }, +#if TCG_TARGET_HAS_movcond_i32 { INDEX_op_movcond_i32, { "r", "rZ", "rZ", "rZ", "0" } }, +#endif { INDEX_op_setcond_i32, { "r", "rZ", "rZ" } }, { INDEX_op_setcond2_i32, { "r", "rZ", "rZ", "rZ", "rZ" } },
Signature · 1 line
1.8.1.2
Quoted 13 lines · James Hogan
tcg/mips/tcg-target.hdefines various operations conditionally depending upon the isa revision, however these operations are included in mips_op_defs[] unconditionally resulting in the following runtime errors ifCONFIG_DEBUG_TCGis defined:Invalid op definition for
movcond_i32
Invalid op definition forrotl_i32
Invalid op definition forrotr_i32
Invalid op definition fordeposit_i32
Invalid op definition forbswap16_i32
Invalid op definition forbswap32_i32tcg/tcg.c:1196: tcg fatal error
Quoted 5 lines
Fix with ifdefs like the i386 backend does for
movcond_i32.Signed-off-by James Hogan <[email protected]>Cc Aurelien Jarno <[email protected]>Cc Richard Henderson <[email protected]>
Perfect for 1.6.
For 1.7 it would be really nice if you could figure out some way to make these runtime tests, instead of ifdefs. I'd have said getauxval(3), but the mips kernel doesn't seem to define any identifying bits. Perhaps that's the first thing that ought to get fixed...
r~
Quoted 14 lines · Richard Henderson
Quoted 13 lines · James Hogan
tcg/mips/tcg-target.hdefines various operations conditionally depending upon the isa revision, however these operations are included in mips_op_defs[] unconditionally resulting in the following runtime errors ifCONFIG_DEBUG_TCGis defined:Invalid op definition for
movcond_i32
Invalid op definition forrotl_i32
Invalid op definition forrotr_i32
Invalid op definition fordeposit_i32
Invalid op definition forbswap16_i32
Invalid op definition forbswap32_i32tcg/tcg.c:1196: tcg fatal error
Quoted 7 lines
Quoted 5 lines
Fix with ifdefs like the i386 backend does for
movcond_i32.Signed-off-by James Hogan <[email protected]>Cc Aurelien Jarno <[email protected]>Cc Richard Henderson <[email protected]>Reviewed-by Richard Henderson <[email protected]>
Thanks,
Quoted 6 lines
Perfect for 1.6.
For 1.7 it would be really nice if you could figure out some way to make these runtime tests, instead of ifdefs. I'd have said getauxval(3), but the mips kernel doesn't seem to define any identifying bits. Perhaps that's the first thing that ought to get fixed...
Yes, the auxvec sounds ideal for this, and AT_HWCAP is already used for cpuid on x86. There were some patches a while ago for exposing the C0 configX registers through sysfs, but auxvec sounds cleaner IMO.
Cheers
James
Aurelien Jarno
AppliedQuoted 46 lines · James Hogan
tcg/mips/tcg-target.hdefines various operations conditionally depending upon the isa revision, however these operations are included in mips_op_defs[] unconditionally resulting in the following runtime errors ifCONFIG_DEBUG_TCGis defined:Invalid op definition for
movcond_i32
Invalid op definition forrotl_i32
Invalid op definition forrotr_i32
Invalid op definition fordeposit_i32
Invalid op definition forbswap16_i32
Invalid op definition forbswap32_i32tcg/tcg.c:1196: tcg fatal errorFix with ifdefs like the i386 backend does for
movcond_i32.Signed-off-by James Hogan <[email protected]>Cc Aurelien Jarno <[email protected]>Cc Richard Henderson <[email protected]>--- tcg/mips/tcg-target.c | 10 ++++++++++ 1 file changed, 10 insertions(+)tcg/mips/tcg-target.c +7
-0@@ -1617,19 +1617,29 @@ static const TCGTargetOpDef mips_op_defs[] = { { INDEX_op_shl_i32, { "r", "rZ", "ri" } }, { INDEX_op_shr_i32, { "r", "rZ", "ri" } }, { INDEX_op_sar_i32, { "r", "rZ", "ri" } }, +#if TCG_TARGET_HAS_rot_i32 { INDEX_op_rotr_i32, { "r", "rZ", "ri" } }, { INDEX_op_rotl_i32, { "r", "rZ", "ri" } }, +#endif +#if TCG_TARGET_HAS_bswap16_i32 { INDEX_op_bswap16_i32, { "r", "r" } }, +#endif +#if TCG_TARGET_HAS_bswap32_i32 { INDEX_op_bswap32_i32, { "r", "r" } }, +#endif { INDEX_op_ext8s_i32, { "r", "rZ" } }, { INDEX_op_ext16s_i32, { "r", "rZ" } }, +#if TCG_TARGET_HAS_deposit_i32
tcg/mips/tcg-target.c static const TCGTargetOpDef mips_op_defs[] = { · line 1645
Quoted 10 lines
tcg/mips/tcg-target.c +3
-0{ INDEX_op_deposit_i32, { "r", "0", "rZ" } }, +#endif { INDEX_op_brcond_i32, { "rZ", "rZ" } }, +#if TCG_TARGET_HAS_movcond_i32 { INDEX_op_movcond_i32, { "r", "rZ", "rZ", "rZ", "0" } }, +#endif { INDEX_op_setcond_i32, { "r", "rZ", "rZ" } }, { INDEX_op_setcond2_i32, { "r", "rZ", "rZ", "rZ", "rZ" } },
Thanks, applied.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net