<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 - [AArch64] bad codegen for bitwise logic on vector of i1"
   href="https://bugs.llvm.org/show_bug.cgi?id=34290">34290</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AArch64] bad codegen for bitwise logic on vector of i1
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>Backend: AArch64
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Taking this from:
<a href="https://reviews.llvm.org/D36213">https://reviews.llvm.org/D36213</a>
...which will canonicalize IR to the 2nd form and potentially exacerbate the
existing problem. 

define <2 x i64> @test7(<4 x float> %a, <4 x float> %b) {
  %cmp = fcmp ult <4 x float> %a, zeroinitializer
  %cmp4 = fcmp ult <4 x float> %b, zeroinitializer
  %sext = sext <4 x i1> %cmp to <4 x i32>
  %sext5 = sext <4 x i1> %cmp4 to <4 x i32>
  %and = and <4 x i32> %sext, %sext5
  %conv = bitcast <4 x i32> %and to <2 x i64>
  ret <2 x i64> %conv
}

define <2 x i64> @test7_better_IR(<4 x float> %a, <4 x float> %b) {
  %cmp = fcmp ult <4 x float> %a, zeroinitializer
  %cmp4 = fcmp ult <4 x float> %b, zeroinitializer
  %and1 = and <4 x i1> %cmp, %cmp4
  %and = sext <4 x i1> %and1 to <4 x i32>
  %conv = bitcast <4 x i32> %and to <2 x i64>
  ret <2 x i64> %conv
}

$ ./llc -o - vcmp.ll -mtriple=aarch64

test7:                       
        fcmge   v0.4s, v0.4s, #0.0
        mvn      v0.16b, v0.16b
        fcmge   v1.4s, v1.4s, #0.0
        bic     v0.16b, v0.16b, v1.16b
        ret

test7_better_IR:                    
        fcmge   v0.4s, v0.4s, #0.0
        fcmge   v1.4s, v1.4s, #0.0
        mvn      v0.16b, v0.16b
        mvn      v1.16b, v1.16b
        xtn     v0.4h, v0.4s
        xtn     v1.4h, v1.4s
        and     v0.8b, v0.8b, v1.8b
        ushll   v0.4s, v0.4h, #0
        shl     v0.4s, v0.4s, #31
        sshr    v0.4s, v0.4s, #31
        ret</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>