<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 - Crash when building Linux kernel's AMDGPU driver for powerpc64le"
   href="https://bugs.llvm.org/show_bug.cgi?id=45297">45297</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash when building Linux kernel's AMDGPU driver for powerpc64le
          </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>natechancellor@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, nemanja.i.ibm@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Building Fedora's powerpc64le config crashes in the AMDGPU driver.

$ curl -LSs
<a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-5.6-rc7.tar.gz">https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-5.6-rc7.tar.gz</a>
| tar xzf -

$ cd linux-5.6-rc7

$ curl -LSso .config
'<a href="https://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git/plain/fedora/configs/kernel-5.6.0-ppc64le.config?h=kernel-5.6.0-0.rc7.git0.2.fc32">https://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git/plain/fedora/configs/kernel-5.6.0-ppc64le.config?h=kernel-5.6.0-0.rc7.git0.2.fc32</a>'

$ make -j$(nproc) -s ARCH=powerpc CC=clang CROSS_COMPILE=powerpc64le-linux-gnu-
olddefconfig drivers/gpu/drm/amd/amdgpu/
fatal error: error in backend: Cannot select: 0x89ef540: ch =
PPCISD::ST_VSR_SCAL_INT<(store 4 into %ir.1463)> 0x89dd638:1, 0x89eed88,
0x89e44b0, Constant:i64<4>, ValueType:ch:i32,
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1126:39
  0x89eed88: f64 = PPCISD::FP_TO_SINT_IN_VSR 0x89f4a40,
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1126:39
    0x89f4a40: f64 = fp_extend 0x89f1560,
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1126:39
      0x89f1560: f32 = fdiv 0x89f8c88, 0x89dd2f8,
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1126:69
        0x89f8c88: f32 = fmul 0x89ef268, 0x89f5128,
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1126:59
          0x89ef268: f32,ch = CopyFromReg 0x8570c28, Register:f32 %114,
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1126:59
            0x89f33e0: f32 = Register %114
          0x89f5128: f32,ch = load<(load 4 from constant-pool)> 0x8570c28,
0x89f0fb0, undef:i64
            0x89f0fb0: i64,ch = PPCISD::TOC_ENTRY<(load 8 from got)>
TargetConstantPool:i64<float 1.000000e+06> 0, Register:i64 $x2
              0x89f4b78: i64 = TargetConstantPool<float 1.000000e+06> 0
              0x89f2f00: i64 = Register $x2
            0x89d9ee8: i64 = undef
        0x89dd2f8: f32 = fmul 0x89dd638, 0x89f9168,
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1127:38
          0x89dd638: f32,ch = load<(load 4 from %ir.1458)> 0x89e9ac8,
0x89f2bc0, undef:i64,
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1127:43
            0x89f2bc0: i64 = add nuw 0x89ef748, Constant:i64<62104>,
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1127:43
              0x89ef748: i64,ch = CopyFromReg 0x8570c28, Register:i64 %177,
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1115:7
                0x89e2220: i64 = Register %177
              0x89dd910: i64 = Constant<62104>
            0x89d9ee8: i64 = undef
          0x89f9168: f32,ch = load<(load 4 from constant-pool)> 0x8570c28,
0x89f8cf0, undef:i64
            0x89f8cf0: i64,ch = PPCISD::TOC_ENTRY<(load 8 from got)>
TargetConstantPool:i64<float 1.600000e+01> 0, Register:i64 $x2
              0x89f1838: i64 = TargetConstantPool<float 1.600000e+01> 0
              0x89f2f00: i64 = Register $x2
            0x89d9ee8: i64 = undef
  0x89e44b0: i64 = add 0x89ef748, Constant:i64<7644>,
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1126:30
    0x89ef748: i64,ch = CopyFromReg 0x8570c28, Register:i64 %177,
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1115:7
      0x89e2220: i64 = Register %177
    0x89f1288: i64 = Constant<7644>
  0x89f9648: i64 = Constant<4>
In function: dcn_validate_bandwidth
clang-11: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
ClangBuiltLinux clang version 11.0.0 (git://github.com/llvm/llvm-project
ae37e2285d233f28217e4e95a3ff71059c7ee8c7)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/nathan/cbl/toolchains/llvm-tot/bin
clang-11: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang-11: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/dcn_calcs-42bba4.c
clang-11: note: diagnostic msg: /tmp/dcn_calcs-42bba4.sh
clang-11: note: diagnostic msg:

********************
make[5]: *** [scripts/Makefile.build:268:
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.o] Error 70
make[5]: *** Waiting for unfinished jobs....

creduce spits out with the linked interestingness test from the full
preprocessed source:

float a;
int b;
void c() { b = a; }

<a href="https://github.com/nathanchance/creduce-files/blob/05085a2632d31a4f44ab4434dbbe1f21e9d19ef4/fedora-ppc64le-amdgpu/test.sh">https://github.com/nathanchance/creduce-files/blob/05085a2632d31a4f44ab4434dbbe1f21e9d19ef4/fedora-ppc64le-amdgpu/test.sh</a>

<a href="https://github.com/nathanchance/creduce-files/blob/05085a2632d31a4f44ab4434dbbe1f21e9d19ef4/fedora-ppc64le-amdgpu/dcn_calcs.i.orig">https://github.com/nathanchance/creduce-files/blob/05085a2632d31a4f44ab4434dbbe1f21e9d19ef4/fedora-ppc64le-amdgpu/dcn_calcs.i.orig</a>

I can reproduce this back to LLVM 8.0.1 so does not seem like a recent
regression.</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>