From 8d0246a9269b60f2309d0fe3ace3aa2b3f4e6d07 Mon Sep 17 00:00:00 2001 From: Han-Kuan Chen Date: Mon, 17 Oct 2022 21:39:20 -0700 Subject: [PATCH] [RISCV] Pre-commit tests for lowering VECTOR_SHUFFLE to VSLIDEDOWN_VL. Differential Revision: https://reviews.llvm.org/D136135 --- .../CodeGen/RISCV/rvv/fixed-vectors-fp-shuffles.ll | 48 ++++++++++++++++++++++ .../RISCV/rvv/fixed-vectors-int-shuffles.ll | 48 ++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-shuffles.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-shuffles.ll index 987d14c..20f9663 100644 --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-shuffles.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-shuffles.ll @@ -226,6 +226,54 @@ define <4 x double> @vrgather_shuffle_vx_v4f64(<4 x double> %x) { ret <4 x double> %s } +define <4 x half> @shuffle_v8f16_to_vslidedown_1(<8 x half> %x) { +; CHECK-LABEL: shuffle_v8f16_to_vslidedown_1: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 3, e16, mf2, ta, ma +; CHECK-NEXT: vslidedown.vi v9, v8, 1 +; CHECK-NEXT: vsetivli zero, 4, e16, m1, ta, ma +; CHECK-NEXT: vslidedown.vi v8, v8, 4 +; CHECK-NEXT: vsetivli zero, 4, e16, mf2, tu, ma +; CHECK-NEXT: vslideup.vi v9, v8, 3 +; CHECK-NEXT: vmv1r.v v8, v9 +; CHECK-NEXT: ret +entry: + %s = shufflevector <8 x half> %x, <8 x half> poison, <4 x i32> + ret <4 x half> %s +} + +define <4 x half> @shuffle_v8f16_to_vslidedown_3(<8 x half> %x) { +; CHECK-LABEL: shuffle_v8f16_to_vslidedown_3: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 1, e16, mf2, ta, ma +; CHECK-NEXT: vslidedown.vi v9, v8, 3 +; CHECK-NEXT: vsetivli zero, 4, e16, m1, ta, ma +; CHECK-NEXT: vslidedown.vi v8, v8, 4 +; CHECK-NEXT: vsetivli zero, 4, e16, mf2, tu, ma +; CHECK-NEXT: vslideup.vi v9, v8, 1 +; CHECK-NEXT: vmv1r.v v8, v9 +; CHECK-NEXT: ret +entry: + %s = shufflevector <8 x half> %x, <8 x half> poison, <4 x i32> + ret <4 x half> %s +} + +define <2 x float> @shuffle_v4f32_to_vslidedown(<4 x float> %x) { +; CHECK-LABEL: shuffle_v4f32_to_vslidedown: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma +; CHECK-NEXT: vslidedown.vi v9, v8, 1 +; CHECK-NEXT: vsetivli zero, 2, e32, m1, ta, ma +; CHECK-NEXT: vslidedown.vi v8, v8, 2 +; CHECK-NEXT: vsetivli zero, 2, e32, mf2, tu, ma +; CHECK-NEXT: vslideup.vi v9, v8, 1 +; CHECK-NEXT: vmv1r.v v8, v9 +; CHECK-NEXT: ret +entry: + %s = shufflevector <4 x float> %x, <4 x float> poison, <2 x i32> + ret <2 x float> %s +} + define <4 x half> @slidedown_v4f16(<4 x half> %x) { ; CHECK-LABEL: slidedown_v4f16: ; CHECK: # %bb.0: diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll index 5b37ab1..ebe4352 100644 --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll @@ -292,6 +292,54 @@ define <8 x i64> @vrgather_shuffle_vx_v8i64(<8 x i64> %x) { ret <8 x i64> %s } +define <4 x i16> @shuffle_v8i16_to_vslidedown_1(<8 x i16> %x) { +; CHECK-LABEL: shuffle_v8i16_to_vslidedown_1: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 3, e16, mf2, ta, ma +; CHECK-NEXT: vslidedown.vi v9, v8, 1 +; CHECK-NEXT: vsetivli zero, 4, e16, m1, ta, ma +; CHECK-NEXT: vslidedown.vi v8, v8, 4 +; CHECK-NEXT: vsetivli zero, 4, e16, mf2, tu, ma +; CHECK-NEXT: vslideup.vi v9, v8, 3 +; CHECK-NEXT: vmv1r.v v8, v9 +; CHECK-NEXT: ret +entry: + %s = shufflevector <8 x i16> %x, <8 x i16> poison, <4 x i32> + ret <4 x i16> %s +} + +define <4 x i16> @shuffle_v8i16_to_vslidedown_3(<8 x i16> %x) { +; CHECK-LABEL: shuffle_v8i16_to_vslidedown_3: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 1, e16, mf2, ta, ma +; CHECK-NEXT: vslidedown.vi v9, v8, 3 +; CHECK-NEXT: vsetivli zero, 4, e16, m1, ta, ma +; CHECK-NEXT: vslidedown.vi v8, v8, 4 +; CHECK-NEXT: vsetivli zero, 4, e16, mf2, tu, ma +; CHECK-NEXT: vslideup.vi v9, v8, 1 +; CHECK-NEXT: vmv1r.v v8, v9 +; CHECK-NEXT: ret +entry: + %s = shufflevector <8 x i16> %x, <8 x i16> poison, <4 x i32> + ret <4 x i16> %s +} + +define <2 x i32> @shuffle_v4i32_to_vslidedown(<4 x i32> %x) { +; CHECK-LABEL: shuffle_v4i32_to_vslidedown: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma +; CHECK-NEXT: vslidedown.vi v9, v8, 1 +; CHECK-NEXT: vsetivli zero, 2, e32, m1, ta, ma +; CHECK-NEXT: vslidedown.vi v8, v8, 2 +; CHECK-NEXT: vsetivli zero, 2, e32, mf2, tu, ma +; CHECK-NEXT: vslideup.vi v9, v8, 1 +; CHECK-NEXT: vmv1r.v v8, v9 +; CHECK-NEXT: ret +entry: + %s = shufflevector <4 x i32> %x, <4 x i32> poison, <2 x i32> + ret <2 x i32> %s +} + define <4 x i8> @interleave_shuffles(<4 x i8> %x) { ; CHECK-LABEL: interleave_shuffles: ; CHECK: # %bb.0: -- 2.7.4