[PATCH] Calculate vectorization factor using the narrowest type instead of widest type

Cong Hou congh at google.com
Thu Apr 9 17:22:27 PDT 2015


Hi hfinkel,

LLVM uses the widest type to calculate the maximum vectorization factor, which greatly limits the bandwidth of either calculations or loads/stores from SIMD instructions. One example is converting 8-bit integers to 32-bit integers from arrays in a loop: currently the VF of this simple loop is decided by 32-bit integer and for SSE2 it will be 4. Then we will have 1 load and 1 store in every 4 iterations. If we calculate VF based on 8-bit integer, which will be 16, we will have 1 load and 4 stores in every 16 iterations, saving many loads.

This patch mainly changes the function getWidestType() to getNarrowestType(), and uses it to calculate VF.

http://reviews.llvm.org/D8943

Files:
  lib/Target/X86/X86TargetTransformInfo.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/X86/fp64_to_uint32-cost-model.ll
  test/Transforms/LoopVectorize/X86/vector_ptr_load_store.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8943.23545.patch
Type: text/x-patch
Size: 5543 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150410/919cef9d/attachment.bin>


More information about the llvm-commits mailing list