From: Jacob Lifshay Date: Wed, 15 Mar 2023 10:59:23 +0000 (-0700) Subject: fix limit and move comment X-Git-Tag: opf_rfc_ls001_v3~161 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e42230fca8075461a638c81250e1ff5ab9dcf5fa;p=libreriscv.git fix limit and move comment --- diff --git a/openpower/sv/int_fp_mv.mdwn b/openpower/sv/int_fp_mv.mdwn index a1c0981ee..ff64e6654 100644 --- a/openpower/sv/int_fp_mv.mdwn +++ b/openpower/sv/int_fp_mv.mdwn @@ -636,17 +636,18 @@ switch(CVM) result <- si64_CONVERT_FROM_BFP(range_max) default: # JavaScript semantics # CVM = 6, 7 are illegal instructions - limit <- bfp_CONVERT_FROM_UI64(0xFFFF_FFFF_FFFF_FFFF) + + # this works because the largest type we try to + # convert from has 53 significand bits, and the + # largest type we try to convert to has 64 bits, + # and the sum of those is strictly less than the + # 128 bits of the intermediate result. + limit <- bfp_CONVERT_FROM_UI128([1] * 128) if IsInf(rnd) or IsNaN(rnd) then result <- [0] * 64 else if bfp_COMPARE_GT(bfp_ABSOLUTE(rnd), limit) then result <- [0] * 64 else - # this works because the largest type we try to - # convert from has 53 significand bits, and the - # largest type we try to convert to has 64 bits, - # and the sum of those is strictly less than the - # 128 bits of the intermediate result. result128 <- si128_CONVERT_FROM_BFP(rnd) result <- result128[64:127] & js_mask