Re: [PATCH v2 03/15] unify simplify_lsr_or() & simplify_and_or_mask()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 20/08/18 19:51, Luc Van Oostenryck wrote:
[snip]

>> So, are you saying that the 'mask' given above is M' (or omask
>> in the code) and M is the function parameter 'mask'. ;-)
>>
>> So src2->value in the above instructions are all 'mask' values
>> rather than (say) the shift count S? Hmm, so, Huh! :-D
> 
> No, sorry.
> In comments & explanations I use uppercase letters for constants:
> 'M' for a constant mask, 'S' for a constant shift, 'N' for a constant
> number of bits and 'C' for others constants. I also sometimes
> use '$mask(N)' for ((1 << N) -1), and (-1 << S) as a shorthand for
> '(-1 << S) truncated to the size of the instruction'.
> Also M is (normaly) reserved for the outer mask, I use M', M'', ...
> for other masks if present.
> Lowercase letters 'a', 'b', 'x', 'y' are for other variables/pseudos.
> 
> For the code here, the variable 'mask' n the code correspond to a
> known/constant mask and is represented as 'M' in the formulae.
> * if OP(_,_) is AND(x, M), obviously M is M is mask.
> * if OP(_,_) is TRUNC(x, N) then mask is ((1 << N) -1),
>   that I also note as '$mask(N)', where N is the new size.
> * if OP(_,_) is LSR(x, S) then mask is (-1 << S) (truncated to
>   the size of the instruction). 
> * if OP(_,_) is SHL(x, S) then mask is (-1 >> S).
> 
> This is done because:
> * TRUNC(x, N) is always equivalent to TRUNC(AND(x, ((1 << N) -1)))
> * LSR(X, S)   is always equivalent to LSR(AND(x, (-1 << S)), S)
> * SHL(X, S)   is always equivalent to SHL(AND(x, (-1 >> S)), S)
> In other words:
> * TRUNC(x, N) simplify the same as AND(x, ((1 << N) - 1))
> * LSR(x, S)   simplify the same as AND(x, (-1 << N))
> * SHL(x, S)   simplify the same as AND(x, (-1 >> N))
> or equivalently:
> * to TRUNC(x, N) correspond an equivalent mask ((1 << N) -1)
> * to LSR(x, S)   correspond an equivalent mask (-1 << S)
> * to SHL(x, S)   correspond an equivalent mask (-1 >> S)
> and so I use the notation 'OP(x, C)' for all these operations
> and sometimes I abuse the notation and directly use 'OP(x, M)'
> where M is the the mask corresponding to OP(x, C).

OK, so just to be sure: the mask parameter to the function
is the 'equivalent mask' or 'outer mask' or the 'mask associated
with the outer operation', or M in the formulas. The M' mask is
given by the 'omask' variable in the code, right?

I suspect that I'm confusing myself because I am trying to see
this as a graph coverage problem, where the 'outer' operation
is a node 'higher-up' the 'tree'. ;-)

So, the notation/formulas are confusing to me (partly because
the M mask used is some function of OP and C: M = F(OP,C) and
that is not stated anywhere). However, you understand them, so
I will just have to squint a little harder! :-P

ATB,
Ramsay Jones



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux