<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55021>55021</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Assertion in  file SelectionDAG.cpp:1454 `when trying to lower @llvm.masked.scatter on X86
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          fhahn
      </td>
    </tr>
</table>

<pre>
    `llc` triggers the following assertion for the code below: https://llvm.godbolt.org/z/jME9oYrbh

```
SelectionDAG.cpp:1454: llvm::SDValue llvm::SelectionDAG::getConstant(uint64_t, const llvm::SDLoc&, llvm::EVT, bool, bool): Assertion `(EltVT.getSizeInBits() >= 64 || (uint64_t)((int64_t)Val >> EltVT.getSizeInBits()) + 1 < 2) && "getConstant with a uint64_t value that doesn't fit in the type!"' failed
```

```
define void @crash(ptr %result, <4 x i64>* %idx.ptr, <4 x i1>* %mask.ptr) #0 {
entry:
  %idx = load <4 x i64>, <4 x i64>* %idx.ptr
  %mask = load <4 x i1>, <4 x i1>* %mask.ptr
  %0 = getelementptr inbounds [512 x double], ptr %result, <4 x i64> %idx
  call void @llvm.masked.scatter.v4f64.v4p0(<4 x double> zeroinitializer, <4 x ptr> %0, i32 0, <4 x i1> %mask)
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn writeonly
declare void @llvm.masked.scatter.v4f64.v4p0(<4 x double>, <4 x ptr>, i32 immarg, <4 x i1>) #1

attributes #0 = { "target-cpu"="skylake-avx512" }
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVU1v4zYQ_TXyZRBBoj5sHXSwY6co0J6yCNrTghLHFjc0aZBUHOfXd0jLayeb7KGALIoz8ntvPjjqjDi1SZ0p1dMdvJW7HVoHfkDYGqXMUeodcOfQemk02Wz09UYgdEj-pFjC4P3B0UPCHuhS6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