[llvm] acbc5ed - [X86][SSE] getFauxShuffle - support insert(truncate/extend(extract(vec0,c0)),vec1,c1) shuffle patterns at the byte level

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 00:48:57 PDT 2020


On Sun, 26 Apr 2020, Simon Pilgrim via llvm-commits wrote:

>
> Author: Simon Pilgrim
> Date: 2020-04-26T15:31:01+01:00
> New Revision: acbc5ede9916a22b06341647d94e5dff51af32a2
>
> URL: https://github.com/llvm/llvm-project/commit/acbc5ede9916a22b06341647d94e5dff51af32a2
> DIFF: https://github.com/llvm/llvm-project/commit/acbc5ede9916a22b06341647d94e5dff51af32a2.diff
>
> LOG: [X86][SSE] getFauxShuffle - support insert(truncate/extend(extract(vec0,c0)),vec1,c1) shuffle patterns at the byte level
>
> Followup to the PR45604 fix at rGe71dd7c011a3 where we disabled most of these cases.
>
> By creating the shuffle at the byte level we can handle any extension/truncation as long as we track how small the scalar got and assume that the upper bytes will need to be zero.

This causes failed assertions:

$ cat repro.c

char *a; char c, d; b; g() {
   short e[0]; short *f = e; for (;;) {
     f[0] = d + 42 * a[0] * a[1] * a[2] - a[3]; f[1] = a[0] + 42 * a[1] *
     a[2] * a[3] - a[4]; f[2] = 1 + 42 * a[2] * a[3] * a[4] - 5; f[3] = 2 +
     42 * a[3] * a[4] * a[5] - a[6]; f[4] = 3 + 42 * a[4] * a[5] * a[6] -
     a[7]; f[5] = 4 + 42 * a[5] * a[6] * a[7] - a[8]; f[6] = 7 + 42 * a[6]
     * a[7] * a[8] - a[9]; f[7] = 6 + 42 * a[7] * a[8] * a[9] - c; f += 8;
     a += b;
   }

$ clang -target x86_64-linux-gnu -w -c -O2 repro.c
clang: ../include/llvm/ADT/SmallVector.h:150: T& llvm::SmallVectorTempla 
teCommon<T, <template-parameter-1-2> >::operator[](llvm::SmallVectorTemp 
lateCommon<T, <template-parameter-1-2> >::size_type) [with T = int; <tem 
plate-parameter-1-2> = void; llvm::SmallVectorTemplateCommon<T, <templat 
e-parameter-1-2> >::reference = int&; llvm::SmallVectorTemplateCommon<T,
  <template-parameter-1-2> >::size_type = long unsigned int]: Assertion `
idx < size()' failed.


// Martin



More information about the llvm-commits mailing list