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

    <tr>
        <th>Summary</th>
        <td>
            Assertion `"Value is not an N-bit unsigned value"` when compiling compiler-rt `fixsfsi.c` for `armv8.1m.main-none-eabi`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            compiler-rt,
            llvm
      </td>
    </tr>

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

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

<pre>
    I'm hitting the following assertion when compiling compiler-rt [fixsfsi.c](https://github.com/llvm/llvm-project/blob/3d57c79728968e291df4929b377b3580d16af7b9/compiler-rt/lib/builtins/fixsfsi.c) for `armv8.1m.main-none-eabi`:

```
/usr/local/google/home/phosek/llvm/llvm-project/build/baremetal/bin/clang --target=armv8.1m.main-none-eabi -DVISIBILITY_HIDDEN --target=armv8.1m.main-none-eabi -mthumb -mfloat-abi=hard -march=armv8.1-m.main+mve.fp -mcpu=cortex-m55 -Os -DNDEBUG -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -DCOMPILER_RT_HAS_FLOAT16 -MD -MT CMakeFiles/clang_rt.builtins-armv8.1m.main.dir/fixsfsi.c.obj -MF CMakeFiles/clang_rt.builtins-armv8.1m.main.dir/fixsfsi.c.obj.d -o CMakeFiles/clang_rt.builtins-armv8.1m.main.dir/fixsfsi.c.obj -c /usr/local/google/home/phosek/llvm/llvm-project/compiler-rt/lib/builtins/fixsfsi.c
clang: llvm/include/llvm/ADT/APInt.h:128: llvm::APInt::APInt(unsigned int, uint64_t, bool, bool): Assertion `llvm::isUIntN(BitWidth, val) && "Value is not an N-bit unsigned value"' failed.
```

The generated reproducer is attached: [fixsfsi-3d3448.zip](https://github.com/user-attachments/files/17770869/fixsfsi-3d3448.zip)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llv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