<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 - PowerPC64: Error selecting stbrx"
   href="https://bugs.llvm.org/show_bug.cgi?id=32140">32140</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>PowerPC64: Error selecting stbrx
          </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>enhancement
          </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>hfinkel@anl.gov, kbarton@linux.vnet.ibm.com, llvm-bugs@lists.llvm.org, nemanja.i.ibm@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following test case:

int a, b;

__attribute__((always_inline)) long d()
{
  long c = (a & 255ULL) << 56 | (a & 65280ULL) << 40 | (a & 16711680ULL) << 24
|
           (a & 4278190080) << 8 | (a & 1095216660480) >> 8 |
           (a & 280375465082880) >> 24 | (a & 71776119061217280) >> 40 |
           (a & 18374686479671623680UL) >> 56;
  return c;
}

void e(void)
{
  long f = d();
  b = f;
}

Built with:

# clang -O1 testcase.i

Hits an error:

fatal error: error in backend: Cannot select: 0x10006adf428: ch =
PPCISD::STBRX<ST4[@b](tbaa=<0x10006a29a48>)> 0x10006a79040, 0x10006adf560,
0x10006adf838, ValueType:ch:i32
  0x10006adf560: i64 = srl 0x10006adf768, Constant:i32<32>
    0x10006adf768: i64,ch =
load<LD4[@a](tbaa=<0x10006a29a48>)(dereferenceable), sext from i32>
0x10006a79040, 0x10006adf630, undef:i64
      0x10006adf630: i64,ch = PPCISD::TOC_ENTRY<LD8[GOT]>
TargetGlobalAddress:i64<i32* @a> 0, Register:i64 %X2
        0x10006adf698: i64 = TargetGlobalAddress<i32* @a> 0
        0x10006adf7d0: i64 = Register %X2
      0x10006adb8a8: i64 = undef
    0x10006adf700: i32 = Constant<32>
  0x10006adf838: i64,ch = PPCISD::TOC_ENTRY<LD8[GOT]>
TargetGlobalAddress:i64<i32* @b> 0, Register:i64 %X2
    0x10006adb910: i64 = TargetGlobalAddress<i32* @b> 0
    0x10006adf7d0: i64 = Register %X2
In function: e
clang-3.9: error: clang frontend command failed with exit code 70 (use -v to
see invocation)
clang version 5.0.0 (git://github.com/llvm-mirror/clang.git
ed642ad0782597955bdc243bf4198b0699f8834b)
(<a href="https://github.com/llvm-mirror/llvm.git">https://github.com/llvm-mirror/llvm.git</a>
ecd4d5328147dad0d399f3f88868be33adee2d69)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/anton/llvm.install/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.9: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.</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>