log2 is needed by a large group of instructions: shifts, rotates, grev, all others that address individual bits in an XLEN-sized word. https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;h=4386dd8bb2d41db227263a947bface79d5acaf0c Example of expected semantics: we need to extract a log2(XLEN)-bit wide uint from the LSB end of RB, and shift by that uint (remember RA and RB are XLEN-bit wide and MSB0 bit numbering is used): 8-bit shift: RA << RB[8-log2(8):8-1] 16-bit shift: RA << RB[16-log2(16):16-1] 32-bit shift: RA << RB[32-log2(32):32-1] 64-bit shift: RA << RB[64-log2(64):64-1] similarly for grev, rotate, etc. if we require log2 to only be used in pseudo-code where its results are always integers (so the inputs are powers of 2), then it should be entirely unambiguous when used. it greatly improves pseudo-code clarity over writing out a log2 definition by hand each place we want to use log2. imho that should be sufficient justification for its inclusion. I don't think a separate RFC is necessary, we would just include log2 in whatever RFC we're writing that uses log2, e.g. we'd just include log2 in the XLEN-ification RFC. Because I think we should just include it in some other RFC, rather than have a whole RFC dedicated to log2, I think trying to rewrite our existing pseudo-code to remove all references to log2 is counterproductive -- we'd just include log2 in whatever RFCs include its uses in our current pseudo-code in openpower-isa.git.
Well, log2 is already used in the OpenPower ISA v3.1 specification, in the dcbz instruction's pseudo-code (ignore messy character set, I'm too lazy to fix it rn): if RA = 0 then b 0 else b (RA) EA b + (RB) n block size (bytes) m log2(n) ea EA0:63-m || m0 MEM(ea, n) n0x00
(In reply to Jacob Lifshay from comment #1) > Well, log2 is already used in the OpenPower ISA v3.1 specification, in the > dcbz instruction's pseudo-code (ignore messy character set, I'm too lazy to ahh, niiice, good find. then that easily justifies using it, in fact it should be raised as a bug with the OPF ISA WG that the function is "not defined" in Section 1.3.4 (and must be added)