target-alpha: Special case cmpbge with zero
authorRichard Henderson <rth@twiddle.net>
Wed, 5 Aug 2015 18:04:11 +0000 (11:04 -0700)
committerRichard Henderson <rth@twiddle.net>
Tue, 18 Aug 2015 16:11:12 +0000 (09:11 -0700)
Knowing the comparator is zero leads to a simpler operation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
target-alpha/helper.h
target-alpha/int_helper.c
target-alpha/translate.c

index d221f0d7d68122930d2957128a2d38ffc70b3678..83cbe2abda7bf490b065d9238a93f78465e8eb53 100644 (file)
@@ -10,6 +10,7 @@ DEF_HELPER_FLAGS_1(cttz, TCG_CALL_NO_RWG_SE, i64, i64)
 DEF_HELPER_FLAGS_2(zap, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 DEF_HELPER_FLAGS_2(zapnot, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 
+DEF_HELPER_FLAGS_1(cmpbe0, TCG_CALL_NO_RWG_SE, i64, i64)
 DEF_HELPER_FLAGS_2(cmpbge, TCG_CALL_NO_RWG_SE, i64, i64, i64)
 
 DEF_HELPER_FLAGS_2(minub8, TCG_CALL_NO_RWG_SE, i64, i64, i64)
index 4a6e95512bad53fa6802e101d54af86741dd499a..d7f4774127120a0ebe599dcbe714e6d78168d8c0 100644 (file)
@@ -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;
index 81d4ff827cfd9c85e9fb30228ef057ee1f5538b4..b766ae3daa51e3c197f99b3632fb8d4632e30d3d 100644 (file)
@@ -1507,7 +1507,12 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
             break;
         case 0x0F:
             /* CMPBGE */
-            gen_helper_cmpbge(vc, va, vb);
+            if (ra == 31) {
+                /* Special case 0 >= X as X == 0.  */
+                gen_helper_cmpbe0(vc, vb);
+            } else {
+                gen_helper_cmpbge(vc, va, vb);
+            }
             break;
         case 0x12:
             /* S8ADDL */
This page took 0.034468 seconds and 4 git commands to generate.