<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64460>64460</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`LLVM ERROR: Cannot select: t391: v16f32 = fp_extend t442` where ` t442: v16bf16`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
phoebewang
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
joker-eph
</td>
</tr>
</table>
<pre>
```
LLVM ERROR: Cannot select: t391: v16f32 = fp_extend t442
t442: v16bf16,ch = load<(load (s256) from %stack.1 + 32)> t438, t624, undef:i64
t624: i64 = or FrameIndex:i64<1>, Constant:i64<32>
t437: i64 = FrameIndex<1>
t440: i64 = Constant<32>
t15: i64 = undef
In function: dump_vec
```
Here is the input to SelectionDag from a debug log:
```
[LowerAMXTYpe][combineAMXcast] IR dump after optimizeAMXCastFromPhi:
define void @dump_vec(ptr %0) {
%2 = call { ptr, ptr, i64, [1 x i64], [1 x i64] } @sparseValuesBF16(ptr %0)
%3 = extractvalue { ptr, ptr, i64, [1 x i64], [1 x i64] } %2, 3, 0
%4 = trunc i64 %3 to i32
%5 = insertelement <32 x i32> undef, i32 %4, i32 0
%6 = shufflevector <32 x i32> %5, <32 x i32> undef, <32 x i32> zeroinitializer
%7 = icmp sgt <32 x i32> %6, <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
%8 = extractvalue { ptr, ptr, i64, [1 x i64], [1 x i64] } %2, 1
%9 = getelementptr bfloat, ptr %8, i64 0
%10 = call <32 x bfloat> @llvm.masked.load.v32bf16.p0(ptr %9, i32 2, <32 x i1> %7, <32 x bfloat> <bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80, bfloat 0xRBF80>)
%11 = fpext <32 x bfloat> %10 to <32 x float>
call void @printOpen()
%12 = extractelement <32 x float> %11, i64 0
call void @printF32(float %12)
call void @printComma()
%13 = extractelement <32 x float> %11, i64 1
call void @printF32(float %13)
call void @printComma()
%14 = extractelement <32 x float> %11, i64 2
call void @printF32(float %14)
call void @printComma()
%15 = extractelement <32 x float> %11, i64 3
call void @printF32(float %15)
call void @printComma()
%16 = extractelement <32 x float> %11, i64 4
call void @printF32(float %16)
call void @printComma()
%17 = extractelement <32 x float> %11, i64 5
call void @printF32(float %17)
call void @printComma()
%18 = extractelement <32 x float> %11, i64 6
call void @printF32(float %18)
call void @printComma()
%19 = extractelement <32 x float> %11, i64 7
call void @printF32(float %19)
call void @printComma()
%20 = extractelement <32 x float> %11, i64 8
call void @printF32(float %20)
call void @printComma()
%21 = extractelement <32 x float> %11, i64 9
call void @printF32(float %21)
call void @printComma()
%22 = extractelement <32 x float> %11, i64 10
call void @printF32(float %22)
call void @printComma()
%23 = extractelement <32 x float> %11, i64 11
call void @printF32(float %23)
call void @printComma()
%24 = extractelement <32 x float> %11, i64 12
call void @printF32(float %24)
call void @printComma()
%25 = extractelement <32 x float> %11, i64 13
call void @printF32(float %25)
call void @printComma()
%26 = extractelement <32 x float> %11, i64 14
call void @printF32(float %26)
call void @printComma()
%27 = extractelement <32 x float> %11, i64 15
call void @printF32(float %27)
call void @printComma()
%28 = extractelement <32 x float> %11, i64 16
call void @printF32(float %28)
call void @printComma()
%29 = extractelement <32 x float> %11, i64 17
call void @printF32(float %29)
call void @printComma()
%30 = extractelement <32 x float> %11, i64 18
call void @printF32(float %30)
call void @printComma()
%31 = extractelement <32 x float> %11, i64 19
call void @printF32(float %31)
call void @printComma()
%32 = extractelement <32 x float> %11, i64 20
call void @printF32(float %32)
call void @printComma()
%33 = extractelement <32 x float> %11, i64 21
call void @printF32(float %33)
call void @printComma()
%34 = extractelement <32 x float> %11, i64 22
call void @printF32(float %34)
call void @printComma()
%35 = extractelement <32 x float> %11, i64 23
call void @printF32(float %35)
call void @printComma()
%36 = extractelement <32 x float> %11, i64 24
call void @printF32(float %36)
call void @printComma()
%37 = extractelement <32 x float> %11, i64 25
call void @printF32(float %37)
call void @printComma()
%38 = extractelement <32 x float> %11, i64 26
call void @printF32(float %38)
call void @printComma()
%39 = extractelement <32 x float> %11, i64 27
call void @printF32(float %39)
call void @printComma()
%40 = extractelement <32 x float> %11, i64 28
call void @printF32(float %40)
call void @printComma()
%41 = extractelement <32 x float> %11, i64 29
call void @printF32(float %41)
call void @printComma()
%42 = extractelement <32 x float> %11, i64 30
call void @printF32(float %42)
call void @printComma()
%43 = extractelement <32 x float> %11, i64 31
call void @printF32(float %43)
call void @printClose()
call void @printNewline()
ret void
}
```
Reproduce with the attached test running ` bin/llc /tmp/test.ll -mtriple=x86_64-unknown-linux-gnu -mcpu="znver4"`
[test.ll.txt](https://github.com/llvm/llvm-project/files/12266273/test.ll.txt)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsmV2Pmz4Wxj-Nc2NNZB8bh1zkIi-NtlK7Xc2uqu5V5YBJ3AGDwGSy8-lXNoFhMrstcfW_qzQCDz6c57F9_AMF2TT6aJRaoWiDAKpTqQ7qWZojAkDRbiZbeyrr1Y_ySdUPqjrNDmX6nxUS5P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