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: [power7-meissner] Vectorize simple math builtins



	vspltisw	v1,-1	; v1 = (0xFFFFFFFF, ...)
	vxor	v2,v3,v4
	vslw	v1,v1,v1	; v1 = v1<<  31 = (0x80000000, ...)
	vand	v1,v1,v2	; v1 != 0 if sign bits of v3/v4 differ
	vxor	v1,v1,v3	; v1 = v3 with v4's sign bits

Maybe it's worthwhile making it available for Altivec too.

Actually it is much simpler to load up a mask with every bit set except for the sign bit (or just the sign bit set), and then do a vsel (vector select) between the value with the sign bit and the value with the rest of the floating point value.

Yeah, that would be vspltisw+vslw+vsel.


Paolo


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