diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/test/Analysis/CostModel/RISCV/rvv-intrinsics.ll | 22 | ||||
| -rw-r--r-- | llvm/test/CodeGen/RISCV/rvv/fshr-fshl.ll | 40 |
2 files changed, 62 insertions, 0 deletions
diff --git a/llvm/test/Analysis/CostModel/RISCV/rvv-intrinsics.ll b/llvm/test/Analysis/CostModel/RISCV/rvv-intrinsics.ll index 88d3964..c7d05b1 100644 --- a/llvm/test/Analysis/CostModel/RISCV/rvv-intrinsics.ll +++ b/llvm/test/Analysis/CostModel/RISCV/rvv-intrinsics.ll @@ -31,6 +31,28 @@ define void @unsupported_fp_ops(<vscale x 4 x float> %vec) { ret void } +define void @fshr(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) { +; CHECK-LABEL: 'fshr' +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = call <vscale x 1 x i32> @llvm.fshr.nxv1i32(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; + call <vscale x 1 x i32> @llvm.fshr.v4i32(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) + ret void +} + +define void @fshl(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) { +; CHECK-LABEL: 'fshl' +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = call <vscale x 1 x i32> @llvm.fshl.nxv1i32(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; + call <vscale x 1 x i32> @llvm.fshl.v4i32(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) + ret void +} + +declare <vscale x 1 x i32> @llvm.fshr.v4i32(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) +declare <vscale x 1 x i32> @llvm.fshl.v4i32(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) + + declare <vscale x 4 x float> @llvm.sin.nxv4f32(<vscale x 4 x float>) declare <vscale x 4 x float> @llvm.cos.nxv4f32(<vscale x 4 x float>) declare <vscale x 4 x float> @llvm.pow.nxv4f32(<vscale x 4 x float>, <vscale x 4 x float>) diff --git a/llvm/test/CodeGen/RISCV/rvv/fshr-fshl.ll b/llvm/test/CodeGen/RISCV/rvv/fshr-fshl.ll new file mode 100644 index 0000000..2ee2889 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/fshr-fshl.ll @@ -0,0 +1,40 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s | FileCheck %s +; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s + +define <vscale x 1 x i32> @fshr(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) { +; CHECK-LABEL: fshr: +; CHECK: # %bb.0: +; CHECK-NEXT: li a0, 31 +; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, mu +; CHECK-NEXT: vand.vx v11, v10, a0 +; CHECK-NEXT: vsrl.vv v9, v9, v11 +; CHECK-NEXT: vnot.v v10, v10 +; CHECK-NEXT: vand.vx v10, v10, a0 +; CHECK-NEXT: vadd.vv v8, v8, v8 +; CHECK-NEXT: vsll.vv v8, v8, v10 +; CHECK-NEXT: vor.vv v8, v8, v9 +; CHECK-NEXT: ret + %res = call <vscale x 1 x i32> @llvm.fshr.v4i32(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) + ret <vscale x 1 x i32> %res +} + +define <vscale x 1 x i32> @fshl(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) { +; CHECK-LABEL: fshl: +; CHECK: # %bb.0: +; CHECK-NEXT: li a0, 31 +; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, mu +; CHECK-NEXT: vand.vx v11, v10, a0 +; CHECK-NEXT: vsll.vv v8, v8, v11 +; CHECK-NEXT: vnot.v v10, v10 +; CHECK-NEXT: vand.vx v10, v10, a0 +; CHECK-NEXT: vsrl.vi v9, v9, 1 +; CHECK-NEXT: vsrl.vv v9, v9, v10 +; CHECK-NEXT: vor.vv v8, v8, v9 +; CHECK-NEXT: ret + %res = call <vscale x 1 x i32> @llvm.fshl.v4i32(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) + ret <vscale x 1 x i32> %res +} + +declare <vscale x 1 x i32> @llvm.fshr.v4i32(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) +declare <vscale x 1 x i32> @llvm.fshl.v4i32(<vscale x 1 x i32> %a, <vscale x 1 x i32> %b, <vscale x 1 x i32> %c) |
