<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Mips64: Missing sign extension when operand for truncate instruction is in another basic block."
   href="https://llvm.org/bugs/show_bug.cgi?id=27421">27421</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Mips64: Missing sign extension when operand for truncate instruction is in another basic block.
          </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>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>Backend: MIPS
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>Vasileios.Kalintiris@imgtec.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Test case for this problem :

define i64 @foo1(i64 zeroext %var) {
entry:
  %shr = lshr i64 %var, 32
  %cmp = icmp eq i64 %shr, 0
  br i1 %cmp, label %if.end6, label %if.then

if.then:                                          ; preds = %entry
  %conv = trunc i64 %shr to i32
  %cmp2 = icmp slt i32 %conv, 0
  br i1 %cmp2, label %if.then4, label %if.else

if.then4:                                         ; preds = %if.then
  %add = add i64 %var, 16
  br label %if.end6

if.else:                                          ; preds = %if.then
  %add5 = add i64 %var, 32
  br label %if.end6

if.end6:                                          ; preds = %entry, %if.then4,
%if.else
  %var.addr.0 = phi i64 [ %add, %if.then4 ], [ %add5, %if.else ], [ %var,
%entry ]
  ret i64 %var.addr.0
}

Command line:

llc  < %s -march=mips64el -mcpu=mips64r2 -o test.S</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>