<html>
    <head>
      <base href="http://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 --- - Incorrect assembly around 'div' instruction on x86-64"
   href="http://llvm.org/bugs/show_bug.cgi?id=16105">16105</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect assembly around 'div' instruction on x86-64
          </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>andrew.macp@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In LLVM 3.3 from subversion (currently rev 182439) passing the following IR
into "lli -O0" prints an invalid character, whereas with -O1 or above or with
any opt level in LLVM 3.2 the number '9' is correctly output (followed by some
junk):

define void @main() {
entry:
  %a = call i8* @malloc(i32 2)
  %acast = bitcast i8* %a to [0 x i8]*
  %elemptr = getelementptr inbounds [0 x i8]* %acast, i32 0, i32 0

  ; input is here (9)
  %y = urem i8 9, 10

  %z = add i8 48, %y
  store i8 %z, i8* %elemptr

  call void @printf(i8* %elemptr)
  ret void
}

declare void @printf(i8*)
declare i8* @malloc(i32)

Dumping the assembly using "llc -O0" (3.3) and then passing that assembly to
gcc results in the following error:

file.s:22: Error: can't encode register '%ah' in an instruction requiring REX
prefix.</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>