<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 - [power7] error in backend: Cannot select v16i8 = PPCISD::SCALAR_TO_VECTOR_PERMUTED"
   href="https://bugs.llvm.org/show_bug.cgi?id=50901">50901</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[power7] error in backend: Cannot select v16i8 = PPCISD::SCALAR_TO_VECTOR_PERMUTED
          </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>clang@evan.coeusgroup.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, nemanja.i.ibm@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>With -mcpu=power7 at -O1 or higher, I'm seeing an error when attempting to
assign a dereferenced pointer to an 8-bit integer to a lane of a vector. 
Reduced test case follows (or on Compiler Explorer at
<a href="https://godbolt.org/z/nsMG7cEqn">https://godbolt.org/z/nsMG7cEqn</a>):


typedef char int8_t;
typedef struct {
  int8_t i8 __attribute__((__vector_size__(16)));
} simde_v128_private;
int simde_wasm_v128_load8_lane(void *a) {
  int vec = 0, __trans_tmp_2, lane = 0;
  simde_v128_private __trans_tmp_1;
  {
    int v = vec;
    simde_v128_private r;
    __builtin_memcpy(&r, &v, sizeof(r));
    __trans_tmp_1 = r;
  }
  simde_v128_private a_ = __trans_tmp_1;
  a_.i8[lane] = *(int8_t *)a;
  simde_v128_private v = a_;
  int r;
  __builtin_memcpy(&r, &v, sizeof(r));
  __trans_tmp_2 = r;
  return r;
}


# clang --target=powerpc64le-linux-gnu -mcpu=power7 -O3 -s -o /dev/null test.c
clang-12: error: unknown argument: '-test.c'
clang-12: error: no input files
nemequ@peltast:~/t/creduce/load8_lane$ clang --target=powerpc64le-linux-gnu
-mcpu=power7 -O3 -s -o /dev/null test.c
fatal error: error in backend: Cannot select: 0x563404d58420: v16i8 =
PPCISD::SCALAR_TO_VECTOR_PERMUTED 0x563404d58078
  0x563404d58078: i32,ch = load<(load 1 from %ir.0, !tbaa !2), anyext from i8>
0x563404cd4a48, 0x563404d57e08, undef:i64
    0x563404d57e08: i64,ch = CopyFromReg 0x563404cd4a48, Register:i64 %0
      0x563404d57da0: i64 = Register %0
    0x563404d57ed8: i64 = undef
In function: simde_wasm_v128_load8_lane
clang-12: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 12.0.0 (Fedora 12.0.0-2.fc34)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-12: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-12: note: diagnostic msg: /tmp/test-6e1589.c
clang-12: note: diagnostic msg: /tmp/test-6e1589.sh
clang-12: note: diagnostic msg: 

********************
# clang --version
clang version 12.0.0 (Fedora 12.0.0-2.fc34)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin


Happens with clang 11, 12, and trunk.</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>