diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2013-01-01 18:02:23 +0100 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2013-01-31 23:30:16 +0100 |
commit | 0a16c79cc4087838ae5f2bc9554d91db2cbb2503 (patch) | |
tree | c04384a73480354248229b3bb8f3adbe7d547c7a /target-mips | |
parent | 75d012ac7f5c92ac5ee2c1dee8c7a7fbeb724e3c (diff) |
target-mips: use DSP unions for reduction add instructions
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'target-mips')
-rw-r--r-- | target-mips/dsp_helper.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c index bcc3885601..f5de2ca8e5 100644 --- a/target-mips/dsp_helper.c +++ b/target-mips/dsp_helper.c @@ -1352,31 +1352,29 @@ target_ulong helper_modsub(target_ulong rs, target_ulong rt) target_ulong helper_raddu_w_qb(target_ulong rs) { - uint8_t rs3, rs2, rs1, rs0; - uint16_t temp; - - MIPSDSP_SPLIT32_8(rs, rs3, rs2, rs1, rs0); - - temp = (uint16_t)rs3 + (uint16_t)rs2 + (uint16_t)rs1 + (uint16_t)rs0; + target_ulong ret = 0; + DSP32Value ds; + unsigned int i; - return (target_ulong)temp; + ds.uw[0] = rs; + for (i = 0; i < 4; i++) { + ret += ds.ub[i]; + } + return ret; } #if defined(TARGET_MIPS64) target_ulong helper_raddu_l_ob(target_ulong rs) { - int i; - uint16_t rs_t[8]; - uint64_t temp; - - temp = 0; + target_ulong ret = 0; + DSP64Value ds; + unsigned int i; + ds.ul[0] = rs; for (i = 0; i < 8; i++) { - rs_t[i] = (rs >> (8 * i)) & MIPSDSP_Q0; - temp += (uint64_t)rs_t[i]; + ret += ds.ub[i]; } - - return temp; + return ret; } #endif |