Hi Fred,
Couple of points in favor of the new operator:
1. Semantically the BLEND operation is like a concatenation operation combining 
components from separate sources while the SELECT operation selects one or the 
other source. I realize though that this can be argued against by considering 
blend as a packed or vectorized select.
2. While the SELECT operation places restriction on the result type of its kids 
(kid1/2 must match the result type of select and kid0 must evaluate to a 
boolean expression), the BLEND has no such constraints and interprets its kids 
as 128-bit vectors. 

The patch proposes V16I1V16I1BLEND for pblendvb, but to accommodate all other 
flavors of the blend* operation, the range of rtype/desc will have to be 
extended. In other words, the new operation is intended to represent not one, 
but a set of blend operations.

Thanks.
Pallavi

-----Original Message-----
From: Fred Chow [mailto:frdc...@gmail.com] 
Sent: Wednesday, June 15, 2011 2:56 PM
To: Mathew, Pallavi
Cc: open64-devel@lists.sourceforge.net
Subject: Re: [Open64-devel] Code review request for vectorizer patch [LNO] [CG]

Instead of defining the new operator BLEND, why don't you just extend 
the existing SELECT operator by allowing it to use V16 types?  This is 
what we have been doing when we started to support SIMD types for 
various operations for the x86 target.

Fred

On 06/15/2011 02:18 PM, Mathew, Pallavi wrote:
> Here is the definition:
>
> OPR_BLEND:
> Ternary operator with rtype=V16I1 and desc=V16I1.
> Each kid is interpreted as a 128-bit vector of 16 bytes.
> The result is also a 128-bit vector of bytes computed by
> selecting bytes from either kid0 or kid1 depending upon
> value of the mask in kid2 as shown below:
> if (msb(kid2[n]) == 0)
> then
>     result[n] = kid0[n]
> else
>     result[n] = kid1[n]
>
> where msb(x) represents the most significant bit of x.
> and foo[n] represent the n-th byte of foo.
>
> -Pallavi
>
>
> -----Original Message-----
> From: Fred Chow [mailto:frdc...@gmail.com]
> Sent: Wednesday, June 15, 2011 10:41 AM
> To: Sun Chan
> Cc: Mathew, Pallavi; open64-devel@lists.sourceforge.net
> Subject: Re: [Open64-devel] Code review request for vectorizer patch [LNO] 
> [CG]
>
> Instead of look at source code and guessing at the definition of
> OPR_BLEND, is there some document where we can describe the definition
> of new WHIRL opcodes?
>
> Fred
>
> On 06/14/2011 02:51 PM, Sun Chan wrote:
>> This is a WHIRL change, Fred, can you look at the change (at least the
>> new OPR_BLEND) to see if that is ok?
>> Sun
>>
>> On Tue, Jun 14, 2011 at 1:39 PM, Mathew, Pallavi<pallavi.mat...@amd.com>   
>> wrote:
>>> Hi,
>>>
>>> Can a gatekeeper please review the attached patch which introduces a
>>> framework for vectorization of IF-statements of the form:
>>>
>>>     - if (x != 0) { single_istore_statement } else {empty_body}
>>>
>>>     - if (x != 0) { if (y !=0) {single_istore_statement} else {empty_body}}
>>> else {empty_body}
>>>
>>>
>>>
>>> Sample program:
>>>
>>> long array[2000000];
>>>
>>> void sample() {
>>>
>>>     long i;
>>>
>>>     for(i = 0; i<   2000000; i++) {
>>>
>>>       if (array[i])
>>>
>>>                   array[i] ^= i;
>>>
>>>     }
>>>
>>>     return;
>>>
>>> }
>>>
>>>
>>>
>>> Vectorization of such if-statement is done by first vectorizing its
>>> subexpressions.
>>>
>>> The result of the vectorized if-condition is computed by 'pcmpeqq' (V16I8EQ)
>>> and
>>>
>>> is used to select between the result of executing the statement in the
>>> if-body or
>>>
>>> leaving the array element unchanged. This selection is performed by the
>>>
>>> 'pblendvb' (V16I1V16I1BLEND) operation. Both of these are SSE4.1
>>> instructions.
>>>
>>> We introduce a new whirl operation OPR_BLEND which eventually gets
>>> translated to 'pblendvb'.
>>>
>>> This optimization is turned on by default and can be controlled by
>>> -LNO:simd_vect_if={on/off}.
>>>
>>> This patch also recognizes and handles vectorization of invariants rooted at
>>> OPR_ADD, OPR_SUB and OPR_MPY.
>>>
>>>
>>>
>>> Files updated by this patch:
>>>
>>> osprey/be/lno/simd.cxx
>>>
>>>    - vectorization of if-statements.
>>>
>>>    - vectorization of invariants rooted at OPR_ADD, OPR_SUB and OPR_MPY.
>>>
>>> osprey/common/com/config_lno.h
>>>
>>> osprey/common/com/config_lno.cxx
>>>
>>>    - add flag to control vectorization of if-statements
>>>
>>> osprey/common/com/opcode_gen_core.h
>>>
>>>    - add the OPR_BLEND operation and its opcode.
>>>
>>>    - add opcode for vectorized version of OPR_EQ.
>>>
>>> osprey/common/com/opcode_gen_core.cxx
>>>
>>>    - specify number of kids, desc, rtype, property(expression), etc. for
>>> OPR_BLEND.
>>>
>>> osprey/common/com/wn.cxx
>>>
>>>    - enable WN_has_side_effects for opr_blend
>>>
>>> osprey/be/opt/opt_bdce.cxx
>>>
>>>    - propagate live bits down the expression tree.
>>>
>>> osprey/be/cg/whirl2ops.cxx
>>>
>>>    - expand expression containing OPR_BLEND
>>>
>>>    - add handler for blend.
>>>
>>> osprey/be/cg/cgexp_internals.h
>>>
>>>    - add declaration of Expand_Blend
>>>
>>> osprey/be/cg/x8664/expand.cxx
>>>
>>>    - expand OPC_BLEND to expression containing TNs
>>>
>>> osprey/be/com/x8664/betarget.cxx
>>>
>>>    - convert opcode to TOP... (return top_blend...)
>>>
>>> osprey/common/com/wn_util.h
>>>
>>> osprey/common/com/wn_util.cxx
>>>
>>>    - add utility routine.
>>>
>>>
>>>
>>> Thanks.
>>>
>>> Pallavi
>>>
>>> ------------------------------------------------------------------------------
>>> EditLive Enterprise is the world's most technically advanced content
>>> authoring tool. Experience the power of Track Changes, Inline Image
>>> Editing and ensure content is compliant with Accessibility Checking.
>>> http://p.sf.net/sfu/ephox-dev2dev
>>> _______________________________________________
>>> Open64-devel mailing list
>>> Open64-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/open64-devel
>>>
>>>
>> ------------------------------------------------------------------------------
>> EditLive Enterprise is the world's most technically advanced content
>> authoring tool. Experience the power of Track Changes, Inline Image
>> Editing and ensure content is compliant with Accessibility Checking.
>> http://p.sf.net/sfu/ephox-dev2dev
>> _______________________________________________
>> Open64-devel mailing list
>> Open64-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/open64-devel
>
>


------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel



------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to