<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 - Missed opportunity for store narrowing"
   href="https://bugs.llvm.org/show_bug.cgi?id=35127">35127</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missed opportunity for store narrowing
          </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>enhancement
          </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>listmail@philipreames.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following test cases store a vector with only one element defined.  We
should be able to use narrower stores to only update the defined bytes and
leave the other bytes undefined.  

define void @store_anyext_i32(<2 x i32>* %p, i32 %v) {
  %vec = insertelement <2 x i32> undef, i32 %v, i32 0
  store <2 x i32> %vec, <2 x i32>* %p
  ret void
}

define void @store_anyext_i16(<4 x i16>* %p, i16 %v) {
  %vec = insertelement <4 x i16> undef, i16 %v, i32 0
  store <4 x i16> %vec, <4 x i16>* %p
  ret void
}

define void @store_anyext_i8(<8 x i8>* %p, i8 %v) {
  %vec = insertelement <8 x i8> undef, i8 %v, i32 0
  store <8 x i8> %vec, <8 x i8>* %p
  ret void
}

Today, these produce:
        .text
        .file   "<stdin>"
        .globl  store_anyext_i32        # -- Begin function store_anyext_i32
        .p2align        4, 0x90
        .type   store_anyext_i32,@function
store_anyext_i32:                       # @store_anyext_i32
        .cfi_startproc
# BB#0:
        movd    %esi, %xmm0
        movq    %xmm0, (%rdi)
        retq
.Lfunc_end0:
        .size   store_anyext_i32, .Lfunc_end0-store_anyext_i32
        .cfi_endproc
                                        # -- End function
        .globl  store_anyext_i16        # -- Begin function store_anyext_i16
        .p2align        4, 0x90
        .type   store_anyext_i16,@function
store_anyext_i16:                       # @store_anyext_i16
        .cfi_startproc
# BB#0:
        movd    %esi, %xmm0
        pxor    %xmm1, %xmm1
        punpcklwd       %xmm1, %xmm0    # xmm0 =
xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
        punpckldq       %xmm1, %xmm0    # xmm0 =
xmm0[0],xmm1[0],xmm0[1],xmm1[1]
        movq    %xmm0, (%rdi)
        retq
.Lfunc_end1:
        .size   store_anyext_i16, .Lfunc_end1-store_anyext_i16
        .cfi_endproc
                                        # -- End function
        .globl  store_anyext_i8         # -- Begin function store_anyext_i8
        .p2align        4, 0x90
        .type   store_anyext_i8,@function
store_anyext_i8:                        # @store_anyext_i8
        .cfi_startproc
# BB#0:
        movd    %esi, %xmm0
        movq    %xmm0, (%rdi)
        retq
.Lfunc_end2:
        .size   store_anyext_i8, .Lfunc_end2-store_anyext_i8
        .cfi_endproc
                                        # -- End function

        .section        ".note.GNU-stack","",@progbits

I came up with these while trying to write test cases for an issue around
store(anyext) noticed in an unrelated patch, but looking through the isel debug
output, this looks to be something else.  (Possibly a problem with build_vector
canonicalization?)</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>