[PATCH] D28219: [X86] Attempt to pre-truncate arithmetic operations if useful

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 2 15:15:17 PST 2017


RKSimon created this revision.
RKSimon added reviewers: eli.friedman, delena, craig.topper, spatel, andreadb.
RKSimon added a subscriber: llvm-commits.
RKSimon set the repository for this revision to rL LLVM.

In some cases its more efficient to combine TRUNC( BINOP( X, Y ) ) --> BINOP( TRUNC( X ), TRUNC( Y ) ) if the binop is legal for the truncated types.

This is true for vector integer multiplication (especially vXi64), as well ADD/AND/XOR/OR in cases where we only need to truncate one of the inputs at runtime (e.g. a duplicated input or an one use constant we can fold).

Further work could be done here - scalar cases (especially i64) could often benefit (if we avoid partial registers etc.) and other opcodes possibly too.

I have considered implementing this for all targets within the DAGCombiner but wasn't sure we could devise a suitable cost model system that would give us the range we need?


Repository:
  rL LLVM

https://reviews.llvm.org/D28219

Files:
  lib/Target/X86/X86ISelLowering.cpp
  test/CodeGen/X86/avx512-any_extend_load.ll
  test/CodeGen/X86/i64-to-float.ll
  test/CodeGen/X86/vector-trunc-math.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28219.82820.patch
Type: text/x-patch
Size: 124524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170102/cd692543/attachment-0001.bin>


More information about the llvm-commits mailing list