Hi All,
I have packed 16 bit data for C64xx. What I want to do
is shift the data left by some normalization
factor and check for saturation and if so, update the
values with the max values. Is there some optimum way
of doing this?? C64 has a SSHL(shift left by desired
amount,check for saturation and update the value)
instruction that operates on 32 bit data but not
packed 16 bit data. Any pointers how I should go ahead
for packed 16 bit data..maybe some instruction that I
may have missed?
Shift left and check for saturation
Started by ●February 12, 2007
Reply by ●February 14, 20072007-02-14
To clarify a bit, Wht I am doing is getting the 16 bit
packed data in seperate registers, left shifting it by
16 bits, then using SSHL on those registers and then
packing back the MSB values of the two seperate regs
into a single register and then storing these in the
desired memory location..Is there a better alternative
approach here? .The main operation desired is to shift
an operand with the desired amount and check for
saturation..if it saturates...then update the value
with the max val like 0x7fff for a positive saturation
Regards,
Wilbur
--- wilbur wrote:
> Hi All,
>
> I have packed 16 bit data for C64xx. What I want to
> do
> is shift the data left by some normalization
> factor and check for saturation and if so, update
> the
> values with the max values. Is there some optimum
> way
> of doing this?? C64 has a SSHL(shift left by desired
> amount,check for saturation and update the value)
> instruction that operates on 32 bit data but not
> packed 16 bit data. Any pointers how I should go
> ahead
> for packed 16 bit data..maybe some instruction that
> I
> may have missed?
packed data in seperate registers, left shifting it by
16 bits, then using SSHL on those registers and then
packing back the MSB values of the two seperate regs
into a single register and then storing these in the
desired memory location..Is there a better alternative
approach here? .The main operation desired is to shift
an operand with the desired amount and check for
saturation..if it saturates...then update the value
with the max val like 0x7fff for a positive saturation
Regards,
Wilbur
--- wilbur wrote:
> Hi All,
>
> I have packed 16 bit data for C64xx. What I want to
> do
> is shift the data left by some normalization
> factor and check for saturation and if so, update
> the
> values with the max values. Is there some optimum
> way
> of doing this?? C64 has a SSHL(shift left by desired
> amount,check for saturation and update the value)
> instruction that operates on 32 bit data but not
> packed 16 bit data. Any pointers how I should go
> ahead
> for packed 16 bit data..maybe some instruction that
> I
> may have missed?
Reply by ●February 15, 20072007-02-15
Hi Wilbur,
Your approach seem to be quite justified, as C64/C64+
does not have a left shift with saturation instruction
that works on a pair of 16 bit packed data.
Rgds,
Andrew
> Re: Shift left and check for saturation
> Posted by: "wilbur" w...@yahoo.com wilbur_999
> Date: Wed Feb 14, 2007 6:41 am ((PST))
>
> To clarify a bit, Wht I am doing is getting the 16 bit
> packed data in seperate registers, left shifting it by
> 16 bits, then using SSHL on those registers and then
> packing back the MSB values of the two seperate regs
> into a single register and then storing these in the
> desired memory location..Is there a better alternative
> approach here? .The main operation desired is to shift
> an operand with the desired amount and check for
> saturation..if it saturates...then update the value
> with the max val like 0x7fff for a positive saturation
>
> Regards,
> Wilbur
> --- wilbur wrote:
>
>> Hi All,
>>
>> I have packed 16 bit data for C64xx. What I want to
>> do
>> is shift the data left by some normalization
>> factor and check for saturation and if so, update
>> the
>> values with the max values. Is there some optimum
>> way
>> of doing this?? C64 has a SSHL(shift left by desired
>> amount,check for saturation and update the value)
>> instruction that operates on 32 bit data but not
>> packed 16 bit data. Any pointers how I should go
>> ahead
>> for packed 16 bit data..maybe some instruction that
>> I
>> may have missed?
>>
Your approach seem to be quite justified, as C64/C64+
does not have a left shift with saturation instruction
that works on a pair of 16 bit packed data.
Rgds,
Andrew
> Re: Shift left and check for saturation
> Posted by: "wilbur" w...@yahoo.com wilbur_999
> Date: Wed Feb 14, 2007 6:41 am ((PST))
>
> To clarify a bit, Wht I am doing is getting the 16 bit
> packed data in seperate registers, left shifting it by
> 16 bits, then using SSHL on those registers and then
> packing back the MSB values of the two seperate regs
> into a single register and then storing these in the
> desired memory location..Is there a better alternative
> approach here? .The main operation desired is to shift
> an operand with the desired amount and check for
> saturation..if it saturates...then update the value
> with the max val like 0x7fff for a positive saturation
>
> Regards,
> Wilbur
> --- wilbur wrote:
>
>> Hi All,
>>
>> I have packed 16 bit data for C64xx. What I want to
>> do
>> is shift the data left by some normalization
>> factor and check for saturation and if so, update
>> the
>> values with the max values. Is there some optimum
>> way
>> of doing this?? C64 has a SSHL(shift left by desired
>> amount,check for saturation and update the value)
>> instruction that operates on 32 bit data but not
>> packed 16 bit data. Any pointers how I should go
>> ahead
>> for packed 16 bit data..maybe some instruction that
>> I
>> may have missed?
>>
Reply by ●February 15, 20072007-02-15
Wilbur-
> To clarify a bit, Wht I am doing is getting the 16 bit
> packed data in seperate registers, left shifting it by
> 16 bits, then using SSHL on those registers and then
> packing back the MSB values of the two seperate regs
> into a single register and then storing these in the
> desired memory location..Is there a better alternative
> approach here? .The main operation desired is to shift
> an operand with the desired amount and check for
> saturation..if it saturates...then update the value
> with the max val like 0x7fff for a positive saturation
Here is a TI doc that includes a list of intrinsics for C64x:
http://focus.ti.com/lit/ug/spru198i/spru198i.pdf
Suggest to look at "SADDxx" intrinsics in Table 2-7 (specifically for 64x) and then
figure out what underlying ASM instructions are being used. TI goes to great lengths
to make sure the intrinsics are as fast and optimized as possible.
-Jeff
> --- wilbur wrote:
>
> > Hi All,
> >
> > I have packed 16 bit data for C64xx. What I want to
> > do
> > is shift the data left by some normalization
> > factor and check for saturation and if so, update
> > the
> > values with the max values. Is there some optimum
> > way
> > of doing this?? C64 has a SSHL(shift left by desired
> > amount,check for saturation and update the value)
> > instruction that operates on 32 bit data but not
> > packed 16 bit data. Any pointers how I should go
> > ahead
> > for packed 16 bit data..maybe some instruction that
> > I
> > may have missed?
> To clarify a bit, Wht I am doing is getting the 16 bit
> packed data in seperate registers, left shifting it by
> 16 bits, then using SSHL on those registers and then
> packing back the MSB values of the two seperate regs
> into a single register and then storing these in the
> desired memory location..Is there a better alternative
> approach here? .The main operation desired is to shift
> an operand with the desired amount and check for
> saturation..if it saturates...then update the value
> with the max val like 0x7fff for a positive saturation
Here is a TI doc that includes a list of intrinsics for C64x:
http://focus.ti.com/lit/ug/spru198i/spru198i.pdf
Suggest to look at "SADDxx" intrinsics in Table 2-7 (specifically for 64x) and then
figure out what underlying ASM instructions are being used. TI goes to great lengths
to make sure the intrinsics are as fast and optimized as possible.
-Jeff
> --- wilbur wrote:
>
> > Hi All,
> >
> > I have packed 16 bit data for C64xx. What I want to
> > do
> > is shift the data left by some normalization
> > factor and check for saturation and if so, update
> > the
> > values with the max values. Is there some optimum
> > way
> > of doing this?? C64 has a SSHL(shift left by desired
> > amount,check for saturation and update the value)
> > instruction that operates on 32 bit data but not
> > packed 16 bit data. Any pointers how I should go
> > ahead
> > for packed 16 bit data..maybe some instruction that
> > I
> > may have missed?
Reply by ●February 15, 20072007-02-15
Wilbur,
Can you send a snippet of C or linear aseembly to make everything 100%
clear ?
- Andrew E.
wilbur wrote:
>To clarify a bit, Wht I am doing is getting the 16 bit
>packed data in seperate registers, left shifting it by
>16 bits, then using SSHL on those registers and then
>packing back the MSB values of the two seperate regs
>into a single register and then storing these in the
>desired memory location..Is there a better alternative
>approach here? .The main operation desired is to shift
>an operand with the desired amount and check for
>saturation..if it saturates...then update the value
>with the max val like 0x7fff for a positive saturation
>
>Regards,
>Wilbur
>--- wilbur wrote:
>
>
>
>>Hi All,
>>
>>I have packed 16 bit data for C64xx. What I want to
>>do
>>is shift the data left by some normalization
>>factor and check for saturation and if so, update
>>the
>>values with the max values. Is there some optimum
>>way
>>of doing this?? C64 has a SSHL(shift left by desired
>>amount,check for saturation and update the value)
>>instruction that operates on 32 bit data but not
>>packed 16 bit data. Any pointers how I should go
>>ahead
>>for packed 16 bit data..maybe some instruction that
>>I
>>may have missed?
>>
>>
>
>
Can you send a snippet of C or linear aseembly to make everything 100%
clear ?
- Andrew E.
wilbur wrote:
>To clarify a bit, Wht I am doing is getting the 16 bit
>packed data in seperate registers, left shifting it by
>16 bits, then using SSHL on those registers and then
>packing back the MSB values of the two seperate regs
>into a single register and then storing these in the
>desired memory location..Is there a better alternative
>approach here? .The main operation desired is to shift
>an operand with the desired amount and check for
>saturation..if it saturates...then update the value
>with the max val like 0x7fff for a positive saturation
>
>Regards,
>Wilbur
>--- wilbur wrote:
>
>
>
>>Hi All,
>>
>>I have packed 16 bit data for C64xx. What I want to
>>do
>>is shift the data left by some normalization
>>factor and check for saturation and if so, update
>>the
>>values with the max values. Is there some optimum
>>way
>>of doing this?? C64 has a SSHL(shift left by desired
>>amount,check for saturation and update the value)
>>instruction that operates on 32 bit data but not
>>packed 16 bit data. Any pointers how I should go
>>ahead
>>for packed 16 bit data..maybe some instruction that
>>I
>>may have missed?
>>
>>
>
>
Reply by ●February 15, 20072007-02-15
Hi All,
Thanks for your inputs.
Jeff, I went through the list and the
instructions/intrinsic I am looking for operate on 32
bit data. Will let you know if I come accross
something
Andrew, wht I am thinking is something like,
LDH *dataptr++,A1
||LDH *dataptr++,B1
SHL A1,16,A2
||SHL B1,16,B2
SSHL A2,normfactor,A2
|| SSHL B2,normfactor,B2
PACKH2 A2,B2,A3
STW A3 *dataptr1++
Thanks.
--- Andrew Nesterov
wrote:
>
> Hi Wilbur,
>
> Your approach seem to be quite justified, as
> C64/C64+
> does not have a left shift with saturation
> instruction
> that works on a pair of 16 bit packed data.
>
> Rgds,
>
> Andrew
>
> > Re: Shift left and check for saturation
> > Posted by: "wilbur" w...@yahoo.com
> wilbur_999
> > Date: Wed Feb 14, 2007 6:41 am ((PST))
> >
> > To clarify a bit, Wht I am doing is getting the 16
> bit
> > packed data in seperate registers, left shifting
> it by
> > 16 bits, then using SSHL on those registers and
> then
> > packing back the MSB values of the two seperate
> regs
> > into a single register and then storing these in
> the
> > desired memory location..Is there a better
> alternative
> > approach here? .The main operation desired is to
> shift
> > an operand with the desired amount and check for
> > saturation..if it saturates...then update the
> value
> > with the max val like 0x7fff for a positive
> saturation
> >
> > Regards,
> > Wilbur
> > --- wilbur wrote:
> >
> >> Hi All,
> >>
> >> I have packed 16 bit data for C64xx. What I want
> to
> >> do
> >> is shift the data left by some normalization
> >> factor and check for saturation and if so, update
> >> the
> >> values with the max values. Is there some optimum
> >> way
> >> of doing this?? C64 has a SSHL(shift left by
> desired
> >> amount,check for saturation and update the value)
> >> instruction that operates on 32 bit data but not
> >> packed 16 bit data. Any pointers how I should go
> >> ahead
> >> for packed 16 bit data..maybe some instruction
> that
> >> I
> >> may have missed?
> >
____________________________________________________________________________________
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid96545367
Thanks for your inputs.
Jeff, I went through the list and the
instructions/intrinsic I am looking for operate on 32
bit data. Will let you know if I come accross
something
Andrew, wht I am thinking is something like,
LDH *dataptr++,A1
||LDH *dataptr++,B1
SHL A1,16,A2
||SHL B1,16,B2
SSHL A2,normfactor,A2
|| SSHL B2,normfactor,B2
PACKH2 A2,B2,A3
STW A3 *dataptr1++
Thanks.
--- Andrew Nesterov
wrote:
>
> Hi Wilbur,
>
> Your approach seem to be quite justified, as
> C64/C64+
> does not have a left shift with saturation
> instruction
> that works on a pair of 16 bit packed data.
>
> Rgds,
>
> Andrew
>
> > Re: Shift left and check for saturation
> > Posted by: "wilbur" w...@yahoo.com
> wilbur_999
> > Date: Wed Feb 14, 2007 6:41 am ((PST))
> >
> > To clarify a bit, Wht I am doing is getting the 16
> bit
> > packed data in seperate registers, left shifting
> it by
> > 16 bits, then using SSHL on those registers and
> then
> > packing back the MSB values of the two seperate
> regs
> > into a single register and then storing these in
> the
> > desired memory location..Is there a better
> alternative
> > approach here? .The main operation desired is to
> shift
> > an operand with the desired amount and check for
> > saturation..if it saturates...then update the
> value
> > with the max val like 0x7fff for a positive
> saturation
> >
> > Regards,
> > Wilbur
> > --- wilbur wrote:
> >
> >> Hi All,
> >>
> >> I have packed 16 bit data for C64xx. What I want
> to
> >> do
> >> is shift the data left by some normalization
> >> factor and check for saturation and if so, update
> >> the
> >> values with the max values. Is there some optimum
> >> way
> >> of doing this?? C64 has a SSHL(shift left by
> desired
> >> amount,check for saturation and update the value)
> >> instruction that operates on 32 bit data but not
> >> packed 16 bit data. Any pointers how I should go
> >> ahead
> >> for packed 16 bit data..maybe some instruction
> that
> >> I
> >> may have missed?
> >
____________________________________________________________________________________
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid96545367
Reply by ●February 16, 20072007-02-16
Hi Wilbur,
> Re: Shift left and check for saturation
> Posted by: "wilbur" w...@yahoo.com wilbur_999
> Date: Thu Feb 15, 2007 12:44 pm ((PST))
>
> Andrew, wht I am thinking is something like,
Not quite; LDH loads with sign extension, therefore the two
shifts can be done simultaneously, SSHL by 16+normfactor:
; nfp16 = normfactor + 16
> LDH *dataptr++,A1 ; LSHW
> ; || LDH *dataptr++,B1 ; cannot be in parallel unless
; the pointers are different
LDH *dataptr++,B1 ; MSHW
; wait till data is in registers: NOP 4
> ; SHL A1,16,A2 ; commented out
> ; || SHL B1,16,B2 ; commented out
>
> SSHL A1,nfp16,A2 ; A2 -> A1
> || SSHL B1,nfp16,B2 ; B2 -> B1
>
> ; PACKH2 A2,B2,A3 ; oops, LSHW/MSHW are not in place!
> ; STW A3, *dataptr1++ ;
PACKH2 B2,A2,B3 ; B2 -> MSHW, A2 -> LSHW
STW B3, *dataptr1++ ; on the B side now
Rgds,
Andrew
> Re: Shift left and check for saturation
> Posted by: "wilbur" w...@yahoo.com wilbur_999
> Date: Thu Feb 15, 2007 12:44 pm ((PST))
>
> Andrew, wht I am thinking is something like,
Not quite; LDH loads with sign extension, therefore the two
shifts can be done simultaneously, SSHL by 16+normfactor:
; nfp16 = normfactor + 16
> LDH *dataptr++,A1 ; LSHW
> ; || LDH *dataptr++,B1 ; cannot be in parallel unless
; the pointers are different
LDH *dataptr++,B1 ; MSHW
; wait till data is in registers: NOP 4
> ; SHL A1,16,A2 ; commented out
> ; || SHL B1,16,B2 ; commented out
>
> SSHL A1,nfp16,A2 ; A2 -> A1
> || SSHL B1,nfp16,B2 ; B2 -> B1
>
> ; PACKH2 A2,B2,A3 ; oops, LSHW/MSHW are not in place!
> ; STW A3, *dataptr1++ ;
PACKH2 B2,A2,B3 ; B2 -> MSHW, A2 -> LSHW
STW B3, *dataptr1++ ; on the B side now
Rgds,
Andrew
Reply by ●February 16, 20072007-02-16
Andrew,
Thanks for the inputs.
Regards,
Wilbur
--- Andrew Nesterov
wrote:
>
> Hi Wilbur,
>
> > Re: Shift left and check for saturation
> > Posted by: "wilbur" w...@yahoo.com
> wilbur_999
> > Date: Thu Feb 15, 2007 12:44 pm ((PST))
> >
> > Andrew, wht I am thinking is something like,
>
> Not quite; LDH loads with sign extension, therefore
> the two
> shifts can be done simultaneously, SSHL by
> 16+normfactor:
>
> ; nfp16 = normfactor + 16
>
> > LDH *dataptr++,A1 ; LSHW
> > ; || LDH *dataptr++,B1 ; cannot be in
> parallel unless
> ; the pointers are
> different
> LDH *dataptr++,B1 ; MSHW
>
> ; wait till data is in registers: NOP 4
>
> > ; SHL A1,16,A2 ; commented out
> > ; || SHL B1,16,B2 ; commented out
> >
> > SSHL A1,nfp16,A2 ; A2 -> A1
> > || SSHL B1,nfp16,B2 ; B2 -> B1
> >
> > ; PACKH2 A2,B2,A3 ; oops, LSHW/MSHW are
> not in place!
> > ; STW A3, *dataptr1++ ;
> PACKH2 B2,A2,B3 ; B2 -> MSHW, A2 ->
> LSHW
> STW B3, *dataptr1++ ; on the B side now
>
> Rgds,
>
> Andrew
____________________________________________________________________________________
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/
Thanks for the inputs.
Regards,
Wilbur
--- Andrew Nesterov
wrote:
>
> Hi Wilbur,
>
> > Re: Shift left and check for saturation
> > Posted by: "wilbur" w...@yahoo.com
> wilbur_999
> > Date: Thu Feb 15, 2007 12:44 pm ((PST))
> >
> > Andrew, wht I am thinking is something like,
>
> Not quite; LDH loads with sign extension, therefore
> the two
> shifts can be done simultaneously, SSHL by
> 16+normfactor:
>
> ; nfp16 = normfactor + 16
>
> > LDH *dataptr++,A1 ; LSHW
> > ; || LDH *dataptr++,B1 ; cannot be in
> parallel unless
> ; the pointers are
> different
> LDH *dataptr++,B1 ; MSHW
>
> ; wait till data is in registers: NOP 4
>
> > ; SHL A1,16,A2 ; commented out
> > ; || SHL B1,16,B2 ; commented out
> >
> > SSHL A1,nfp16,A2 ; A2 -> A1
> > || SSHL B1,nfp16,B2 ; B2 -> B1
> >
> > ; PACKH2 A2,B2,A3 ; oops, LSHW/MSHW are
> not in place!
> > ; STW A3, *dataptr1++ ;
> PACKH2 B2,A2,B3 ; B2 -> MSHW, A2 ->
> LSHW
> STW B3, *dataptr1++ ; on the B side now
>
> Rgds,
>
> Andrew
____________________________________________________________________________________
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/
Reply by ●February 16, 20072007-02-16
Wilbur,
I would stay out of asm as long as possible.
Is there a reason you can't do it in C ?
The compiler knows about all these SSHL instructions etc. and will use
them as it sees fit.
- Andrew E.
wilbur wrote:
>Hi All,
>
>Thanks for your inputs.
>
>Jeff, I went through the list and the
>instructions/intrinsic I am looking for operate on 32
>bit data. Will let you know if I come accross
>something
>
>Andrew, wht I am thinking is something like,
>LDH *dataptr++,A1
>||LDH *dataptr++,B1
>SHL A1,16,A2
>||SHL B1,16,B2
>
>SSHL A2,normfactor,A2
>|| SSHL B2,normfactor,B2
>
>PACKH2 A2,B2,A3
>STW A3 *dataptr1++
>
>Thanks.
>--- Andrew Nesterov
>wrote:
>
>
>
>>Hi Wilbur,
>>
>>Your approach seem to be quite justified, as
>>C64/C64+
>>does not have a left shift with saturation
>>instruction
>>that works on a pair of 16 bit packed data.
>>
>>Rgds,
>>
>>Andrew
>>
>>
>>
>>>Re: Shift left and check for saturation
>>>Posted by: "wilbur" w...@yahoo.com
>>>
>>>
>>wilbur_999
>>
>>
>>>Date: Wed Feb 14, 2007 6:41 am ((PST))
>>>
>>>To clarify a bit, Wht I am doing is getting the 16
>>>
>>>
>>bit
>>
>>
>>>packed data in seperate registers, left shifting
>>>
>>>
>>it by
>>
>>
>>>16 bits, then using SSHL on those registers and
>>>
>>>
>>then
>>
>>
>>>packing back the MSB values of the two seperate
>>>
>>>
>>regs
>>
>>
>>>into a single register and then storing these in
>>>
>>>
>>the
>>
>>
>>>desired memory location..Is there a better
>>>
>>>
>>alternative
>>
>>
>>>approach here? .The main operation desired is to
>>>
>>>
>>shift
>>
>>
>>>an operand with the desired amount and check for
>>>saturation..if it saturates...then update the
>>>
>>>
>>value
>>
>>
>>>with the max val like 0x7fff for a positive
>>>
>>>
>>saturation
>>
>>
>>>Regards,
>>>Wilbur
>>>--- wilbur wrote:
>>>
>>>
>>>
>>>>Hi All,
>>>>
>>>>I have packed 16 bit data for C64xx. What I want
>>>>
>>>>
>>to
>>
>>
>>>>do
>>>>is shift the data left by some normalization
>>>>factor and check for saturation and if so, update
>>>>the
>>>>values with the max values. Is there some optimum
>>>>way
>>>>of doing this?? C64 has a SSHL(shift left by
>>>>
>>>>
>>desired
>>
>>
>>>>amount,check for saturation and update the value)
>>>>instruction that operates on 32 bit data but not
>>>>packed 16 bit data. Any pointers how I should go
>>>>ahead
>>>>for packed 16 bit data..maybe some instruction
>>>>
>>>>
>>that
>>
>>
>>>>I
>>>>may have missed?
>>>>
>>>>
>>>>
>____________________________________________________________________________________
>Food fight? Enjoy some healthy debate
>in the Yahoo! Answers Food & Drink Q&A.
>http://answers.yahoo.com/dir/?link=list&sid96545367
>
>
>
I would stay out of asm as long as possible.
Is there a reason you can't do it in C ?
The compiler knows about all these SSHL instructions etc. and will use
them as it sees fit.
- Andrew E.
wilbur wrote:
>Hi All,
>
>Thanks for your inputs.
>
>Jeff, I went through the list and the
>instructions/intrinsic I am looking for operate on 32
>bit data. Will let you know if I come accross
>something
>
>Andrew, wht I am thinking is something like,
>LDH *dataptr++,A1
>||LDH *dataptr++,B1
>SHL A1,16,A2
>||SHL B1,16,B2
>
>SSHL A2,normfactor,A2
>|| SSHL B2,normfactor,B2
>
>PACKH2 A2,B2,A3
>STW A3 *dataptr1++
>
>Thanks.
>--- Andrew Nesterov
>wrote:
>
>
>
>>Hi Wilbur,
>>
>>Your approach seem to be quite justified, as
>>C64/C64+
>>does not have a left shift with saturation
>>instruction
>>that works on a pair of 16 bit packed data.
>>
>>Rgds,
>>
>>Andrew
>>
>>
>>
>>>Re: Shift left and check for saturation
>>>Posted by: "wilbur" w...@yahoo.com
>>>
>>>
>>wilbur_999
>>
>>
>>>Date: Wed Feb 14, 2007 6:41 am ((PST))
>>>
>>>To clarify a bit, Wht I am doing is getting the 16
>>>
>>>
>>bit
>>
>>
>>>packed data in seperate registers, left shifting
>>>
>>>
>>it by
>>
>>
>>>16 bits, then using SSHL on those registers and
>>>
>>>
>>then
>>
>>
>>>packing back the MSB values of the two seperate
>>>
>>>
>>regs
>>
>>
>>>into a single register and then storing these in
>>>
>>>
>>the
>>
>>
>>>desired memory location..Is there a better
>>>
>>>
>>alternative
>>
>>
>>>approach here? .The main operation desired is to
>>>
>>>
>>shift
>>
>>
>>>an operand with the desired amount and check for
>>>saturation..if it saturates...then update the
>>>
>>>
>>value
>>
>>
>>>with the max val like 0x7fff for a positive
>>>
>>>
>>saturation
>>
>>
>>>Regards,
>>>Wilbur
>>>--- wilbur wrote:
>>>
>>>
>>>
>>>>Hi All,
>>>>
>>>>I have packed 16 bit data for C64xx. What I want
>>>>
>>>>
>>to
>>
>>
>>>>do
>>>>is shift the data left by some normalization
>>>>factor and check for saturation and if so, update
>>>>the
>>>>values with the max values. Is there some optimum
>>>>way
>>>>of doing this?? C64 has a SSHL(shift left by
>>>>
>>>>
>>desired
>>
>>
>>>>amount,check for saturation and update the value)
>>>>instruction that operates on 32 bit data but not
>>>>packed 16 bit data. Any pointers how I should go
>>>>ahead
>>>>for packed 16 bit data..maybe some instruction
>>>>
>>>>
>>that
>>
>>
>>>>I
>>>>may have missed?
>>>>
>>>>
>>>>
>____________________________________________________________________________________
>Food fight? Enjoy some healthy debate
>in the Yahoo! Answers Food & Drink Q&A.
>http://answers.yahoo.com/dir/?link=list&sid96545367
>
>
>
Reply by ●February 16, 20072007-02-16
Hi Andrew,
I wish I could stay out of it too, considering that I
am a newbie..my manager feels otherwise :D..The most
optimum solution was to unpack the packed 16 bit data
in seperate registers, use SSHL and then pack the
MSB's in a register. My initial approach was correct
except for some redundant steps, which I wonder why I
used in the first place. Anyways Thanks!
Regards,
Wilbur
--- Andrew Elder wrote:
>
> Wilbur,
>
> I would stay out of asm as long as possible.
> Is there a reason you can't do it in C ?
> The compiler knows about all these SSHL instructions
> etc. and will use
> them as it sees fit.
>
> - Andrew E.
>
> wilbur wrote:
>
> >Hi All,
> >
> >Thanks for your inputs.
> >
> >Jeff, I went through the list and the
> >instructions/intrinsic I am looking for operate on
> 32
> >bit data. Will let you know if I come accross
> >something
> >
> >Andrew, wht I am thinking is something like,
> >LDH *dataptr++,A1
> >||LDH *dataptr++,B1
> >SHL A1,16,A2
> >||SHL B1,16,B2
> >
> >SSHL A2,normfactor,A2
> >|| SSHL B2,normfactor,B2
> >
> >PACKH2 A2,B2,A3
> >STW A3 *dataptr1++
> >
> >Thanks.
> >--- Andrew Nesterov
> >wrote:
> >
> >
> >
> >>Hi Wilbur,
> >>
> >>Your approach seem to be quite justified, as
> >>C64/C64+
> >>does not have a left shift with saturation
> >>instruction
> >>that works on a pair of 16 bit packed data.
> >>
> >>Rgds,
> >>
> >>Andrew
> >>
> >>
> >>
> >>>Re: Shift left and check for saturation
> >>>Posted by: "wilbur" w...@yahoo.com
> >>>
> >>>
> >>wilbur_999
> >>
> >>
> >>>Date: Wed Feb 14, 2007 6:41 am ((PST))
> >>>
> >>>To clarify a bit, Wht I am doing is getting the
> 16
> >>>
> >>>
> >>bit
> >>
> >>
> >>>packed data in seperate registers, left shifting
> >>>
> >>>
> >>it by
> >>
> >>
> >>>16 bits, then using SSHL on those registers and
> >>>
> >>>
> >>then
> >>
> >>
> >>>packing back the MSB values of the two seperate
> >>>
> >>>
> >>regs
> >>
> >>
> >>>into a single register and then storing these in
> >>>
> >>>
> >>the
> >>
> >>
> >>>desired memory location..Is there a better
> >>>
> >>>
> >>alternative
> >>
> >>
> >>>approach here? .The main operation desired is to
> >>>
> >>>
> >>shift
> >>
> >>
> >>>an operand with the desired amount and check for
> >>>saturation..if it saturates...then update the
> >>>
> >>>
> >>value
> >>
> >>
> >>>with the max val like 0x7fff for a positive
> >>>
> >>>
> >>saturation
> >>
> >>
> >>>Regards,
> >>>Wilbur
> >>>--- wilbur wrote:
> >>>
> >>>
> >>>
> >>>>Hi All,
> >>>>
> >>>>I have packed 16 bit data for C64xx. What I want
> >>>>
> >>>>
> >>to
> >>
> >>
> >>>>do
> >>>>is shift the data left by some normalization
> >>>>factor and check for saturation and if so,
> update
> >>>>the
> >>>>values with the max values. Is there some
> optimum
> >>>>way
> >>>>of doing this?? C64 has a SSHL(shift left by
> >>>>
> >>>>
> >>desired
> >>
> >>
> >>>>amount,check for saturation and update the
> value)
> >>>>instruction that operates on 32 bit data but not
> >>>>packed 16 bit data. Any pointers how I should go
> >>>>ahead
> >>>>for packed 16 bit data..maybe some instruction
> >>>>
> >>>>
> >>that
> >>
> >>
> >>>>I
> >>>>may have missed?
> >>>>
> >>>>
> >>>>
> >
> >
> >
> >____________________________________________________________________________________
> >Food fight? Enjoy some healthy debate
> >in the Yahoo! Answers Food & Drink Q&A.
>
>http://answers.yahoo.com/dir/?link=list&sid96545367
> >
> >
> >
> >
=== message truncated ==
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
I wish I could stay out of it too, considering that I
am a newbie..my manager feels otherwise :D..The most
optimum solution was to unpack the packed 16 bit data
in seperate registers, use SSHL and then pack the
MSB's in a register. My initial approach was correct
except for some redundant steps, which I wonder why I
used in the first place. Anyways Thanks!
Regards,
Wilbur
--- Andrew Elder wrote:
>
> Wilbur,
>
> I would stay out of asm as long as possible.
> Is there a reason you can't do it in C ?
> The compiler knows about all these SSHL instructions
> etc. and will use
> them as it sees fit.
>
> - Andrew E.
>
> wilbur wrote:
>
> >Hi All,
> >
> >Thanks for your inputs.
> >
> >Jeff, I went through the list and the
> >instructions/intrinsic I am looking for operate on
> 32
> >bit data. Will let you know if I come accross
> >something
> >
> >Andrew, wht I am thinking is something like,
> >LDH *dataptr++,A1
> >||LDH *dataptr++,B1
> >SHL A1,16,A2
> >||SHL B1,16,B2
> >
> >SSHL A2,normfactor,A2
> >|| SSHL B2,normfactor,B2
> >
> >PACKH2 A2,B2,A3
> >STW A3 *dataptr1++
> >
> >Thanks.
> >--- Andrew Nesterov
> >wrote:
> >
> >
> >
> >>Hi Wilbur,
> >>
> >>Your approach seem to be quite justified, as
> >>C64/C64+
> >>does not have a left shift with saturation
> >>instruction
> >>that works on a pair of 16 bit packed data.
> >>
> >>Rgds,
> >>
> >>Andrew
> >>
> >>
> >>
> >>>Re: Shift left and check for saturation
> >>>Posted by: "wilbur" w...@yahoo.com
> >>>
> >>>
> >>wilbur_999
> >>
> >>
> >>>Date: Wed Feb 14, 2007 6:41 am ((PST))
> >>>
> >>>To clarify a bit, Wht I am doing is getting the
> 16
> >>>
> >>>
> >>bit
> >>
> >>
> >>>packed data in seperate registers, left shifting
> >>>
> >>>
> >>it by
> >>
> >>
> >>>16 bits, then using SSHL on those registers and
> >>>
> >>>
> >>then
> >>
> >>
> >>>packing back the MSB values of the two seperate
> >>>
> >>>
> >>regs
> >>
> >>
> >>>into a single register and then storing these in
> >>>
> >>>
> >>the
> >>
> >>
> >>>desired memory location..Is there a better
> >>>
> >>>
> >>alternative
> >>
> >>
> >>>approach here? .The main operation desired is to
> >>>
> >>>
> >>shift
> >>
> >>
> >>>an operand with the desired amount and check for
> >>>saturation..if it saturates...then update the
> >>>
> >>>
> >>value
> >>
> >>
> >>>with the max val like 0x7fff for a positive
> >>>
> >>>
> >>saturation
> >>
> >>
> >>>Regards,
> >>>Wilbur
> >>>--- wilbur wrote:
> >>>
> >>>
> >>>
> >>>>Hi All,
> >>>>
> >>>>I have packed 16 bit data for C64xx. What I want
> >>>>
> >>>>
> >>to
> >>
> >>
> >>>>do
> >>>>is shift the data left by some normalization
> >>>>factor and check for saturation and if so,
> update
> >>>>the
> >>>>values with the max values. Is there some
> optimum
> >>>>way
> >>>>of doing this?? C64 has a SSHL(shift left by
> >>>>
> >>>>
> >>desired
> >>
> >>
> >>>>amount,check for saturation and update the
> value)
> >>>>instruction that operates on 32 bit data but not
> >>>>packed 16 bit data. Any pointers how I should go
> >>>>ahead
> >>>>for packed 16 bit data..maybe some instruction
> >>>>
> >>>>
> >>that
> >>
> >>
> >>>>I
> >>>>may have missed?
> >>>>
> >>>>
> >>>>
> >
> >
> >
> >____________________________________________________________________________________
> >Food fight? Enjoy some healthy debate
> >in the Yahoo! Answers Food & Drink Q&A.
>
>http://answers.yahoo.com/dir/?link=list&sid96545367
> >
> >
> >
> >
=== message truncated ==
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com






