This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: altivec predicates


>>>>> Aldy Hernandez writes:

Aldy> How about this interface:

Aldy> __builtin_altivec_predicate_vcmpeqfp (__CR6_blah, a1, a2);
Aldy> __builtin_altivec_predicate_vcmpequwp (__CR6_blah, a1, a2);
Aldy> __builtin_altivec_predicate_vcmpequhp (__CR6_blah, a1, a2);
Aldy> __builtin_altivec_predicate_vcmpequbp (__CR6_blah, a1, a2);
Aldy> __builtin_altivec_predicate_vcmpeqswp (__CR6_blah, a1, a2);
Aldy> __builtin_altivec_predicate_vcmpeqshp (__CR6_blah, a1, a2);
Aldy> __builtin_altivec_predicate_vcmpeqsbp (__CR6_blah, a1, a2);

Aldy> where __CR6_blah is one of:

Aldy> #define __CR6_LT	0
Aldy> #define __CR6_EQ	1
Aldy> #define __CR6_LT_REV	2
Aldy> #define __CR6_EQ_REV	3

Aldy> and two more sets for GT and GE for a total of 21 new builtins.

Aldy> Btw, did we settle on "_predicate_", "_compare_", or another name?

	If you want to pass EQ, GT, and GE as #defines instead of defining
multiple builtins, that would be fine with me.  In other words:

__builtin_altivec_predicate_vcmpfp (__COND, __CR6, a1, a2);

with an output template like 

"vcmp%V0fp"

or even something more efficient like what Geoff implemented for PowerPC
conditional branches.  It just seems like you could have a few patterns in
the MD file calling a C function to actually build up the right PowerPC
instruction mnemonic.

__builtin_altivec_predicate (__MODE, __COND, __CR6, a1, a2);

	Also, if the Altivec documentation wants predicate, we might as
well follow the terminology.

Thanks, David


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]