summaryrefslogtreecommitdiff
path: root/ops_template.h
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-03-05 22:24:48 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-03-05 22:24:48 +0000
commit77f8dd5add8f02253dcea1454c9d2c76d7c788a7 (patch)
treefbe97a8744410aa6c8857f882b6497ba341943bd /ops_template.h
parentc5e9815da4e67d42d2a0f8dce4282e8e6d691b88 (diff)
downloadqemu-77f8dd5add8f02253dcea1454c9d2c76d7c788a7.tar.gz
float fixes - added bsr/bsf support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@23 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'ops_template.h')
-rw-r--r--ops_template.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/ops_template.h b/ops_template.h
index ce92db097b..745c27d7e5 100644
--- a/ops_template.h
+++ b/ops_template.h
@@ -633,6 +633,42 @@ void OPPROTO glue(glue(op_btc, SUFFIX), _T0_T1_cc)(void)
T0 ^= (1 << count);
}
+void OPPROTO glue(glue(op_bsf, SUFFIX), _T0_cc)(void)
+{
+ int res, count;
+ res = T0 & DATA_MASK;
+ if (res != 0) {
+ count = 0;
+ while ((res & 1) == 0) {
+ count++;
+ res >>= 1;
+ }
+ T0 = count;
+ CC_DST = 1; /* ZF = 1 */
+ } else {
+ CC_DST = 0; /* ZF = 1 */
+ }
+ FORCE_RET();
+}
+
+void OPPROTO glue(glue(op_bsr, SUFFIX), _T0_cc)(void)
+{
+ int res, count;
+ res = T0 & DATA_MASK;
+ if (res != 0) {
+ count = DATA_BITS - 1;
+ while ((res & SIGN_MASK) == 0) {
+ count--;
+ res <<= 1;
+ }
+ T0 = count;
+ CC_DST = 1; /* ZF = 1 */
+ } else {
+ CC_DST = 0; /* ZF = 1 */
+ }
+ FORCE_RET();
+}
+
#endif
/* string operations */