Date: Tue, 15 Jul 2014 12:52:31 +0700 From: Alexey Dokuchaev <danfe@nsu.ru> To: Justin Hibbits <jrh29@alumni.cwru.edu> Cc: powerpc@freebsd.org Subject: Re: How to convert SSEish _mm_set1_ps() into AltiVec correctly? Message-ID: <20140715055231.GA70698@regency.nsu.ru> In-Reply-To: <CAHSQbTAG8rJbfyYG-FaQjuVm0ZYWAOLN6UcY-ycM%2Byuw0OvESw@mail.gmail.com> References: <20140714154224.GA28612@regency.nsu.ru> <CAHSQbTAG8rJbfyYG-FaQjuVm0ZYWAOLN6UcY-ycM%2Byuw0OvESw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 14, 2014 at 09:20:55AM -0700, Justin Hibbits wrote: > On Mon, Jul 14, 2014 at 8:42 AM, Alexey Dokuchaev <danfe@nsu.ru> wrote: > > I'm a bit confused about how to convert _mm_set1_ps() [1] SSE function into > > its AltiVec equivalent. To start with, I need to set all four floats of a > > vector to the same value. So far, I've come up with two versions that work > > with GCC or Clang, but I want to have a code that works with any compiler, > > and is technically correct (works not just by accident). [...] > > I just tried the following: > > vector float a = (vector float){42.0f}; > vector float b = vec_splat(a, 0); > > Haven't done anything more than compile test it, but it builds with > both gcc and clang. GCC uses vspltw, while clang uses vperm. Awesome, thanks, that works. It did not occur to me that simply casting a {42.f} and assigning it directly would DTRT on its own. ./danfe
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140715055231.GA70698>