[llvm] [RISCV][VLOPT] Add support for vfclass.v (PR #148246)
Mikhail R. Gadelha via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 14 06:59:00 PDT 2025
https://github.com/mikhailramalho updated https://github.com/llvm/llvm-project/pull/148246
>From 4205a330b481cbe76bb52f81ded8a6d827284304 Mon Sep 17 00:00:00 2001
From: "Mikhail R. Gadelha" <mikhail at igalia.com>
Date: Thu, 10 Jul 2025 16:37:34 -0300
Subject: [PATCH 1/3] RISCV][VLOPT] Add support for vfclass.v
Signed-off-by: Mikhail R. Gadelha <mikhail at igalia.com>
---
llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
index 2d9f38221d424..e3b33eb0d7c26 100644
--- a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
+++ b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
@@ -1121,6 +1121,8 @@ static bool isSupportedInstr(const MachineInstr &MI) {
case RISCV::VFSGNJN_VF:
case RISCV::VFSGNJX_VF:
case RISCV::VFSGNJX_VV:
+ // Vector Floating-Point Classify Instruction
+ case RISCV::VFCLASS_V:
// Vector Floating-Point Compare Instructions
case RISCV::VMFEQ_VF:
case RISCV::VMFEQ_VV:
>From d273827c9863b382910eeaaf0a4797a5fd4d820d Mon Sep 17 00:00:00 2001
From: "Mikhail R. Gadelha" <mikhail at igalia.com>
Date: Thu, 10 Jul 2025 16:57:07 -0300
Subject: [PATCH 2/3] Updated test
Signed-off-by: Mikhail R. Gadelha <mikhail at igalia.com>
---
llvm/test/CodeGen/RISCV/rvv/vl-opt-instrs.ll | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/llvm/test/CodeGen/RISCV/rvv/vl-opt-instrs.ll b/llvm/test/CodeGen/RISCV/rvv/vl-opt-instrs.ll
index 317ad0c124e73..d97a0c7d3cb36 100644
--- a/llvm/test/CodeGen/RISCV/rvv/vl-opt-instrs.ll
+++ b/llvm/test/CodeGen/RISCV/rvv/vl-opt-instrs.ll
@@ -5455,9 +5455,8 @@ define <vscale x 4 x i32> @vfclass_v(<vscale x 4 x float> %a, <vscale x 4 x i32>
;
; VLOPT-LABEL: vfclass_v:
; VLOPT: # %bb.0:
-; VLOPT-NEXT: vsetvli a1, zero, e32, m2, ta, ma
-; VLOPT-NEXT: vfclass.v v8, v8
; VLOPT-NEXT: vsetvli zero, a0, e32, m2, ta, ma
+; VLOPT-NEXT: vfclass.v v8, v8
; VLOPT-NEXT: vadd.vv v8, v8, v10
; VLOPT-NEXT: ret
%1 = call <vscale x 4 x i32> @llvm.riscv.vfclass.nxv4i32(<vscale x 4 x i32> poison, <vscale x 4 x float> %a, iXLen -1)
>From 60a858c8da904a6b00998e812f96e04b5eecffb8 Mon Sep 17 00:00:00 2001
From: "Mikhail R. Gadelha" <mikhail at igalia.com>
Date: Mon, 14 Jul 2025 10:37:30 -0300
Subject: [PATCH 3/3] Moved enum
Signed-off-by: Mikhail R. Gadelha <mikhail at igalia.com>
---
llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
index e3b33eb0d7c26..ad546974f3aee 100644
--- a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
+++ b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
@@ -1121,8 +1121,6 @@ static bool isSupportedInstr(const MachineInstr &MI) {
case RISCV::VFSGNJN_VF:
case RISCV::VFSGNJX_VF:
case RISCV::VFSGNJX_VV:
- // Vector Floating-Point Classify Instruction
- case RISCV::VFCLASS_V:
// Vector Floating-Point Compare Instructions
case RISCV::VMFEQ_VF:
case RISCV::VMFEQ_VV:
@@ -1134,6 +1132,8 @@ static bool isSupportedInstr(const MachineInstr &MI) {
case RISCV::VMFLE_VV:
case RISCV::VMFGT_VF:
case RISCV::VMFGE_VF:
+ // Vector Floating-Point Classify Instruction
+ case RISCV::VFCLASS_V:
// Vector Floating-Point Merge Instruction
case RISCV::VFMERGE_VFM:
// Vector Floating-Point Move Instruction
More information about the llvm-commits
mailing list