diff options
author | Richard Henderson <rth@twiddle.net> | 2011-10-17 17:32:26 -0700 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2011-10-26 13:58:48 -0700 |
commit | f888300b818a46bb1b339d68d6748bc097396a7b (patch) | |
tree | e566afff5ad8ac8509d6c77a850fdda5a164a38e /target-sparc/vis_helper.c | |
parent | 445167723d12d6e14d4f11b4104c48c8b25329db (diff) | |
download | qemu-f888300b818a46bb1b339d68d6748bc097396a7b.zip qemu-f888300b818a46bb1b339d68d6748bc097396a7b.tar.gz qemu-f888300b818a46bb1b339d68d6748bc097396a7b.tar.bz2 |
target-sparc: Implement PDIST.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-sparc/vis_helper.c')
-rw-r--r-- | target-sparc/vis_helper.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/target-sparc/vis_helper.c b/target-sparc/vis_helper.c index 39c8d9a..cd5d4a7 100644 --- a/target-sparc/vis_helper.c +++ b/target-sparc/vis_helper.c @@ -396,3 +396,24 @@ VIS_CMPHELPER(helper_fcmpgt, FCMPGT) VIS_CMPHELPER(helper_fcmpeq, FCMPEQ) VIS_CMPHELPER(helper_fcmple, FCMPLE) VIS_CMPHELPER(helper_fcmpne, FCMPNE) + +uint64_t helper_pdist(uint64_t sum, uint64_t src1, uint64_t src2) +{ + int i; + for (i = 0; i < 8; i++) { + int s1, s2; + + s1 = (src1 >> (56 - (i * 8))) & 0xff; + s2 = (src2 >> (56 - (i * 8))) & 0xff; + + /* Absolute value of difference. */ + s1 -= s2; + if (s1 < 0) { + s1 = -s1; + } + + sum += s1; + } + + return sum; +} |