<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 - Code generation error with -m32 -fPIC"
   href="https://bugs.llvm.org/show_bug.cgi?id=46527">46527</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Code generation error with -m32 -fPIC
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.0
          </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>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jjorge@quarkslab.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23663" name="attach_23663" title="Reduced test case.">attachment 23663</a> <a href="attachment.cgi?id=23663&action=edit" title="Reduced test case.">[details]</a></span>
Reduced test case.

Compiling the attached IR code with the command `clang -m32 -fPIC -c
test-small.ll` produces the following error:

    llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:4524: virtual void (anonymous
namespace)::X86DAGToDAGISel::Select(llvm::SDNode *): Assertion
`Subtarget->hasSSE41() && "Expected SSE4.1 support!"' failed.

See attached file clang-10-output.log for the full message.

Clang is built from the release/10.x branch.

In my experiments I observed the following:
    - the same error occurs with Clang from the release/9.x branch, see the
attached file clang-9-output.log for the output.
    - omitting either -fPIC or -m32 prevents the errors.
    - there is no error with Clang 10 as provided by Ubuntu 20.04 unless I add
-msse2 or -msse3. See the attached file clang-10-ubuntu-output.log for the full
message. In this case the error is:

    error in backend: Cannot select: 0x13cb528: v16i8 = X86ISD::BLENDV
0x13cb250, 0x13c43f0, 0x13cb0b</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>