<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 --- - PowerPC64: fast isel issue with 16 bit signed constant"
   href="https://llvm.org/bugs/show_bug.cgi?id=27721">27721</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>PowerPC64: fast isel issue with 16 bit signed constant
          </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: PowerPC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>anton@samba.org
          </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>I'm seeing issues with the following test case:

unsigned int k = 1;
unsigned int i;

float h;
float *j = &h;

void foo(void)
{
        unsigned short m = 0;

        if (k) {
                m = 46334;
                k = 3;
        }

        i;

        for (;;) {
                *j = m;
                if (m)
                        break;
        }
}

The constant is created as expected at -O1:

clang -O1 -fno-strict-aliasing

    lis 5, 0
    ori 3, 5, 46334
    mtvsrwz 0, 3

But if we enable fast isel, we end up with a sign extended constant:

clang -O1 -fno-strict-aliasing -mllvm -fast-isel

    li 3, -19202
    mtvsrwz 0, 3</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>