<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 - [AVX] masked store for <3 x i32> triggers an assertion"
   href="https://bugs.llvm.org/show_bug.cgi?id=38436">38436</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AVX] masked store for <3 x i32> triggers an assertion
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>6.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>gideon.smeding@3ds.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider the following bitcode:

declare void @llvm.masked.store.v3i32(<3 x i32>, <3 x i32>*, i32, <3 x i1>)

define void @use_masked_store(<3 x i32> %v, <3 x i32>* %p, <3 x i1> %mask) {
    call void @llvm.masked.store.v3i32(<3 x i32> %v, <3 x i32>* %p, i32 16, <3
x i1> %mask)
    ret void
}

While this compiles without fault for sse targets, i.e., 

$ llc -mattr=+sse2 /tmp/llvm_masked_store_bug.bc

runs perfectly, it bails out for avx:

$ llc -mattr=+avx /tmp/llvm_masked_store_bug.bc

with the following assertion:

llc:
/home/gideon/Sources/artifact_builder.git/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:3560:
llvm::SDValue llvm::DAGTypeLegalizer::WidenVecOp_MSTORE(llvm::SDNode*, unsigned
int): Assertion `OpNo == 3 && "Can widen only data operand of mstore"' failed.
#0 0x000000000150e64a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x150e64a)
#1 0x000000000150c77e llvm::sys::RunSignalHandlers()
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x150c77e)
#2 0x000000000150c8f4 SignalHandler(int)
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x150c8f4)
#3 0x00007feb041f1390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007feb03375428 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35428)
#5 0x00007feb0337702a abort (/lib/x86_64-linux-gnu/libc.so.6+0x3702a)
#6 0x00007feb0336dbd7 (/lib/x86_64-linux-gnu/libc.so.6+0x2dbd7)
#7 0x00007feb0336dc82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x0000000001441ebc llvm::DAGTypeLegalizer::WidenVecOp_MSTORE(llvm::SDNode*,
unsigned int)
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x1441ebc)
#9 0x00000000014442e5 llvm::DAGTypeLegalizer::WidenVectorOperand(llvm::SDNode*,
unsigned int)
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x14442e5)
#10 0x000000000141977e llvm::DAGTypeLegalizer::run()
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x141977e)
#11 0x000000000141a448 llvm::SelectionDAG::LegalizeTypes()
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x141a448)
#12 0x00000000013d5939 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x13d5939)
#13 0x00000000013df21b
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x13df21b)
#14 0x00000000013e158e
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) [clone
.part.1172]
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x13e158e)
#15 0x00000000007a05e4 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x7a05e4)
#16 0x0000000000c68275
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0xc68275)
#17 0x0000000000f9eae3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0xf9eae3)
#18 0x0000000000f9eb9c llvm::FPPassManager::runOnModule(llvm::Module&)
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0xf9eb9c)
#19 0x0000000000f9f44a llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0xf9f44a)
#20 0x000000000071e87a compileModule(char**, llvm::LLVMContext&)
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x71e87a)
#21 0x00000000006db83c main
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x6db83c)
#22 0x00007feb03360830 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20830)
#23 0x0000000000712859 _start
(/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc+0x712859)
Stack dump:
0.      Program arguments:
/tmp/artifactory/llvm-linux64-centos60-6.0.1-ocaml4.06-3/bin/llc -mattr=+avx
/tmp/llvm_masked_store_bug.bc
1.      Running pass 'Function Pass Manager' on module
'/tmp/llvm_masked_store_bug.bc'.
2.      Running pass 'X86 DAG->DAG Instruction Selection' on function
'@use_masked_store'
Aborted (core dumped)

This is a regression w.r.t llvm 4.0.1</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>