[PATCH] D155927: [RISCV] Add tests for vnsrl.vx where shift amount is truncated
Luke Lau via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 21 02:25:04 PDT 2023
luke created this revision.
luke added reviewers: craig.topper, 4vtomat, reames.
Herald added subscribers: jobnoorman, asb, pmatos, VincentWu, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, arichardson.
Herald added a project: All.
luke requested review of this revision.
Herald added subscribers: llvm-commits, wangpc, eopXD, MaskRay.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155927
Files:
llvm/test/CodeGen/RISCV/rvv/vnsrl-sdnode.ll
Index: llvm/test/CodeGen/RISCV/rvv/vnsrl-sdnode.ll
===================================================================
--- llvm/test/CodeGen/RISCV/rvv/vnsrl-sdnode.ll
+++ llvm/test/CodeGen/RISCV/rvv/vnsrl-sdnode.ll
@@ -1,8 +1,8 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -mattr=+v -target-abi=ilp32 \
-; RUN: -verify-machineinstrs < %s | FileCheck %s
+; RUN: -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK,RV32 %s
; RUN: llc -mtriple=riscv64 -mattr=+v -target-abi=lp64 \
-; RUN: -verify-machineinstrs < %s | FileCheck %s
+; RUN: -verify-machineinstrs < %s | FileCheck -check-prefixes=CHECK,RV64 %s
define <vscale x 1 x i32> @vnsrl_wx_i64_nxv1i32(<vscale x 1 x i64> %va, i64 %b) {
; CHECK-LABEL: vnsrl_wx_i64_nxv1i32:
@@ -632,3 +632,77 @@
%y = trunc <vscale x 8 x i64> %x to <vscale x 8 x i32>
ret <vscale x 8 x i32> %y
}
+
+define <vscale x 1 x i16> @vnsrl_wx_i64_nxv1i16(<vscale x 1 x i32> %va, i64 %b) {
+; RV32-LABEL: vnsrl_wx_i64_nxv1i16:
+; RV32: # %bb.0:
+; RV32-NEXT: addi sp, sp, -16
+; RV32-NEXT: .cfi_def_cfa_offset 16
+; RV32-NEXT: sw a1, 12(sp)
+; RV32-NEXT: sw a0, 8(sp)
+; RV32-NEXT: addi a0, sp, 8
+; RV32-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
+; RV32-NEXT: vlse64.v v9, (a0), zero
+; RV32-NEXT: vnsrl.wi v9, v9, 0
+; RV32-NEXT: vsrl.vv v8, v8, v9
+; RV32-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
+; RV32-NEXT: vnsrl.wi v8, v8, 0
+; RV32-NEXT: addi sp, sp, 16
+; RV32-NEXT: ret
+;
+; RV64-LABEL: vnsrl_wx_i64_nxv1i16:
+; RV64: # %bb.0:
+; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma
+; RV64-NEXT: vmv.v.x v9, a0
+; RV64-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
+; RV64-NEXT: vnsrl.wi v9, v9, 0
+; RV64-NEXT: vsrl.vv v8, v8, v9
+; RV64-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
+; RV64-NEXT: vnsrl.wi v8, v8, 0
+; RV64-NEXT: ret
+ %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
+ %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
+ %vb = trunc <vscale x 1 x i64> %splat to <vscale x 1 x i32>
+ %x = lshr <vscale x 1 x i32> %va, %vb
+ %y = trunc <vscale x 1 x i32> %x to <vscale x 1 x i16>
+ ret <vscale x 1 x i16> %y
+}
+
+define <vscale x 1 x i8> @vnsrl_wx_i64_nxv1i8(<vscale x 1 x i16> %va, i64 %b) {
+; RV32-LABEL: vnsrl_wx_i64_nxv1i8:
+; RV32: # %bb.0:
+; RV32-NEXT: addi sp, sp, -16
+; RV32-NEXT: .cfi_def_cfa_offset 16
+; RV32-NEXT: sw a1, 12(sp)
+; RV32-NEXT: sw a0, 8(sp)
+; RV32-NEXT: addi a0, sp, 8
+; RV32-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
+; RV32-NEXT: vlse64.v v9, (a0), zero
+; RV32-NEXT: vnsrl.wi v9, v9, 0
+; RV32-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
+; RV32-NEXT: vnsrl.wi v9, v9, 0
+; RV32-NEXT: vsrl.vv v8, v8, v9
+; RV32-NEXT: vsetvli zero, zero, e8, mf8, ta, ma
+; RV32-NEXT: vnsrl.wi v8, v8, 0
+; RV32-NEXT: addi sp, sp, 16
+; RV32-NEXT: ret
+;
+; RV64-LABEL: vnsrl_wx_i64_nxv1i8:
+; RV64: # %bb.0:
+; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma
+; RV64-NEXT: vmv.v.x v9, a0
+; RV64-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
+; RV64-NEXT: vnsrl.wi v9, v9, 0
+; RV64-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
+; RV64-NEXT: vnsrl.wi v9, v9, 0
+; RV64-NEXT: vsrl.vv v8, v8, v9
+; RV64-NEXT: vsetvli zero, zero, e8, mf8, ta, ma
+; RV64-NEXT: vnsrl.wi v8, v8, 0
+; RV64-NEXT: ret
+ %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
+ %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
+ %vb = trunc <vscale x 1 x i64> %splat to <vscale x 1 x i16>
+ %x = lshr <vscale x 1 x i16> %va, %vb
+ %y = trunc <vscale x 1 x i16> %x to <vscale x 1 x i8>
+ ret <vscale x 1 x i8> %y
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155927.542825.patch
Type: text/x-patch
Size: 3863 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230721/986ea616/attachment.bin>
More information about the llvm-commits
mailing list