Skip to contentSkip to conversation

What is this mean of the comment?

DISCUSSION tugouxp 2 participants 2 messages Jul 20, 2020

lore
Share & tools
lore

tugouxp

author
#0 lore raw

Hi folks:

in flollowing comment of tcg.h, it says every helper max need 6 input argument and 1 output argument,
but why here both multiply by 2 in here?

what is the 14 mean?

thank you!

520 /* While we limit helpers to 6 arguments, for 32-bit hosts, with padding,

521 this imples a max of 6*2 (64-bit in) + 2 (64-bit out) = 14 operands.

522 There are never more than 2 outputs, which means that we can store all

523 dead + sync data within 16 bits. */

524 #define DEAD_ARG 4

#1 lore raw
Quoted 3 lines · tugouxp

in flollowing comment of tcg.h, it says every helper max need 6
input argument and 1 output argument,
but why here both multiply by 2 in here?

Because arguments might be 64 bits, and on a 32-bit host a 64-bit argument has to be passed as 2 separate operands.

Quoted 1 line

what is the 14 mean?

It's the maximum possible number of operands in the worst case: six 64-bit input arguments which need to be passed as 2 32-bit operands each, and a 64-bit return value which also needs to be passed as 2 32-bit operands. (6 * 2) + 2 == 14.
The reason we care is described in the next part of the comment: we keep one bit of information (liveness) about the operands of each TCGop, and because 14 < 16 we can fit this information into a single 16-bit integer per TCG op.

Quoted 4 lines

520 /* While we limit helpers to 6 arguments, for 32-bit hosts, with padding,

 521    this imples a max of 6*2 (64-bit in) + 2 (64-bit out) = 14 operands.
 522    There are never more than 2 outputs, which means that we can store all
 523    dead + sync data within 16 bits.  */

thanks
-- PMM