From 6392cf331a9b7ab85f0c37b3a1468bc7f1d14a0b Mon Sep 17 00:00:00 2001 From: jacquesguan Date: Tue, 16 Aug 2022 15:45:28 +0800 Subject: [PATCH] [RISCV][test] Add pre-commit test for D131551. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D131950 --- llvm/test/CodeGen/RISCV/rvv/vadd-sdnode.ll | 73 +++++++++++++++++++++++++++++ llvm/test/CodeGen/RISCV/rvv/vand-sdnode.ll | 49 +++++++++++++++++++ llvm/test/CodeGen/RISCV/rvv/vdiv-sdnode.ll | 49 +++++++++++++++++++ llvm/test/CodeGen/RISCV/rvv/vdivu-sdnode.ll | 49 +++++++++++++++++++ llvm/test/CodeGen/RISCV/rvv/vfadd-sdnode.ll | 32 +++++++++++++ llvm/test/CodeGen/RISCV/rvv/vfdiv-sdnode.ll | 32 +++++++++++++ llvm/test/CodeGen/RISCV/rvv/vfmul-sdnode.ll | 32 +++++++++++++ llvm/test/CodeGen/RISCV/rvv/vfsub-sdnode.ll | 32 +++++++++++++ llvm/test/CodeGen/RISCV/rvv/vmaxu-sdnode.ll | 45 ++++++++++++++++++ llvm/test/CodeGen/RISCV/rvv/vminu-sdnode.ll | 51 ++++++++++++++++++++ llvm/test/CodeGen/RISCV/rvv/vmul-sdnode.ll | 50 ++++++++++++++++++++ llvm/test/CodeGen/RISCV/rvv/vor-sdnode.ll | 43 +++++++++++++++++ llvm/test/CodeGen/RISCV/rvv/vshl-sdnode.ll | 44 +++++++++++++++++ llvm/test/CodeGen/RISCV/rvv/vsra-sdnode.ll | 43 +++++++++++++++++ llvm/test/CodeGen/RISCV/rvv/vsrl-sdnode.ll | 43 +++++++++++++++++ llvm/test/CodeGen/RISCV/rvv/vsub-sdnode.ll | 44 +++++++++++++++++ llvm/test/CodeGen/RISCV/rvv/vxor-sdnode.ll | 43 +++++++++++++++++ 17 files changed, 754 insertions(+) diff --git a/llvm/test/CodeGen/RISCV/rvv/vadd-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vadd-sdnode.ll index 890972b..4e7d778 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vadd-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vadd-sdnode.ll @@ -890,3 +890,76 @@ define @vadd_xx_nxv8i64(i64 %a, i64 %b) nounwind { %v = add %splat1, %splat2 ret %v } + +define @vadd_vv_mask_nxv8i32( %va, %vb, %mask) { +; CHECK-LABEL: vadd_vv_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vadd.vv v8, v8, v12 +; CHECK-NEXT: ret + %vs = select %mask, %vb, zeroinitializer + %vc = add %va, %vs + ret %vc +} + +define @vadd_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vadd_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vadd.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = add %va, %vs + ret %vc +} + +define @vadd_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vadd_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vim v12, v12, 7, v0 +; CHECK-NEXT: vadd.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 7, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = add %va, %vs + ret %vc +} + +define @vadd_vv_mask_negative0_nxv8i32( %va, %vb, %mask) { +; CHECK-LABEL: vadd_vv_mask_negative0_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 1 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vadd.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 1, i32 0 + %one = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %vb, %one + %vc = add %va, %vs + ret %vc +} + +define @vadd_vv_mask_negative1_nxv8i32( %va, %vb, %mask) { +; CHECK-LABEL: vadd_vv_mask_negative1_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vadd.vv v8, v8, v12 +; CHECK-NEXT: vadd.vv v8, v8, v12 +; CHECK-NEXT: ret + %vs = select %mask, %vb, zeroinitializer + %vc = add %va, %vs + %vd = add %vc, %vs + ret %vd +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vand-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vand-sdnode.ll index edd644a..e856695 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vand-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vand-sdnode.ll @@ -1381,3 +1381,52 @@ define @vand_xx_nxv8i64(i64 %a, i64 %b) nounwind { %v = and %splat1, %splat2 ret %v } + +define @vand_vv_mask_nxv8i32( %va, %vb, %mask) { +; CHECK-LABEL: vand_vv_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, -1 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vand.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 -1, i32 0 + %allones = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %vb, %allones + %vc = and %va, %vs + ret %vc +} + +define @vand_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vand_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, -1 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vand.vv v8, v8, v12 +; CHECK-NEXT: ret + %head1 = insertelement poison, i32 -1, i32 0 + %allones = shufflevector %head1, poison, zeroinitializer + %head2 = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head2, poison, zeroinitializer + %vs = select %mask, %splat, %allones + %vc = and %va, %vs + ret %vc +} + +define @vand_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vand_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, -1 +; CHECK-NEXT: vmerge.vim v12, v12, 7, v0 +; CHECK-NEXT: vand.vv v8, v8, v12 +; CHECK-NEXT: ret + %head1 = insertelement poison, i32 -1, i32 0 + %allones = shufflevector %head1, poison, zeroinitializer + %head2 = insertelement poison, i32 7, i32 0 + %splat = shufflevector %head2, poison, zeroinitializer + %vs = select %mask, %splat, %allones + %vc = and %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vdiv-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vdiv-sdnode.ll index 61954b8..5e32e55 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vdiv-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vdiv-sdnode.ll @@ -1184,3 +1184,52 @@ define @vdiv_vi_nxv8i64_0( %va) { %vc = sdiv %va, %splat ret %vc } + +define @vdiv_vv_mask_nxv8i32( %va, %vb, %mask) { +; CHECK-LABEL: vdiv_vv_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 1 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vdiv.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 1, i32 0 + %one = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %vb, %one + %vc = sdiv %va, %vs + ret %vc +} + +define @vdiv_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vdiv_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 1 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vdiv.vv v8, v8, v12 +; CHECK-NEXT: ret + %head1 = insertelement poison, i32 1, i32 0 + %one = shufflevector %head1, poison, zeroinitializer + %head2 = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head2, poison, zeroinitializer + %vs = select %mask, %splat, %one + %vc = sdiv %va, %vs + ret %vc +} + +define @vdiv_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vdiv_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 1 +; CHECK-NEXT: vmerge.vim v12, v12, 7, v0 +; CHECK-NEXT: vdiv.vv v8, v8, v12 +; CHECK-NEXT: ret + %head1 = insertelement poison, i32 1, i32 0 + %one = shufflevector %head1, poison, zeroinitializer + %head2 = insertelement poison, i32 7, i32 0 + %splat = shufflevector %head2, poison, zeroinitializer + %vs = select %mask, %splat, %one + %vc = sdiv %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vdivu-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vdivu-sdnode.ll index 6f8a5ac..df80e60 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vdivu-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vdivu-sdnode.ll @@ -1197,3 +1197,52 @@ define @vdivu_vi_nxv8i64_2( %va, %va, %vc ret %vd } + +define @vdivu_vv_mask_nxv8i32( %va, %vb, %mask) { +; CHECK-LABEL: vdivu_vv_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 1 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vdivu.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 1, i32 0 + %one = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %vb, %one + %vc = udiv %va, %vs + ret %vc +} + +define @vdivu_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vdivu_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 1 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vdivu.vv v8, v8, v12 +; CHECK-NEXT: ret + %head1 = insertelement poison, i32 1, i32 0 + %one = shufflevector %head1, poison, zeroinitializer + %head2 = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head2, poison, zeroinitializer + %vs = select %mask, %splat, %one + %vc = udiv %va, %vs + ret %vc +} + +define @vdivu_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vdivu_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 1 +; CHECK-NEXT: vmerge.vim v12, v12, 7, v0 +; CHECK-NEXT: vdivu.vv v8, v8, v12 +; CHECK-NEXT: ret + %head1 = insertelement poison, i32 1, i32 0 + %one = shufflevector %head1, poison, zeroinitializer + %head2 = insertelement poison, i32 7, i32 0 + %splat = shufflevector %head2, poison, zeroinitializer + %vs = select %mask, %splat, %one + %vc = udiv %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vfadd-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vfadd-sdnode.ll index d9c73df..7f0be92 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vfadd-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vfadd-sdnode.ll @@ -369,3 +369,35 @@ define @vfadd_fv_nxv8f64( %va, double %vc = fadd %splat, %va ret %vc } + +define @vfadd_vv_mask_nxv8f32( %va, %vb, %mask) { +; CHECK-LABEL: vfadd_vv_mask_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vfadd.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, float 0.0, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %vb, %splat + %vc = fadd fast %va, %vs + ret %vc +} + +define @vfadd_vf_mask_nxv8f32( %va, float %b, %mask) { +; CHECK-LABEL: vfadd_vf_mask_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vfmerge.vfm v12, v12, fa0, v0 +; CHECK-NEXT: vfadd.vv v8, v8, v12 +; CHECK-NEXT: ret + %head0 = insertelement poison, float 0.0, i32 0 + %splat0 = shufflevector %head0, poison, zeroinitializer + %head1 = insertelement poison, float %b, i32 0 + %splat1 = shufflevector %head1, poison, zeroinitializer + %vs = select %mask, %splat1, %splat0 + %vc = fadd fast %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vfdiv-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vfdiv-sdnode.ll index c99ed62..24dd829 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vfdiv-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vfdiv-sdnode.ll @@ -369,3 +369,35 @@ define @vfdiv_fv_nxv8f64( %va, double %vc = fdiv %splat, %va ret %vc } + +define @vfdiv_vv_mask_nxv8f32( %va, %vb, %mask) { +; CHECK-LABEL: vfdiv_vv_mask_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vfdiv.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, float 0.0, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %vb, %splat + %vc = fdiv %va, %vs + ret %vc +} + +define @vfdiv_vf_mask_nxv8f32( %va, float %b, %mask) { +; CHECK-LABEL: vfdiv_vf_mask_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vfmerge.vfm v12, v12, fa0, v0 +; CHECK-NEXT: vfdiv.vv v8, v8, v12 +; CHECK-NEXT: ret + %head0 = insertelement poison, float 0.0, i32 0 + %splat0 = shufflevector %head0, poison, zeroinitializer + %head1 = insertelement poison, float %b, i32 0 + %splat1 = shufflevector %head1, poison, zeroinitializer + %vs = select %mask, %splat1, %splat0 + %vc = fdiv %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vfmul-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vfmul-sdnode.ll index 7aec351..24f87ed 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vfmul-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vfmul-sdnode.ll @@ -369,3 +369,35 @@ define @vfmul_fv_nxv8f64( %va, double %vc = fmul %splat, %va ret %vc } + +define @vfmul_vv_mask_nxv8f32( %va, %vb, %mask) { +; CHECK-LABEL: vfmul_vv_mask_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vfmul.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, float 0.0, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %vb, %splat + %vc = fmul %va, %vs + ret %vc +} + +define @vfmul_vf_mask_nxv8f32( %va, float %b, %mask) { +; CHECK-LABEL: vfmul_vf_mask_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vfmerge.vfm v12, v12, fa0, v0 +; CHECK-NEXT: vfmul.vv v8, v8, v12 +; CHECK-NEXT: ret + %head0 = insertelement poison, float 0.0, i32 0 + %splat0 = shufflevector %head0, poison, zeroinitializer + %head1 = insertelement poison, float %b, i32 0 + %splat1 = shufflevector %head1, poison, zeroinitializer + %vs = select %mask, %splat1, %splat0 + %vc = fmul %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vfsub-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vfsub-sdnode.ll index f4bba98..544a3c1 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vfsub-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vfsub-sdnode.ll @@ -369,3 +369,35 @@ define @vfsub_fv_nxv8f64( %va, double %vc = fsub %splat, %va ret %vc } + +define @vfsub_vv_mask_nxv8f32( %va, %vb, %mask) { +; CHECK-LABEL: vfsub_vv_mask_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vfsub.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, float 0.0, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %vb, %splat + %vc = fsub fast %va, %vs + ret %vc +} + +define @vfsub_vf_mask_nxv8f32( %va, float %b, %mask) { +; CHECK-LABEL: vfsub_vf_mask_nxv8f32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vfmerge.vfm v12, v12, fa0, v0 +; CHECK-NEXT: vfsub.vv v8, v8, v12 +; CHECK-NEXT: ret + %head0 = insertelement poison, float 0.0, i32 0 + %splat0 = shufflevector %head0, poison, zeroinitializer + %head1 = insertelement poison, float %b, i32 0 + %splat1 = shufflevector %head1, poison, zeroinitializer + %vs = select %mask, %splat1, %splat0 + %vc = fsub fast %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vmaxu-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vmaxu-sdnode.ll index 61ab1b1..a6693fa 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vmaxu-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vmaxu-sdnode.ll @@ -890,3 +890,48 @@ define @vmax_vi_nxv8i64_0( %va) { ret %vc } +define @vmax_vv_mask_nxv8i32( %va, %vb, %mask) { +; CHECK-LABEL: vmax_vv_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vmaxu.vv v8, v8, v12 +; CHECK-NEXT: ret + %vs = select %mask, %vb, zeroinitializer + %cmp = icmp ugt %va, %vs + %vc = select %cmp, %va, %vs + ret %vc +} + +define @vmax_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vmax_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vmaxu.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %cmp = icmp ugt %va, %vs + %vc = select %cmp, %va, %vs + ret %vc +} + +define @vmax_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vmax_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vim v12, v12, -3, v0 +; CHECK-NEXT: vmaxu.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 -3, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %cmp = icmp ugt %va, %vs + %vc = select %cmp, %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vminu-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vminu-sdnode.ll index e8c1699..2fbe877 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vminu-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vminu-sdnode.ll @@ -890,3 +890,54 @@ define @vmin_vi_nxv8i64_0( %va) { ret %vc } +define @vmin_vv_mask_nxv8i32( %va, %vb, %mask) { +; CHECK-LABEL: vmin_vv_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, -1 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vminu.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 -1, i32 0 + %max = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %vb, %max + %cmp = icmp ult %va, %vs + %vc = select %cmp, %va, %vs + ret %vc +} + +define @vmin_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vmin_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, -1 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vminu.vv v8, v8, v12 +; CHECK-NEXT: ret + %head0 = insertelement poison, i32 -1, i32 0 + %max = shufflevector %head0, poison, zeroinitializer + %head1 = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head1, poison, zeroinitializer + %vs = select %mask, %splat, %max + %cmp = icmp ult %va, %vs + %vc = select %cmp, %va, %vs + ret %vc +} + +define @vmin_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vmin_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, -1 +; CHECK-NEXT: vmerge.vim v12, v12, -3, v0 +; CHECK-NEXT: vminu.vv v8, v8, v12 +; CHECK-NEXT: ret + %head0 = insertelement poison, i32 -1, i32 0 + %max = shufflevector %head0, poison, zeroinitializer + %head1 = insertelement poison, i32 -3, i32 0 + %splat = shufflevector %head1, poison, zeroinitializer + %vs = select %mask, %splat, %max + %cmp = icmp ult %va, %vs + %vc = select %cmp, %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vmul-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vmul-sdnode.ll index f3e79cf..ec6d314 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vmul-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vmul-sdnode.ll @@ -959,3 +959,53 @@ define @vmul_xx_nxv8i64(i64 %a, i64 %b) nounwind { %v = mul %splat1, %splat2 ret %v } + +define @vmul_vv_mask_nxv8i32( %va, %vb, %mask) { +; CHECK-LABEL: vmul_vv_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 1 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vmul.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 1, i32 0 + %one = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %vb, %one + %vc = mul %va, %vs + ret %vc +} + +define @vmul_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vmul_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 1 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vmul.vv v8, v8, v12 +; CHECK-NEXT: ret + %head1 = insertelement poison, i32 1, i32 0 + %one = shufflevector %head1, poison, zeroinitializer + %head2 = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head2, poison, zeroinitializer + %vs = select %mask, %splat, %one + %vc = mul %va, %vs + ret %vc +} + +define @vmul_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vmul_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 1 +; CHECK-NEXT: vmerge.vim v12, v12, 7, v0 +; CHECK-NEXT: vmul.vv v8, v8, v12 +; CHECK-NEXT: ret + %head1 = insertelement poison, i32 1, i32 0 + %one = shufflevector %head1, poison, zeroinitializer + %head2 = insertelement poison, i32 7, i32 0 + %splat = shufflevector %head2, poison, zeroinitializer + %vs = select %mask, %splat, %one + %vc = mul %va, %vs + ret %vc +} + diff --git a/llvm/test/CodeGen/RISCV/rvv/vor-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vor-sdnode.ll index 663caed..69f7261 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vor-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vor-sdnode.ll @@ -1174,3 +1174,46 @@ define @vor_xx_nxv8i64(i64 %a, i64 %b) nounwind { %v = or %splat1, %splat2 ret %v } + +define @vor_vv_mask_nxv8i32( %va, %vb, %mask) { +; CHECK-LABEL: vor_vv_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vor.vv v8, v8, v12 +; CHECK-NEXT: ret + %vs = select %mask, %vb, zeroinitializer + %vc = or %va, %vs + ret %vc +} + +define @vor_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vor_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vor.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = or %va, %vs + ret %vc +} + +define @vor_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vor_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vim v12, v12, 7, v0 +; CHECK-NEXT: vor.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 7, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = or %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vshl-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vshl-sdnode.ll index 53c876b..6869eff 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vshl-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vshl-sdnode.ll @@ -629,3 +629,47 @@ define @vshl_vx_nxv8i64_2( %va) { %vc = shl %va, %splat ret %vc } + +define @vshl_vv_mask_nxv4i32( %va, %vb, %mask) { +; CHECK-LABEL: vshl_vv_mask_nxv4i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vsll.vv v8, v8, v12 +; CHECK-NEXT: ret + %vs = select %mask, %vb, zeroinitializer + %vc = shl %va, %vs + ret %vc +} + +define @vshl_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vshl_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vsll.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = shl %va, %vs + ret %vc +} + +define @vshl_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vshl_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: li a0, 31 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vsll.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 31, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = shl %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vsra-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vsra-sdnode.ll index fb20fc7..73406a9 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vsra-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vsra-sdnode.ll @@ -802,3 +802,46 @@ define @vsra_vi_nxv8i64_1( %va) { ret %vc } +define @vsra_vv_mask_nxv4i32( %va, %vb, %mask) { +; CHECK-LABEL: vsra_vv_mask_nxv4i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vsra.vv v8, v8, v12 +; CHECK-NEXT: ret + %vs = select %mask, %vb, zeroinitializer + %vc = ashr %va, %vs + ret %vc +} + +define @vsra_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vsra_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vsra.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = ashr %va, %vs + ret %vc +} + +define @vsra_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vsra_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: li a0, 31 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vsra.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 31, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = ashr %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vsrl-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vsrl-sdnode.ll index 32e75ad..8cb5584 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vsrl-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vsrl-sdnode.ll @@ -582,3 +582,46 @@ define @vsrl_vx_nxv8i64_1( %va) { ret %vc } +define @vsrl_vv_mask_nxv4i32( %va, %vb, %mask) { +; CHECK-LABEL: vsrl_vv_mask_nxv4i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vsrl.vv v8, v8, v12 +; CHECK-NEXT: ret + %vs = select %mask, %vb, zeroinitializer + %vc = lshr %va, %vs + ret %vc +} + +define @vsrl_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vsrl_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vsrl.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = lshr %va, %vs + ret %vc +} + +define @vsrl_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vsrl_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: li a0, 31 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vsrl.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 31, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = lshr %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vsub-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vsub-sdnode.ll index 0fac309..5d6c3f4 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vsub-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vsub-sdnode.ll @@ -868,3 +868,47 @@ define @vsub_xx_nxv8i64(i64 %a, i64 %b) nounwind { %v = sub %splat1, %splat2 ret %v } + +define @vsub_vv_mask_nxv8i32( %va, %vb, %mask) { +; CHECK-LABEL: vsub_vv_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vsub.vv v8, v8, v12 +; CHECK-NEXT: ret + + %vs = select %mask, %vb, zeroinitializer + %vc = sub %va, %vs + ret %vc +} + +define @vsub_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vsub_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vsub.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = sub %va, %vs + ret %vc +} + +define @vsub_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vsub_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vim v12, v12, 7, v0 +; CHECK-NEXT: vsub.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 7, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = sub %va, %vs + ret %vc +} diff --git a/llvm/test/CodeGen/RISCV/rvv/vxor-sdnode.ll b/llvm/test/CodeGen/RISCV/rvv/vxor-sdnode.ll index 2e64cdf..0518a5a 100644 --- a/llvm/test/CodeGen/RISCV/rvv/vxor-sdnode.ll +++ b/llvm/test/CodeGen/RISCV/rvv/vxor-sdnode.ll @@ -1381,3 +1381,46 @@ define @vxor_xx_nxv8i64(i64 %a, i64 %b) nounwind { %v = xor %splat1, %splat2 ret %v } + +define @vxor_vv_mask_nxv8i32( %va, %vb, %mask) { +; CHECK-LABEL: vxor_vv_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v16, 0 +; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0 +; CHECK-NEXT: vxor.vv v8, v8, v12 +; CHECK-NEXT: ret + %vs = select %mask, %vb, zeroinitializer + %vc = xor %va, %vs + ret %vc +} + +define @vxor_vx_mask_nxv8i32( %va, i32 signext %b, %mask) { +; CHECK-LABEL: vxor_vx_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0 +; CHECK-NEXT: vxor.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 %b, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = xor %va, %vs + ret %vc +} + +define @vxor_vi_mask_nxv8i32( %va, %mask) { +; CHECK-LABEL: vxor_vi_mask_nxv8i32: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma +; CHECK-NEXT: vmv.v.i v12, 0 +; CHECK-NEXT: vmerge.vim v12, v12, 7, v0 +; CHECK-NEXT: vxor.vv v8, v8, v12 +; CHECK-NEXT: ret + %head = insertelement poison, i32 7, i32 0 + %splat = shufflevector %head, poison, zeroinitializer + %vs = select %mask, %splat, zeroinitializer + %vc = xor %va, %vs + ret %vc +} -- 2.7.4