<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 --- - [AMDGPU] error in backend: Cannot select: t18: i32 = addrspacecast[2 -> 0] t24"
   href="https://llvm.org/bugs/show_bug.cgi?id=31918">31918</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AMDGPU] error in backend: Cannot select: t18: i32 = addrspacecast[2 -> 0] t24
          </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: AMDGPU
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>vedran@miletic.net
          </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>The following code:

#pragma OPENCL EXTENSION cl_khr_fp64 : disable

__kernel void compute_4(__global int *a,
                        __global float *b)
{
        int i = 0;
        float c[2] = {1, 2};
        int j = a[i];
        b[i] = c[j];
}

compiled using:

$ clang -Dcl_clang_storage_class_specifiers -isystem libclc/generic/include
-include clc/clc.h -target amdgcn-mesa-mesa3d -xcl asl.cl -cl-std=CL1.1 -o
asl.s

results in:

fatal error: error in backend: Cannot select: t18: i32 = addrspacecast[2 -> 0]
t24
  t24: i64 = add t16, t35
    t16: i64 = shl t29, Constant:i32<2>
      t29: i64 = sign_extend t28
        t28: i32,ch = load<LD4[%0(addrspace=1)](tbaa=<0x29090a8>)> t11, t33,
undef:i64
          t33: i64 = bitcast t32
            t32: v2i32,ch =
load<LD8[undef(addrspace=2)](nontemporal)(dereferenceable)(invariant)> t0, t2,
undef:i64
              t2: i64,ch = CopyFromReg t0, Register:i64 %vreg1
                t1: i64 = Register %vreg1
              t4: i64 = undef
          t4: i64 = undef
      t27: i32 = Constant<2>
    t35: i64 = PC_ADD_REL_OFFSET TargetGlobalAddress:i32<[2 x float]
addrspace(2)* @compute_4.c> + 4, TargetGlobalAddress:i32<[2 x float]
addrspace(2)* @compute_4.c> + 4
      t34: i32 = TargetGlobalAddress<[2 x float] addrspace(2)* @compute_4.c> +
4
      t34: i32 = TargetGlobalAddress<[2 x float] addrspace(2)* @compute_4.c> +
4
In function: compute_4
clang-5.0: error: clang frontend command failed with exit code 70 (use -v to
see invocation)
clang version 5.0.0 (<a href="https://github.com/llvm-mirror/clang.git">https://github.com/llvm-mirror/clang.git</a>
5808201fb358e2bf282226490e74eb74b867aee8)
(<a href="https://github.com/llvm-mirror/llvm.git">https://github.com/llvm-mirror/llvm.git</a>
66a342c211a22d9214300986cc2c09957affcfab)
Target: amdgcn-mesa-mesa3d
Thread model: posix
InstalledDir: /usr/local/bin</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>