<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 - [GlobalISel] i1 boolean is signed extended to -1"
   href="https://bugs.llvm.org/show_bug.cgi?id=36719">36719</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[GlobalISel] i1 boolean is signed extended to -1
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mgrang@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>echo "bool a() { return true; }" > a.cpp
clang -x c++ -target aarch64-linux-gnu a.cpp -S -o -

a:
mov     w8, #-1     <-- 1 bit boolean true becomes -1.
mov     w0, w8
ret

This bug is uncovered when GlobalISel is enabled by default at -O0:
<a href="https://reviews.llvm.org/D41362">https://reviews.llvm.org/D41362</a>

I attempted to *fix* this here: <a href="https://reviews.llvm.org/D44410">https://reviews.llvm.org/D44410</a>. But from the
comments I guess the problem is elsewhere.

Basically, an i1 is sign extended to a -1 in GlobalISel legalization. Instead,
a 1 bit boolean should be zero extended.</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>