[llvm] [LoongArch] Custom lower vector trunc to vector shuffle (PR #130938)

via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 13 19:05:00 PDT 2025


================
@@ -23,16 +18,12 @@ define void @load_trunc_2i64_to_2i32(ptr %ptr, ptr %dst) nounwind {
 define void @load_trunc_2i64_to_2i16(ptr %ptr, ptr %dst) nounwind {
 ; CHECK-LABEL: load_trunc_2i64_to_2i16:
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    addi.d $sp, $sp, -16
 ; CHECK-NEXT:    vld $vr0, $a0, 0
-; CHECK-NEXT:    vpickve2gr.d $a0, $vr0, 1
-; CHECK-NEXT:    st.h $a0, $sp, 2
-; CHECK-NEXT:    vpickve2gr.d $a0, $vr0, 0
-; CHECK-NEXT:    st.h $a0, $sp, 0
-; CHECK-NEXT:    vld $vr0, $sp, 0
-; CHECK-NEXT:    vpickve2gr.w $a0, $vr0, 0
+; CHECK-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI1_0)
----------------
tangaac wrote:

Yes, it's a shuffle mask that can't be lowered more.
For this test, mask is

```asm
.LCPI1_0:
	.half	0                               # 0x0
	.half	4                               # 0x4
	.half	65535                           # 0xffff
	.half	65535                           # 0xffff
	.half	65535                           # 0xffff
	.half	65535                           # 0xffff
	.half	65535                           # 0xffff
	.half	65535                           # 0xffff

```


https://github.com/llvm/llvm-project/pull/130938


More information about the llvm-commits mailing list