[PATCH] [CodeGen] Don't cast and use SizeTy instead of Int32Ty when constructing {extract, insert} vector element instructions.

Michael Spencer bigcheesegs at gmail.com
Fri May 30 16:53:08 PDT 2014


Hi rsmith,

With this patch the following code is able to be correctly optimized.

  #include <x86intrin.h>
  #include <immintrin.h>
  #include <avxintrin.h>
  #include <avx2intrin.h>
  #include <cstdio>
  #include <cinttypes>
  
  __m128 bss4( const __m128 *ptr, size_t i, size_t j )
  {
      float f = ptr[i][j];
      return (__m128) { f, f, f, f };
  }

Previously an unneeded trunc + zext would be emitted.

http://reviews.llvm.org/D3974

Files:
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprScalar.cpp
  test/CodeGen/builtinshufflevector2.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3974.9971.patch
Type: text/x-patch
Size: 10607 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140530/c3260292/attachment.bin>


More information about the cfe-commits mailing list