From owner-freebsd-ppc@FreeBSD.ORG Tue Jul 15 05:52:32 2014 Return-Path: Delivered-To: powerpc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2D6F46A3 for ; Tue, 15 Jul 2014 05:52:32 +0000 (UTC) Received: from mx.nsu.ru (mx.nsu.ru [84.237.50.39]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8D462D44 for ; Tue, 15 Jul 2014 05:52:30 +0000 (UTC) Received: from regency.nsu.ru ([193.124.210.26]) by mx.nsu.ru with esmtp (Exim 4.72) (envelope-from ) id 1X6vey-0004Kc-Km; Tue, 15 Jul 2014 12:52:22 +0700 Received: from regency.nsu.ru (localhost [127.0.0.1]) by regency.nsu.ru (8.14.2/8.14.2) with ESMTP id s6F5qbTB072757; Tue, 15 Jul 2014 12:52:47 +0700 (NOVT) (envelope-from danfe@regency.nsu.ru) Received: (from danfe@localhost) by regency.nsu.ru (8.14.2/8.14.2/Submit) id s6F5qViv072747; Tue, 15 Jul 2014 12:52:31 +0700 (NOVT) (envelope-from danfe) Date: Tue, 15 Jul 2014 12:52:31 +0700 From: Alexey Dokuchaev To: Justin Hibbits Subject: Re: How to convert SSEish _mm_set1_ps() into AltiVec correctly? Message-ID: <20140715055231.GA70698@regency.nsu.ru> References: <20140714154224.GA28612@regency.nsu.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Lua-Profiles: 63967 [Jul 15 2014] X-KLMS-AntiSpam-Version: 5.5.3 X-KLMS-AntiSpam-Envelope-From: danfe@regency.nsu.ru X-KLMS-AntiSpam-Rate: 0 X-KLMS-AntiSpam-Status: not_detected X-KLMS-AntiSpam-Method: none X-KLMS-AntiSpam-Moebius-Timestamps: 3017394, 3017412, 0 X-KLMS-AntiSpam-Interceptor-Info: scan successful X-KLMS-AntiVirus: Kaspersky Security 8.0 for Linux Mail Server 8.0.0.455, not checked X-KLMS-AntiVirus-Status: NotChecked: not checked, skipped Cc: powerpc@freebsd.org X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2014 05:52:32 -0000 On Mon, Jul 14, 2014 at 09:20:55AM -0700, Justin Hibbits wrote: > On Mon, Jul 14, 2014 at 8:42 AM, Alexey Dokuchaev 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