From: Erik S. <esc...@pe...> - 2011-10-31 14:24:15
|
Pekka Yes, such an andps instruction is possible. However, I am quite certain (but can't guarantee it) that the other vector elements of the respective xmm register are unused. That is at least the calling convention for x86; of course, I don't know whether llvm is doing anything clever within a routine, but by looking at the generated code, this does not seem to be the case. I've just figured out the extended asm syntax for this. -erik 2011/10/31 Pekka Jääskeläinen <pek...@tu...>: > On 10/31/2011 12:21 AM, Erik Schnetter wrote: >> >> You are right; andss does not exist, but there is an andps instead. > > It seems to be an SIMD instruction that performs the 'and' for 4 single > precision floats and you are performing it on a single one. > > I can understand that LLVM cannot select it automatically as in that case > it would clobber all the other floats in the SIMD register too, and (at > least when inlined) they can contain live data. Thus, if it selected it > automatically, it had to "spill" the other parts of the SIMD reg before > doing that which is quite costly. > > However, if you are sure using ANDPS here is faster, you can generate an > inline asm that has a safe 'all ones' mask for the rest of the fields, > right? > > -- > --Pekka > > -- Erik Schnetter <esc...@pe...> http://www.cct.lsu.edu/~eschnett/ AIM: eschnett247, Skype: eschnett, Google Talk: sch...@gm... |