[llvm-commits] [llvm] r140140 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/avx-minmax.ll

Stephen Canon scanon at apple.com
Tue Sep 20 02:43:43 PDT 2011


>> +; UNSAFE: maxpd:
>> +; UNSAFE: vmaxpd %xmm
>> +define<2 x double>  @maxpd(<2 x double>  %x,<2 x double>  %y) {
>> +  %max_is_x = fcmp oge<2 x double>  %x, %y
>> +  %max = select<2 x i1>  %max_is_x,<2 x double>  %x,<2 x double>  %y
>> +  ret<2 x double>  %max
>> +}
> 
> Is producing vmaxpd here rather than maxpd a good thing to do?

Yes.  When targeting AVX, we should prefer the vex-prefixed forms (vmaxpd) to the legacy sse forms (maxpd).  The two instructions "do" exactly the same thing, but the vex-prefixed form zeroes out the high 128 bits of the corresponding ymm register, which allows us to avoid taking a substantial "transition penalty" (stall) if any AVX-256 instructions have been previously executed.

Chapter 11 of the Intel Optimization Manual has the full details if you're curious.

- Steve



More information about the llvm-commits mailing list