<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/148645>148645</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AArch64] MOVPRFX_ZZ Bad machine code: Using an undefined physical register
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
sjoerdmeijer
</td>
</tr>
</table>
<pre>
With a build with expensive checks enabled, this:
```
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "aarch64-unknown-linux-gnu"
define void @_Z4testhxhhyiPhPt(ptr %0, ptr %1, ptr %2) #0 {
entry:
br label %vector.body
vector.body: ; preds = %vector.body, %entry
%wide.vec = load <32 x i16>, ptr null, align 2
%strided.vec80 = shufflevector <32 x i16> %wide.vec, <32 x i16> poison, <16 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15, i32 17, i32 19, i32 21, i32 23, i32 25, i32 27, i32 29, i32 31>
%wide.vec81 = load <32 x i16>, ptr null, align 2
%strided.vec82 = shufflevector <32 x i16> %wide.vec81, <32 x i16> poison, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30>
%3 = zext <16 x i16> %strided.vec80 to <16 x i64>
%4 = zext <16 x i16> %strided.vec82 to <16 x i64>
%5 = udiv <16 x i64> splat (i64 1054606206927039070), %3
%6 = udiv <16 x i64> splat (i64 1054606206927039070), %4
%7 = trunc <16 x i64> %5 to <16 x i8>
%8 = trunc <16 x i64> %6 to <16 x i8>
%9 = extractelement <16 x i8> %7, i64 1
store i8 %9, ptr %0, align 1
%10 = extractelement <16 x i8> %7, i64 1
store i8 %10, ptr %1, align 1
%11 = extractelement <16 x i8> %7, i64 1
store i8 %11, ptr %2, align 1
%12 = extractelement <16 x i8> %7, i64 1
store i8 %12, ptr %0, align 1
%13 = extractelement <16 x i8> %7, i64 1
store i8 %13, ptr %1, align 1
%14 = extractelement <16 x i8> %8, i64 1
store i8 %14, ptr %0, align 1
%15 = extractelement <16 x i8> %8, i64 1
store i8 %15, ptr %1, align 1
%16 = extractelement <16 x i8> %8, i64 1
store i8 %16, ptr %0, align 1
%17 = extractelement <16 x i8> %8, i64 1
store i8 %17, ptr %1, align 1
%18 = extractelement <16 x i8> %8, i64 1
store i8 %18, ptr %0, align 1
%19 = extractelement <16 x i8> %8, i64 1
store i8 %19, ptr %1, align 1
%20 = extractelement <16 x i8> %8, i64 1
store i8 %20, ptr %0, align 1
br label %vector.body
}
attributes #0 = { "target-cpu"="grace" }
```
compiled with `llc test.ll` runs in this failure:
```
*** Bad machine code: Using an undefined physical register ***
- function: _Z4testhxhhyiPhPt
- basic block: %bb.1 vector.body (0xaaaaaf6cb9c0)
- instruction: $z20 = MOVPRFX_ZZ $z0, implicit killed $z18_z19_z20_z21
- operand 2: implicit killed $z18_z19_z20_z21
LLVM ERROR: Found 1 machine code errors.
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysV01v2zgQ_TX0hbBBDvXlgw9KU59atMhiu4teAoqiLTY0JZCU4-TXL0hbiu1u7Wy9gaEMxXnvcZ4oacSdU2sj5QKldyi9n_DeN61duB-ttPVGqh_STqq2fln8pXyDOa56pWv8HAZy10nj1FZi0Ujx5LA0vNKyRvAB-0Y5xEpE4i8jhx8pPbdr6XHNPdf8pe09RuweIwA53SBWymkHOUGsZBAPYUhPhyHKkniYqgKxsthPKZohVsZDGI0pFEIChWJq2B47_SOMlmEI8LYmb1Wn5bAezq1osmTamyfTPpupVqbfTdem32MQKWu5UkbibatqjBLy-D3x0vlm1zQv6mvz1SMoOm8xgpQESw4xPYoBwRwjYASj_A6RUhpvX_a2YVxZrHkldUjcSuFbOwsXYq99fIKVGLE73FlZu8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