<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Failure to hoist repeated vextractf128 from switch cases"
   href="https://bugs.llvm.org/show_bug.cgi?id=38917">38917</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Failure to hoist repeated vextractf128 from switch cases
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Simplified (masked store style) example:

<a href="https://gcc.godbolt.org/z/g7URz3">https://gcc.godbolt.org/z/g7URz3</a>

void store07(__m256i a, __m256i v, int *f) {
    switch(_mm256_movemask_ps(a)) {
    case 0xff:
      f[7] = _mm256_extract_epi32(v, 7);            
    case 0x7f:
      f[6] = _mm256_extract_epi32(v, 6);
    case 0x3f:
      f[5] = _mm256_extract_epi32(v, 5);
    case 0x1f:
      f[4] = _mm256_extract_epi32(v, 4);
    case 0x0f:
      f[3] = _mm256_extract_epi32(v, 3);
    case 0x07:
      f[2] = _mm256_extract_epi32(v, 2);
    case 0x03:
      f[1] = _mm256_extract_epi32(v, 1);
    case 0x01:
      f[0] = _mm256_extract_epi32(v, 0);
      break;
    }
}

_Z7store07Dv4_xS_Pi: # @_Z7store07Dv4_xS_Pi
  vmovmskps %ymm0, %eax
  cmpl $62, %eax
  jg .LBB0_3
  decl %eax
  cmpl $30, %eax
  ja .LBB0_14
  jmpq *.LJTI0_0(,%rax,8)
.LBB0_3:
  cmpl $63, %eax
  je .LBB0_8
  cmpl $255, %eax
  je .LBB0_6
  cmpl $127, %eax
  je .LBB0_7
.LBB0_14:
  retq
.LBB0_6:
  vextractf128 $1, %ymm1, %xmm0
  vextractps $3, %xmm0, 28(%rdi)
.LBB0_7:
  vextractf128 $1, %ymm1, %xmm0
  vextractps $2, %xmm0, 24(%rdi)
.LBB0_8:
  vextractf128 $1, %ymm1, %xmm0
  vextractps $1, %xmm0, 20(%rdi)
.LBB0_9:
  vextractf128 $1, %ymm1, %xmm0
  vmovss %xmm0, 16(%rdi)
.LBB0_10:
  vextractps $3, %xmm1, 12(%rdi)
.LBB0_11:
  vextractps $2, %xmm1, 8(%rdi)
.LBB0_12:
  vextractps $1, %xmm1, 4(%rdi)
.LBB0_13:
  vmovss %xmm1, (%rdi)
  retq

Shouldn't CSE be able to hoist the repeated vextractf128 instructions out from
the switch cases?</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>