[Mesa-dev] RFC: PowerPC: Add Altivec pack/unpack intrisics
Adhemerval Zanella
azanella at linux.vnet.ibm.com
Tue Nov 6 03:15:17 PST 2012
On 11/05/2012 06:19 PM, Roland Scheidegger wrote:
> Am 05.11.2012 18:45, schrieb Adhemerval Zanella:
>> Hi all,
>>
>> This patch adds PPC Altivec support for pack/unpack operations using Altivec
>> supported vector type (8xi8, 16xi16, 4xi32, 4xf32). I focused my work on the
>> lp_test_conv testcase for llvmpipe and this patch corrects all the failing
>> issues for conversion using the aforementioned vector types.
>>
>> I wasn't sure which code styling to use, so I tried to guess based on the
>> current style of the file. Any advices, tips, suggestions?
> I'm wondering if it wouldn't be nicer to separate based on arch first
> now that there are intrinsics for more than one arch.
> I.e something like:
> if(util_cpu_caps.has_sse2) {
> switch(src_type.width) {
> case 32:
> if (signed)...
> ...
> case 16:
> ...
> }
> }
> else if (util_cpu_caps.has_altivec) {
>
> switch(src_type.width) {
> case 32:
> if (signed)...
> ...
> case 16:
> ...
> }
> }
>
> Not sure if that would really be nicer however.
>
> I'm wondering if we should also add compile-time dependent #ifs for that
> kind of stuff. Up to now llvmpipe wasn't really working well (or at all)
> running on non-x86 architectures, so compile-time switches weren't
> really necessary (and all the sse intrinsics needed to be run-time for
> x86 arch). Might not be worth the uglification though.
>
> Otherwise this looks good to me (and the min/max one too).
>
> Roland
>
Although I tried on these patches to be less intrusive as possible, I tend to
prefer specific implementation for each arch, like 'lp_bld_altivec.c' or
'lp_bld_ppc.c' with a common header. This avoid code pollution with multiple
#ifdefs or multiple if/switch.
Maybe it worth a refactor if the codebase for arch stuff gets too larger.
More information about the mesa-dev
mailing list