[PATCH] [x86] eliminate unnecessary shuffling/moves with unary scalar math ops (PR21507)

Sanjay Patel spatel at rotateright.com
Tue May 5 14:01:52 PDT 2015


Hi delena, mkuper, RKSimon,

This patch attempts to finish the job that was abandoned in D6958 following the refactoring in http://reviews.llvm.org/rL230221:
1. Uncomment the intrinsic def for the AVX r_Int instruction.
2. Add missing r_Int entries to the load folding tables; there are already tests that check these in "test/Codegen/X86/fold-load-unops.ll", so I haven't added any more in this patch.
3. Add patterns to solve PR21507 ( https://llvm.org/bugs/show_bug.cgi?id=21507 ).

So instead of this:
   movaps	%xmm0, %xmm1
   rcpss	%xmm1, %xmm1
   movss	%xmm1, %xmm0

We should now get:
   rcpss	%xmm0, %xmm0

And instead of this:
   vsqrtss	%xmm0, %xmm0, %xmm1
   vblendps	$1, %xmm1, %xmm0, %xmm0 ## xmm0 = xmm1[0],xmm0[1,2,3]

We should now get:
   vsqrtss	%xmm0, %xmm0, %xmm0

http://reviews.llvm.org/D9504

Files:
  lib/Target/X86/X86InstrInfo.cpp
  lib/Target/X86/X86InstrSSE.td
  test/CodeGen/X86/sse-scalar-fp-arith-unary.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9504.24978.patch
Type: text/x-patch
Size: 8575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150505/97ca08bc/attachment.bin>


More information about the llvm-commits mailing list