<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [Regression] Wrong codegen for AVX permute intrinsic"
   href="https://llvm.org/bugs/show_bug.cgi?id=26667">26667</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Regression] Wrong codegen for AVX permute intrinsic
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>Yunzhong_Gao@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>// test.c
typedef double __m256d __attribute__((__vector_size__(32)));
typedef double __v4df __attribute__ ((__vector_size__ (32)));
#define _mm256_permute2f128_pd(V1, V2, M) \
  (__m256d)__builtin_ia32_vperm2f128_pd256((__v4df)(V1), (__v4df)(V2), (M))

__m256d foo(__m256d Lhs, __m256d Rhs) {
  return _mm256_permute2f128_pd(Lhs, Rhs, 50);
}
// end test.c

$ clang -O0 -S -mavx test.c -o -

Here is the assembly sequence produced by r260062:
    andq    $-32, %rsp
    subq    $96, %rsp
    vmovapd    %ymm0, 32(%rsp)
    vmovapd    %ymm1, (%rsp)
    vmovapd    32(%rsp), %ymm0

        # vperm2f128 $src3, $src2, $src1, $dst
        # with mask=$50, $dst = $src2, so in this case, ymm0 <= ymm1
    vperm2f128  $50, %ymm1, %ymm0, %ymm0 # ymm0 = ymm1[0,1,2,3]

And here is the assembly sequence produced by r260063 and later
    andq    $-32, %rsp
    subq    $128, %rsp
    vmovapd    %ymm0, 64(%rsp)
    vmovapd    %ymm1, 32(%rsp)
    vmovapd    64(%rsp), %ymm0
    vmovaps    %ymm1, (%rsp)           # 32-byte Spill
        # and in this case, ymm0 is still ymm0</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>