* AltiVec in gcc-current: questions.
@ 2002-08-10 1:00 Matt Thomas
2002-08-10 9:07 ` Daniel Egger
0 siblings, 1 reply; 2+ messages in thread
From: Matt Thomas @ 2002-08-10 1:00 UTC (permalink / raw)
To: gcc
I've implemented the IP checksum in AltiVec. I have it working just
fine with __asm()'s on gcc 2.95.3. Now I'm using gcc-current and
trying to use -mabi=altivec and the vec_* calls. I've converted the
asm's for everything to the proper vec_* except for my use of the
vec_vmrghh (and vec_vmrglh) builtins. I also wish I could get 16
byte aligned automatic variables but that's a different issue.
I'm using them in asm()'s to split upper or lower 4 of the 8 HI's
into 4 SIs by using a zeroed vector register and doing to
vmrghh dst,zero,src
where dst is a vector unsigned int and src is a vector unsigned short.
(dst could equally be a vector signed int). But the builtins say
that vmrg[hl]h only result in V8HI. This wouldn't be so bad if I
could cast the vectors but the compiler seems to disallow that.
So for now, I'm using an __asm() for my two vmrg[lh]h calls.
Here's a more detailed view of what I'm doing:
After I loaded the data and added it all together, my cksum routine
has two V4SI vectors with corresponding hi and lo sums. Now I can
treat the lo sum as a V8HI vector and split its content into two
V4SI vectors which I can together.
vector unsigned int data, zero, sumlo, sumhi;
zero ^= zero;
sumlo = zero;
sumhi = zero;
while (dp < ep) {
vec_ld(data, 0, dp);
sumhi += vec_addc(sumlo, data);
sumlo += data;
dp += 4;
}
sumhi += vmrghh(zero, sumlo) + vmrglh(zero, sumlo);
sumlo = vmrghw(zero, sumhi) + vmrglw(zero, sumhi);
/* now I have V2DI (effectively) */
vec_st(sumlo, 0, tmp);
sum = tmp[1] + tmp[3]; /* BE of course */
REDUCE(sum);
...
Comments?
--
Matt Thomas Internet: matt@3am-software.com
3am Software Foundry WWW URL: http://www.3am-software.com/bio/matt/
Cupertino, CA Disclaimer: I avow all knowledge of this message
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: AltiVec in gcc-current: questions.
2002-08-10 1:00 AltiVec in gcc-current: questions Matt Thomas
@ 2002-08-10 9:07 ` Daniel Egger
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Egger @ 2002-08-10 9:07 UTC (permalink / raw)
To: Matt Thomas; +Cc: GCC Developer Mailinglist
Am Sam, 2002-08-10 um 09.57 schrieb Matt Thomas:
> vmrghh dst,zero,src
> where dst is a vector unsigned int and src is a vector unsigned short.
> (dst could equally be a vector signed int). But the builtins say
> that vmrg[hl]h only result in V8HI.
This is correct. The result of the vec_merge* operations is always the
same type as the arguments.
> This wouldn't be so bad if I could cast the vectors but the compiler
> seems to disallow that.
Where did that fail? Casting vectors should be fine...
--
Servus,
Daniel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-08-10 9:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-10 1:00 AltiVec in gcc-current: questions Matt Thomas
2002-08-10 9:07 ` Daniel Egger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).