cakeml icon indicating copy to clipboard operation
cakeml copied to clipboard

Add instructions for efficient Div and Mul by (powers of) 2

Open xrchz opened this issue 8 years ago • 6 comments

In data_to_word (i.e., the closLang ops).

xrchz avatar Mar 13 '17 10:03 xrchz

@myreen Can't this be done by recognising when the existing ops (Mult and Div) are applied to a constant?

xrchz avatar Oct 17 '17 22:10 xrchz

@xrchz it's can be done like that because each dataLang assignment is of the form:

Assign var_name op_name var_names space

i.e. Op is not nested. See the dataLang definition for details.

myreen avatar Oct 27 '17 06:10 myreen

The first step here would be to add variable length shifts to asm and all the targets.

tanyongkiam avatar Nov 12 '24 13:11 tanyongkiam

@ncough are you still working on this?

xrchz avatar Nov 12 '24 13:11 xrchz

The closLang op should be extended with Div / Mul by a constant power of 2. (Or just an int shift directly and have the power reduction done in compilation to/within clos)

tanyongkiam avatar Nov 12 '24 13:11 tanyongkiam

@myreen comments that my comment about the "first step" is wrong because if it is a fixed power of 2, one knows exactly how much to shift by (the exponent)

tanyongkiam avatar Aug 07 '25 01:08 tanyongkiam