aboutsummaryrefslogtreecommitdiff
path: root/target-alpha/int_helper.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2015-08-05 11:04:11 -0700
committerRichard Henderson <rth@twiddle.net>2015-08-18 09:11:12 -0700
commit112e4518f0d38fc3c52e55c7d7e77b66a295ec2b (patch)
treefc55cbf2eebfa7d52d0702222ee0cbac570f3af1 /target-alpha/int_helper.c
parent5f2a80adc6fd2b2e4e0579a6613a9913e3cc9a05 (diff)
target-alpha: Special case cmpbge with zero
Knowing the comparator is zero leads to a simpler operation. Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-alpha/int_helper.c')
-rw-r--r--target-alpha/int_helper.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/target-alpha/int_helper.c b/target-alpha/int_helper.c
index 4a6e95512b..d7f4774127 100644
--- a/target-alpha/int_helper.c
+++ b/target-alpha/int_helper.c
@@ -58,6 +58,20 @@ uint64_t helper_zap(uint64_t val, uint64_t mask)
return helper_zapnot(val, ~mask);
}
+uint64_t helper_cmpbe0(uint64_t a)
+{
+ uint64_t m = 0x7f7f7f7f7f7f7f7fULL;
+ uint64_t c = ~(((a & m) + m) | a | m);
+ /* a.......b.......c.......d.......e.......f.......g.......h....... */
+ c |= c << 7;
+ /* ab......bc......cd......de......ef......fg......gh......h....... */
+ c |= c << 14;
+ /* abcd....bcde....cdef....defg....efgh....fgh.....gh......h....... */
+ c |= c << 28;
+ /* abcdefghbcdefgh.cdefgh..defgh...efgh....fgh.....gh......h....... */
+ return c >> 56;
+}
+
uint64_t helper_cmpbge(uint64_t a, uint64_t b)
{
uint64_t mask = 0x00ff00ff00ff00ffULL;