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

    <tr>
        <th>Summary</th>
        <td>
            vectorisation of divisions gives division-by-zero
        </td>
    </tr>

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

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

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

<pre>
    The following C code crashes on x86_64 when compiled with "clang13 -O2". The resulting binary uses a divps instruction that does 4 divisions when the code only contains 2. It seems LLVM initialises the unused vector elements in the divisor with zero leading to a division-by-zero exception. Perhaps it should initialise them to one.
```
#include <fenv.h>

typedef float v4float __attribute__((vector_size(16),aligned(16)));

v4float a = { 5, 5, 5, 5 };

int main(void) {
        feenableexcept(FE_DIVBYZERO);
        a[0] /= 3;
        a[1] /= 3;
        return(0);
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx9U01r4zAQ_TXyRcTY8vfBhyZpodCly1IKuxcj22NbRZGCJCdNf_2O7JamZVkjLI1G896b0ajV_aV-moAOWkp9FmqkO9rpHmhnuJ3AUq3oa5k3eUrPEyj0HY5CQk_Pwk2UMNZJrsY4oZtHhlZIPZgBO0vnwVqhuLnQ2SISp704HS0Vyjozd04gtJu4o71Gb-q9wuKmXZkcAi1KtJIXXCnHMZIixb2jFuBg6cPD8w-EE05wKTyFj5kVsvX0BJ3ThoKEAyjnWRfvQoL7i_w3MJpK4L2X6vSqcNGwaS-bxQuvHRy91JD-BDNxrx_pJz3L_oraYx88hFYQkmhPohuSR-9jNVkiVCdnTIgkuwHUKZxIcvvuXP7ucoQeBjpIjVU5pevcNNw5I9rZQdMQVuJYc2useAO04pywirAdChkV9J87y0i21xQfoBxF7CkptjTDyOsfbu6_BQnl6AGL75m1QILKR64--v4NAIq3EtZ64cm722Z__7z9_ef21-O1jo8ATrJtRDIUwe68luSfJ-L_njDgZuNlRV8yxQS-3kDQ10lfJRUPnHAS6rV-wvKlB_Vw1XqjOGEffW-DYDaynpw7WpLceDnsbsQGmtsQ3wMaUp4-ps3R6BfER1NYO4PFRZaxvAimOuc5T8uYV0UBZVsyKCvgUZGlcVbFSQGB5C1IW2Pi-JYUnOkCgWssQyBqFjEWZVEaJ1kRp2FZlEnCCoizaOjasiRpBHhPMvQ6Qm3GwNSLpHYeLTqxUZ39dHJrfcPAQof4fHaTNvWTeJE7rS1CKRssAuolgb-uzEpB">