<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 - error: unknown instruction for inline asm "cvt.s.pl %0, %4\n\t""
   href="https://bugs.llvm.org/show_bug.cgi?id=38221">38221</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>error: unknown instruction for inline asm "cvt.s.pl %0, %4\n\t"
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>lesliezhai@llvm.org.cn
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi LLVM developers,

I am building OpenJDK8[1] with LLVM toolchain[2] for mips64el, it[3] failed 
to build:


/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:429:13:
error: unknown instruction
            "cvt.s.pl %0, %4\n\t"
            ^
<inline asm>:1:2: note: instantiated into assembly here
        cvt.s.pl $f0, $f0
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:429:31:
error: unknown instruction
            "cvt.s.pl %0, %4\n\t"
                              ^
<inline asm>:2:2: note: instantiated into assembly here
        cvt.s.pu $f1, $f0
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:430:31:
error: unknown instruction
            "cvt.s.pu %1, %4\n\t"
                              ^
<inline asm>:3:2: note: instantiated into assembly here
        cvt.s.pl $f2, $f1
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:431:31:
error: unknown instruction
            "cvt.s.pl %2, %5\n\t"
                              ^
<inline asm>:4:2: note: instantiated into assembly here
        cvt.s.pu $f3, $f1
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:441:37:
error: unknown instruction
                "add.s  %2, %4, %6\n\t"
                                    ^
<inline asm>:3:2: note: instantiated into assembly here
        pll.ps $f0, $f1, $f2
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:491:17:
error: unknown instruction
                "cvt.s.pu %3, %9\n\t"
                ^
<inline asm>:1:2: note: instantiated into assembly here
        cvt.s.pu $f3, $f0
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:491:35:
error: unknown instruction
                "cvt.s.pu %3, %9\n\t"
                                  ^
<inline asm>:2:2: note: instantiated into assembly here
        cvt.s.pl $f4, $f0
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:492:35:
error: unknown instruction
                "cvt.s.pl %4, %9\n\t"
                                  ^
<inline asm>:3:2: note: instantiated into assembly here
        cvt.s.pu $f5, $f1
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:493:36:
error: unknown instruction
                "cvt.s.pu %5, %10\n\t"
                                   ^
<inline asm>:4:2: note: instantiated into assembly here
        cvt.s.pl $f6, $f1
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:494:36:
error: unknown instruction
                "cvt.s.pl %6, %10\n\t"
                                   ^
<inline asm>:5:2: note: instantiated into assembly here
        cvt.s.pu $f7, $f2
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:495:36:
error: unknown instruction
                "cvt.s.pu %7, %11\n\t"
                                   ^
<inline asm>:6:2: note: instantiated into assembly here
        cvt.s.pl $f8, $f2
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:498:41:
error: unknown instruction
                "madd.s %2, %4, %6, %8\n\t"
                                        ^
<inline asm>:9:2: note: instantiated into assembly here
        pll.ps $f0, $f1, $f2
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:464:37:
error: unknown instruction
                "mul.s  %2, %4, %6\n\t"
                                    ^
<inline asm>:3:2: note: instantiated into assembly here
        pll.ps $f0, $f1, $f2
        ^
/home/loongson/jdk8-mips/hotspot/src/os_cpu/linux_mips/vm/os_linux_mips.cpp:453:37:
error: unknown instruction
                "sub.s  %2, %4, %6\n\t"
                                    ^
<inline asm>:3:2: note: instantiated into assembly here
        pll.ps $f0, $f1, $f2


But reduced testcase1 is able to work:

$ cat t.s
cvt.s.pl $f0, $f1
$ clang -c t.s -o t.o
$ file t.o
t.o: ELF 64-bit LSB relocatable, MIPS, MIPS64 rel2 version 1 (SYSV), not
stripped

And reduced testcase2 is able to work too:

$ cat t.cpp
void t() {
  float ft_upper = 6, ft_lower = 5, fs_upper = 4, fs_lower = 3;
  double ft_value = 2, fs_value = 1;
  __asm__ __volatile__ (
    "cvt.s.pl %0, %4\n\t"
    "cvt.s.pu %1, %4\n\t"
    "cvt.s.pl %2, %5\n\t"
    "cvt.s.pu %3, %5\n\t"
    : "=f" (fs_lower), "=f" (fs_upper), "=f" (ft_lower), "=f" (ft_upper)
    : "f" (fs_value), "f" (ft_value)
  );
}
$ clang++ -c t.cpp -o t.o
$ file t.o
t.o: ELF 64-bit LSB relocatable, MIPS, MIPS64 rel2 version 1 (SYSV), not
stripped


1. <a href="http://hg.loongnix.org/">http://hg.loongnix.org/</a>
2. Loongson clang version 7.0.0 (<a href="mailto:git@github.com">git@github.com</a>:Loong-Language/loong-clang.git
c36069cffc57a30a20782bf327a87bed4e48a6c2)
(<a href="mailto:git@github.com">git@github.com</a>:Loong-Language/loong-llvm.git
59cb663e72874dda740aa2b18bf47ba65b32fe9b) (based on LLVM 7.0.0svn)
Target: mips64el-redhat-linux
Thread model: posix
InstalledDir: /opt/loong-llvm/bin
Found candidate GCC installation: /usr/lib/gcc/mips64el-redhat-linux/4.9.3
Selected GCC installation: /usr/lib/gcc/mips64el-redhat-linux/4.9.3
Candidate multilib: .;
Selected multilib: .;
3. inline asm is here
<a href="http://hg.loongnix.org/jdk8-mips64-public/hotspot/file/tip/src/os_cpu/linux_mips/vm/os_linux_mips.cpp#l432">http://hg.loongnix.org/jdk8-mips64-public/hotspot/file/tip/src/os_cpu/linux_mips/vm/os_linux_mips.cpp#l432</a>
4. Also experienced other bug
<a href="http://lists.llvm.org/pipermail/llvm-dev/2018-July/124717.html">http://lists.llvm.org/pipermail/llvm-dev/2018-July/124717.html</a>


Regards,
Leslie Zhai</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>