Index: llvm/include/llvm/IR/IntrinsicsRISCV.td =================================================================== --- llvm/include/llvm/IR/IntrinsicsRISCV.td +++ llvm/include/llvm/IR/IntrinsicsRISCV.td @@ -299,7 +299,21 @@ [IntrNoMem]>, RISCVVIntrinsic { let ExtendOperand = 3; } - + // For FP classify operations. + // Output: (bit mask type output) + // Input: (vector_in, vl) + class RISCVClassifyNoMask + : Intrinsic<[LLVMVectorOfBitcastsToInt<0>], + [llvm_anyvector_ty, llvm_anyint_ty], + [IntrNoMem]>, RISCVVIntrinsic; + // For FP classify operations with mask. + // Output: (bit mask type output) + // Input: (maskedoff, vector_in, mask, vl) + class RISCVClassifyMask + : Intrinsic<[LLVMVectorOfBitcastsToInt<0>], + [LLVMVectorOfBitcastsToInt<0>, llvm_anyvector_ty, + LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty], + [IntrNoMem]>, RISCVVIntrinsic; // For Saturating binary operations. // The destination vector type is the same as first source vector. // Input: (vector_in, vector_in/scalar_in, vl) @@ -485,6 +499,10 @@ def "int_riscv_" # NAME : RISCVUnaryAANoMask; def "int_riscv_" # NAME # "_mask" : RISCVUnaryAAMask; } + multiclass RISCVUnaryAB { + def "int_riscv_" # NAME : RISCVUnaryABNoMask; + def "int_riscv_" # NAME # "_mask" : RISCVUnaryABMask; + } // AAX means the destination type(A) is the same as the first source // type(A). X means any type for the second source operand. multiclass RISCVBinaryAAX { @@ -526,6 +544,10 @@ def "int_riscv_" # NAME : RISCVCompareNoMask; def "int_riscv_" # NAME # "_mask" : RISCVCompareMask; } + multiclass RISCVClassify { + def "int_riscv_" # NAME : RISCVClassifyNoMask; + def "int_riscv_" # NAME # "_mask" : RISCVClassifyMask; + } multiclass RISCVTernaryWide { def "int_riscv_" # NAME : RISCVTernaryWideNoMask; def "int_riscv_" # NAME # "_mask" : RISCVTernaryWideMask; @@ -538,10 +560,6 @@ def "int_riscv_" # NAME : RISCVMaskUnarySOutNoMask; def "int_riscv_" # NAME # "_mask" : RISCVMaskUnarySOutMask; } - multiclass RISCVUnaryAB { - def "int_riscv_" # NAME : RISCVUnaryABNoMask; - def "int_riscv_" # NAME # "_mask" : RISCVUnaryABMask; - } multiclass RISCVMaskUnaryMOut { def "int_riscv_" # NAME : RISCVUnaryNoMask; def "int_riscv_" # NAME # "_mask" : RISCVMaskUnaryMOutMask; @@ -708,6 +726,8 @@ defm vfsgnjn : RISCVBinaryAAX; defm vfsgnjx : RISCVBinaryAAX; + defm vfclass : RISCVClassify; + defm vfmerge : RISCVBinaryWithV0; defm vslideup : RISCVTernaryAAAX; Index: llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td =================================================================== --- llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td +++ llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td @@ -2714,6 +2714,11 @@ defm PseudoVMFGE : VPseudoBinaryM_VX; //===----------------------------------------------------------------------===// +// 14.14. Vector Floating-Point Classify Instruction +//===----------------------------------------------------------------------===// +defm PseudoVFCLASS : VPseudoUnaryV_V; + +//===----------------------------------------------------------------------===// // 14.15. Vector Floating-Point Merge Instruction //===----------------------------------------------------------------------===// defm PseudoVFMERGE : VPseudoBinaryV_XM; //===----------------------------------------------------------------------===// +// 14.14. Vector Floating-Point Classify Instruction +//===----------------------------------------------------------------------===// +defm "" : VPatConversionVI_VF<"int_riscv_vfclass", "PseudoVFCLASS">; + +//===----------------------------------------------------------------------===// // 14.15. Vector Floating-Point Merge Instruction //===----------------------------------------------------------------------===// // We can use vmerge.vvm to support vector-vector vfmerge. @@ -3448,6 +3459,7 @@ //===----------------------------------------------------------------------===// defm "" : VPatReductionW_VS<"int_riscv_vfwredsum", "PseudoVFWREDSUM", /*IsFloat=*/1>; defm "" : VPatReductionW_VS<"int_riscv_vfwredosum", "PseudoVFWREDOSUM", /*IsFloat=*/1>; + } // Predicates = [HasStdExtV, HasStdExtF] //===----------------------------------------------------------------------===//