cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

afo
Adept I

Doubt about AMD vendor specific extension

The output of amd_bitalign is uint or ulong?

Hi,

I was reading amd media extensions in the opencl programming guide, and in secction A8 (page A5) I see that amd_bitalign returns an UINTn, but the definition says

(uint) (((((long)src0) << 32) | (long)src1 >> (src2& 31))

so, arguments are promoted to long (64 bits) and one of them rotated left by 32, so I guess that there is a typo and the final result is ulong. Could someone from AMD confirm that?

The same situation happens for amd_bytealign

best regards,

Alfonso

0 Likes
2 Replies
malcolm3141
Journeyman III

It is a uint as advertised, in fact the code you've written above is incorrect.

The instructions are intended for streams of bits or bytes, and aligning to a particular bit or byte in the stream.

bit align:

(uint) ( ( (((long)src0.s0) << 32) | (long)src1.s0 ) >> (src2.s0 & 31) )

byte align:

(uint) ( ( (((long)src0.s0) << 32) | (long)src1.s0 ) >> ((src2.s0 & 3)*8) )

 

Malcolm

0 Likes

Ahh, my mistake!

thanks, now this makes more sense.

regards,

Alfonso

0 Likes