[llvm] 2435ea6 - [RISCV][VLOPT] Add support for vfclass.v (#148246)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 07:49:46 PDT 2025


Author: Mikhail R. Gadelha
Date: 2025-07-15T11:49:43-03:00
New Revision: 2435ea6975b9bfb7a81efb8a168b4a5b92dbefa1

URL: https://github.com/llvm/llvm-project/commit/2435ea6975b9bfb7a81efb8a168b4a5b92dbefa1
DIFF: https://github.com/llvm/llvm-project/commit/2435ea6975b9bfb7a81efb8a168b4a5b92dbefa1.diff

LOG: [RISCV][VLOPT] Add support for vfclass.v (#148246)

This PR adds support for the vfclass.v instruction in the RISC-V
VLOptimizer.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
    llvm/test/CodeGen/RISCV/rvv/vl-opt-instrs.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
index b0a1675a667fe..c2b5e0135caea 100644
--- a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
+++ b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
@@ -1139,6 +1139,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

diff  --git a/llvm/test/CodeGen/RISCV/rvv/vl-opt-instrs.ll b/llvm/test/CodeGen/RISCV/rvv/vl-opt-instrs.ll
index 7d7e217ba8773..a5bc04d66e49d 100644
--- a/llvm/test/CodeGen/RISCV/rvv/vl-opt-instrs.ll
+++ b/llvm/test/CodeGen/RISCV/rvv/vl-opt-instrs.ll
@@ -5448,9 +5448,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)


        


More information about the llvm-commits mailing list