<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 - ppc64le MC assembler does not recognize symbols in certain instructions"
   href="https://bugs.llvm.org/show_bug.cgi?id=45154">45154</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ppc64le MC assembler does not recognize symbols in certain instructions
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </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>C
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>code.optimizer@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given the following pruned down assembly source generated from XLC:
[dparks@gsn1 tmp]$ cat t.s
.set r0,0; .set SP,1; .set RTOC,2; .set r3,3; .set r4,4
.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
.set fp0,0; .set fp1,1; .set fp2,2; .set fp3,3; .set fp4,4
.set BO_ALWAYS,20; .set BO_ALWAYS_1,21; .set BO_ALWAYS_2,22
.set CR0_LT,0; .set CR0_GT,1; .set CR0_EQ,2; .set CR0_SO,3

        .file   "t.c"
        .globl  f
        .type   f,@function
        .size   f,40
        .localentry     f,8
        .extern .TOC.

        .section        ".text","ax"
        .align  5
.LC.The_Code:
f:
        addis      RTOC,r12,.TOC.-$@ha
        addi       RTOC,RTOC,.TOC.-$+4@l
        addis      r3,RTOC,.LC.toc@toc@ha
        ld         r3,.LC.toc@toc@l(r3)
        lfd        fp1,0(r3)
        bclr       BO_ALWAYS,CR0_LT

        .section        ".toc","wa"
        .align  3
.LC.toc:
        .tc d[TC],d

        .ident  "Mon Mar  9 08:34:47 2020 .IBM XL C/C++ for Linux, Version
16.1.1.3."

        .comm   d,8,8
[dparks@gsn1 tmp]$

The source assembles correctly with both xlc and gcc:
[dparks@gsn1 tmp]$ xlc --version
IBM XL C/C++ for Linux, V16.1.1 (Community Edition)
<snip>
[dparks@gsn1 tmp]$ xlc -c t.s
[dparks@gsn1 tmp]$ gcc --version
gcc (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[dparks@gsn1 tmp]$ gcc -c t.s
[dparks@gsn1 tmp]$ 


But fails with the following errors when assembled with clang:
[dparks@gsn1 tmp]$ /home/sw/thirdparty/llvm/linuxpower/9.0-openmp/bin/clang
--version
clang version 9.0.0 (/home/<DELETED>/git/official/llvm/tools/clang
45898f3be1d37727502cd6342b14c19e7c94bfae) (/home/<DELETED>/git/official/llvm
5364ee5faec778f1ddf86b6b4b8452df7db191c5)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/sw/thirdparty/llvm/linuxpower/9.0-openmp/bin
[dparks@gsn1 tmp]$ 

[dparks@gsn1 tmp]$ /home/sw/thirdparty/llvm/linuxpower/9.0-openmp/bin/clang -c
t.s
t.s:22:30: error: invalid memory operand
        ld         r3,.LC.toc@toc@l(r3)
                                    ^
t.s:23:19: error: invalid memory operand
        lfd        fp1,0(r3)
                         ^
[dparks@gsn1 tmp]$


I've also run in to the same problem with store instructions.</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>