diff --git a/README.md b/README.md index 29acd5347fdf5e..0f411d9287b037 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ Any feature not listed below but present in the specification should be consider - (Done) `13.1. Vector Single-Width Saturating Add and Subtract` - (Done) `13.2. Vector Single-Width Averaging Add and Subtract` - (Done) `13.3. Vector Single-Width Fractional Multiply with Rounding and Saturation` + - (Done) `13.6. Vector Narrowing Fixed-Point Clip Instructions` - (WIP) Clang intrinsics related to the `XTHeadVector` extension: - (WIP) `6. Configuration-Setting and Utility` - (Done) `6.1. Set vl and vtype` diff --git a/llvm/include/llvm/IR/IntrinsicsRISCVXTHeadV.td b/llvm/include/llvm/IR/IntrinsicsRISCVXTHeadV.td index 083bbacc5a8beb..87b2f676eca314 100644 --- a/llvm/include/llvm/IR/IntrinsicsRISCVXTHeadV.td +++ b/llvm/include/llvm/IR/IntrinsicsRISCVXTHeadV.td @@ -680,6 +680,20 @@ let TargetPrefix = "riscv" in { let VLOperand = 4; } + // For Saturating binary operations with mask but no policy. + // The destination vector type is NOT the same as first source vector (with mask). + // The second source operand matches the destination type or is an XLen scalar. + // Input: (maskedoff, vector_in, vector_in/scalar_in, mask, vxrm, vl) + class XVSaturatingBinaryABShiftMaskedRoundingMode + : DefaultAttrsIntrinsic<[llvm_anyvector_ty], + [LLVMMatchType<0>, llvm_anyvector_ty, llvm_any_ty, + LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty, + LLVMMatchType<3>], + [ImmArg>, IntrNoMem, IntrHasSideEffects]>, + RISCVVIntrinsic { + let VLOperand = 5; + } + multiclass XVBinaryAAX { def "int_riscv_" # NAME : RISCVBinaryAAXUnMasked; def "int_riscv_" # NAME # "_mask" : XVBinaryAAXMasked; @@ -719,6 +733,11 @@ let TargetPrefix = "riscv" in { def "int_riscv_" # NAME : RISCVSaturatingBinaryAAXUnMasked; def "int_riscv_" # NAME # "_mask" : XVSaturatingBinaryAAXMasked; } + + multiclass XVSaturatingBinaryABShiftRoundingMode { + def "int_riscv_" # NAME : RISCVSaturatingBinaryABShiftUnMaskedRoundingMode; + def "int_riscv_" # NAME # "_mask" : XVSaturatingBinaryABShiftMaskedRoundingMode; + } } let TargetPrefix = "riscv" in { @@ -841,4 +860,8 @@ let TargetPrefix = "riscv" in { // 13.3. Vector Single-Width Fractional Multiply with Rounding and Saturation Instructions defm th_vsmul : XVBinaryAAXRoundingMode; + // 13.6. Vector Narrowing Fixed-Point Clip Instructions + defm th_vnclipu : XVSaturatingBinaryABShiftRoundingMode; + defm th_vnclip : XVSaturatingBinaryABShiftRoundingMode; + } // TargetPrefix = "riscv" diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXTHeadVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoXTHeadVPseudos.td index fc9780f566e3fa..75cef5352d7062 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoXTHeadVPseudos.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXTHeadVPseudos.td @@ -1797,6 +1797,24 @@ multiclass XVPseudoTernaryW_VX { constraint>; } +multiclass XVPseudoBinaryV_WV_RM { + defm _WV : XVPseudoBinaryRoundingMode; +} + +multiclass XVPseudoBinaryV_WX_RM { + defm _WX : XVPseudoBinaryRoundingMode; +} + +multiclass XVPseudoBinaryV_WI_RM { + defm _WI : XVPseudoBinaryRoundingMode; +} + multiclass XVPseudoVALU_VV_VX_VI { foreach m = MxListXTHeadV in { defvar mx = m.MX; @@ -2183,6 +2201,24 @@ multiclass XVPseudoVSMUL_VV_VX_RM { } } +multiclass XVPseudoVNCLP_WV_WX_WI_RM { + foreach m = MxListWXTHeadV in { + defvar mx = m.MX; + defvar WriteVNClipV_MX = !cast("WriteVNClipV_" # mx); + defvar WriteVNClipX_MX = !cast("WriteVNClipX_" # mx); + defvar WriteVNClipI_MX = !cast("WriteVNClipI_" # mx); + defvar ReadVNClipV_MX = !cast("ReadVNClipV_" # mx); + defvar ReadVNClipX_MX = !cast("ReadVNClipX_" # mx); + + defm "" : XVPseudoBinaryV_WV_RM, + Sched<[WriteVNClipV_MX, ReadVNClipV_MX, ReadVNClipV_MX, ReadVMask]>; + defm "" : XVPseudoBinaryV_WX_RM, + Sched<[WriteVNClipX_MX, ReadVNClipV_MX, ReadVNClipX_MX, ReadVMask]>; + defm "" : XVPseudoBinaryV_WI_RM, + Sched<[WriteVNClipI_MX, ReadVNClipV_MX, ReadVMask]>; + } +} + //===----------------------------------------------------------------------===// // Helpers to define the intrinsic patterns for the XTHeadVector extension. //===----------------------------------------------------------------------===// @@ -2727,6 +2763,52 @@ multiclass XVPseudoVSALU_VV_VX { } } +multiclass XVPatBinaryV_WV_RM vtilist> { + foreach VtiToWti = vtilist in { + defvar Vti = VtiToWti.Vti; + defvar Wti = VtiToWti.Wti; + let Predicates = !listconcat(GetXVTypePredicates.Predicates, + GetXVTypePredicates.Predicates) in + defm : XVPatBinaryRoundingMode; + } +} + +multiclass XVPatBinaryV_WX_RM vtilist> { + foreach VtiToWti = vtilist in { + defvar Vti = VtiToWti.Vti; + defvar Wti = VtiToWti.Wti; + defvar kind = "W"#Vti.ScalarSuffix; + let Predicates = !listconcat(GetXVTypePredicates.Predicates, + GetXVTypePredicates.Predicates) in + defm : XVPatBinaryRoundingMode; + } +} + +multiclass XVPatBinaryV_WI_RM vtilist> { + foreach VtiToWti = vtilist in { + defvar Vti = VtiToWti.Vti; + defvar Wti = VtiToWti.Wti; + let Predicates = !listconcat(GetXVTypePredicates.Predicates, + GetXVTypePredicates.Predicates) in + defm : XVPatBinaryRoundingMode; + } +} + multiclass XVPatBinaryV_VV_VX_VI vtilist, Operand ImmType = simm5> : XVPatBinaryV_VV, @@ -2808,6 +2890,12 @@ multiclass XVPatTernaryW_VV_VX, XVPatTernaryW_VX; +multiclass XVPatBinaryV_WV_WX_WI_RM vtilist> + : XVPatBinaryV_WV_RM, + XVPatBinaryV_WX_RM, + XVPatBinaryV_WI_RM; + //===----------------------------------------------------------------------===// // 12.1. Vector Single-Width Saturating Add and Subtract //===----------------------------------------------------------------------===// @@ -3286,4 +3374,19 @@ let Predicates = [HasVendorXTHeadV] in { defm : XVPatBinaryV_VV_VX_RM<"int_riscv_th_vsmul", "PseudoTH_VSMUL", AllIntegerXVectors>; } // Predicates = [HasVendorXTHeadV] +//===----------------------------------------------------------------------===// +// 13.6. Vector Narrowing Fixed-Point Clip Instructions +//===----------------------------------------------------------------------===// +let Predicates = [HasVendorXTHeadV], Defs = [VXSAT], hasSideEffects = 1 in { + defm PseudoTH_VNCLIP : XVPseudoVNCLP_WV_WX_WI_RM; + defm PseudoTH_VNCLIPU : XVPseudoVNCLP_WV_WX_WI_RM; +} // Predicates = [HasVendorXTHeadV] + +let Predicates = [HasVendorXTHeadV] in { + defm : XVPatBinaryV_WV_WX_WI_RM<"int_riscv_th_vnclipu", "PseudoTH_VNCLIPU", + AllWidenableIntXVectors>; + defm : XVPatBinaryV_WV_WX_WI_RM<"int_riscv_th_vnclip", "PseudoTH_VNCLIP", + AllWidenableIntXVectors>; +} // Predicates = [HasVendorXTHeadV] + include "RISCVInstrInfoXTHeadVVLPatterns.td" diff --git a/llvm/test/CodeGen/RISCV/rvv0p71/vnclip.ll b/llvm/test/CodeGen/RISCV/rvv0p71/vnclip.ll new file mode 100644 index 00000000000000..a4e2bae159c2a3 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv0p71/vnclip.ll @@ -0,0 +1,1814 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+xtheadvector \ +; RUN: -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK +; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+xtheadvector \ +; RUN: -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK + +declare @llvm.riscv.th.vnclip.nxv8i8.nxv8i16.nxv8i8( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_wv_nxv8i8_nxv8i16_nxv8i8( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_wv_nxv8i8_nxv8i16_nxv8i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v11, v8, v10 +; CHECK-NEXT: th.vmv.v.v v8, v11 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv8i8.nxv8i16.nxv8i8( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv8i8.nxv8i16.nxv8i8( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_wv_nxv8i8_nxv8i16_nxv8i8( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_wv_nxv8i8_nxv8i16_nxv8i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v8, v10, v9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv8i8.nxv8i16.nxv8i8( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv16i8.nxv16i16.nxv16i8( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_wv_nxv16i8_nxv16i16_nxv16i8( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_wv_nxv16i8_nxv16i16_nxv16i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v14, v8, v12 +; CHECK-NEXT: th.vmv.v.v v8, v14 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv16i8.nxv16i16.nxv16i8( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv16i8.nxv16i16.nxv16i8( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_wv_nxv16i8_nxv16i16_nxv16i8( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_wv_nxv16i8_nxv16i16_nxv16i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v8, v12, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv16i8.nxv16i16.nxv16i8( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv32i8.nxv32i16.nxv32i8( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_wv_nxv32i8_nxv32i16_nxv32i8( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_wv_nxv32i8_nxv32i16_nxv32i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v20, v8, v16 +; CHECK-NEXT: th.vmv.v.v v8, v20 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv32i8.nxv32i16.nxv32i8( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv32i8.nxv32i16.nxv32i8( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_wv_nxv32i8_nxv32i16_nxv32i8( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_wv_nxv32i8_nxv32i16_nxv32i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v8, v16, v12, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv32i8.nxv32i16.nxv32i8( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv4i16.nxv4i32.nxv4i16( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_wv_nxv4i16_nxv4i32_nxv4i16( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_wv_nxv4i16_nxv4i32_nxv4i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v11, v8, v10 +; CHECK-NEXT: th.vmv.v.v v8, v11 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv4i16.nxv4i32.nxv4i16( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv4i16.nxv4i32.nxv4i16( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_wv_nxv4i16_nxv4i32_nxv4i16( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_wv_nxv4i16_nxv4i32_nxv4i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v8, v10, v9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv4i16.nxv4i32.nxv4i16( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv8i16.nxv8i32.nxv8i16( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_wv_nxv8i16_nxv8i32_nxv8i16( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_wv_nxv8i16_nxv8i32_nxv8i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v14, v8, v12 +; CHECK-NEXT: th.vmv.v.v v8, v14 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv8i16.nxv8i32.nxv8i16( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv8i16.nxv8i32.nxv8i16( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_wv_nxv8i16_nxv8i32_nxv8i16( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_wv_nxv8i16_nxv8i32_nxv8i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v8, v12, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv8i16.nxv8i32.nxv8i16( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv16i16.nxv16i32.nxv16i16( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_wv_nxv16i16_nxv16i32_nxv16i16( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_wv_nxv16i16_nxv16i32_nxv16i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v20, v8, v16 +; CHECK-NEXT: th.vmv.v.v v8, v20 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv16i16.nxv16i32.nxv16i16( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv16i16.nxv16i32.nxv16i16( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_wv_nxv16i16_nxv16i32_nxv16i16( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_wv_nxv16i16_nxv16i32_nxv16i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v8, v16, v12, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv16i16.nxv16i32.nxv16i16( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv2i32.nxv2i64.nxv2i32( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_wv_nxv2i32_nxv2i64_nxv2i32( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_wv_nxv2i32_nxv2i64_nxv2i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v11, v8, v10 +; CHECK-NEXT: th.vmv.v.v v8, v11 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv2i32.nxv2i64.nxv2i32( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv2i32.nxv2i64.nxv2i32( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_wv_nxv2i32_nxv2i64_nxv2i32( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_wv_nxv2i32_nxv2i64_nxv2i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v8, v10, v9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv2i32.nxv2i64.nxv2i32( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv4i32.nxv4i64.nxv4i32( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_wv_nxv4i32_nxv4i64_nxv4i32( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_wv_nxv4i32_nxv4i64_nxv4i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v14, v8, v12 +; CHECK-NEXT: th.vmv.v.v v8, v14 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv4i32.nxv4i64.nxv4i32( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv4i32.nxv4i64.nxv4i32( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_wv_nxv4i32_nxv4i64_nxv4i32( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_wv_nxv4i32_nxv4i64_nxv4i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v8, v12, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv4i32.nxv4i64.nxv4i32( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv8i32.nxv8i64.nxv8i32( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_wv_nxv8i32_nxv8i64_nxv8i32( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_wv_nxv8i32_nxv8i64_nxv8i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v20, v8, v16 +; CHECK-NEXT: th.vmv.v.v v8, v20 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv8i32.nxv8i64.nxv8i32( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv8i32.nxv8i64.nxv8i32( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_wv_nxv8i32_nxv8i64_nxv8i32( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_wv_nxv8i32_nxv8i64_nxv8i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vv v8, v16, v12, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv8i32.nxv8i64.nxv8i32( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv8i8.nxv8i16( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclip_vx_nxv8i8_nxv8i16( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vx_nxv8i8_nxv8i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e8, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v10, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv8i8.nxv8i16( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv8i8.nxv8i16( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_vx_nxv8i8_nxv8i16( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vx_nxv8i8_nxv8i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e8, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v8, v10, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv8i8.nxv8i16( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv16i8.nxv16i16( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclip_vx_nxv16i8_nxv16i16( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vx_nxv16i8_nxv16i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e8, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v12, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv16i8.nxv16i16( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv16i8.nxv16i16( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_vx_nxv16i8_nxv16i16( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vx_nxv16i8_nxv16i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e8, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v8, v12, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv16i8.nxv16i16( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv32i8.nxv32i16( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclip_vx_nxv32i8_nxv32i16( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vx_nxv32i8_nxv32i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e8, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v16, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv32i8.nxv32i16( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv32i8.nxv32i16( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_vx_nxv32i8_nxv32i16( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vx_nxv32i8_nxv32i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e8, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v8, v16, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv32i8.nxv32i16( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv4i16.nxv4i32( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclip_vx_nxv4i16_nxv4i32( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vx_nxv4i16_nxv4i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e16, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v10, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv4i16.nxv4i32( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv4i16.nxv4i32( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_vx_nxv4i16_nxv4i32( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vx_nxv4i16_nxv4i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e16, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v8, v10, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv4i16.nxv4i32( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv8i16.nxv8i32( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclip_vx_nxv8i16_nxv8i32( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vx_nxv8i16_nxv8i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e16, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v12, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv8i16.nxv8i32( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv8i16.nxv8i32( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_vx_nxv8i16_nxv8i32( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vx_nxv8i16_nxv8i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e16, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v8, v12, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv8i16.nxv8i32( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv16i16.nxv16i32( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclip_vx_nxv16i16_nxv16i32( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vx_nxv16i16_nxv16i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e16, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v16, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv16i16.nxv16i32( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv16i16.nxv16i32( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_vx_nxv16i16_nxv16i32( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vx_nxv16i16_nxv16i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e16, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v8, v16, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv16i16.nxv16i32( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv2i32.nxv2i64( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclip_vx_nxv2i32_nxv2i64( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vx_nxv2i32_nxv2i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e32, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v10, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv2i32.nxv2i64( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv2i32.nxv2i64( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_vx_nxv2i32_nxv2i64( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vx_nxv2i32_nxv2i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e32, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v8, v10, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv2i32.nxv2i64( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv4i32.nxv4i64( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclip_vx_nxv4i32_nxv4i64( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vx_nxv4i32_nxv4i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e32, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v12, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv4i32.nxv4i64( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv4i32.nxv4i64( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_vx_nxv4i32_nxv4i64( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vx_nxv4i32_nxv4i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e32, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v8, v12, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv4i32.nxv4i64( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclip.nxv8i32.nxv8i64( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclip_vx_nxv8i32_nxv8i64( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vx_nxv8i32_nxv8i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e32, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v16, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv8i32.nxv8i64( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclip.mask.nxv8i32.nxv8i64( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclip_mask_vx_nxv8i32_nxv8i64( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vx_nxv8i32_nxv8i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e32, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vx v8, v16, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv8i32.nxv8i64( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +define @intrinsic_vnclip_vi_nxv8i8_nxv8i16_i8( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vi_nxv8i8_nxv8i16_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v10, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv8i8.nxv8i16( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclip_mask_vi_nxv8i8_nxv8i16_i8( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vi_nxv8i8_nxv8i16_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v8, v10, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv8i8.nxv8i16( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclip_vi_nxv16i8_nxv16i16_i8( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vi_nxv16i8_nxv16i16_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v12, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv16i8.nxv16i16( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclip_mask_vi_nxv16i8_nxv16i16_i8( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vi_nxv16i8_nxv16i16_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v8, v12, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv16i8.nxv16i16( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclip_vi_nxv32i8_nxv32i16_i8( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vi_nxv32i8_nxv32i16_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v16, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv32i8.nxv32i16( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclip_mask_vi_nxv32i8_nxv32i16_i8( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vi_nxv32i8_nxv32i16_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v8, v16, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv32i8.nxv32i16( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclip_vi_nxv4i16_nxv4i32_i16( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vi_nxv4i16_nxv4i32_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v10, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv4i16.nxv4i32( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclip_mask_vi_nxv4i16_nxv4i32_i16( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vi_nxv4i16_nxv4i32_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v8, v10, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv4i16.nxv4i32( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclip_vi_nxv8i16_nxv8i32_i16( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vi_nxv8i16_nxv8i32_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v12, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv8i16.nxv8i32( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclip_mask_vi_nxv8i16_nxv8i32_i16( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vi_nxv8i16_nxv8i32_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v8, v12, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv8i16.nxv8i32( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclip_vi_nxv16i16_nxv16i32_i16( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vi_nxv16i16_nxv16i32_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v16, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv16i16.nxv16i32( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclip_mask_vi_nxv16i16_nxv16i32_i16( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vi_nxv16i16_nxv16i32_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v8, v16, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv16i16.nxv16i32( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclip_vi_nxv2i32_nxv2i64_i32( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vi_nxv2i32_nxv2i64_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v10, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv2i32.nxv2i64( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclip_mask_vi_nxv2i32_nxv2i64_i32( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vi_nxv2i32_nxv2i64_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v8, v10, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv2i32.nxv2i64( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclip_vi_nxv4i32_nxv4i64_i32( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vi_nxv4i32_nxv4i64_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v12, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv4i32.nxv4i64( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclip_mask_vi_nxv4i32_nxv4i64_i32( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vi_nxv4i32_nxv4i64_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v8, v12, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv4i32.nxv4i64( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclip_vi_nxv8i32_nxv8i64_i32( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclip_vi_nxv8i32_nxv8i64_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v16, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.nxv8i32.nxv8i64( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclip_mask_vi_nxv8i32_nxv8i64_i32( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclip_mask_vi_nxv8i32_nxv8i64_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclip.vi v8, v16, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclip.mask.nxv8i32.nxv8i64( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} diff --git a/llvm/test/CodeGen/RISCV/rvv0p71/vnclipu.ll b/llvm/test/CodeGen/RISCV/rvv0p71/vnclipu.ll new file mode 100644 index 00000000000000..80038d9d26b3ca --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv0p71/vnclipu.ll @@ -0,0 +1,1814 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+xtheadvector \ +; RUN: -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK +; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+xtheadvector \ +; RUN: -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK + +declare @llvm.riscv.th.vnclipu.nxv8i8.nxv8i16.nxv8i8( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_wv_nxv8i8_nxv8i16_nxv8i8( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_wv_nxv8i8_nxv8i16_nxv8i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v11, v8, v10 +; CHECK-NEXT: th.vmv.v.v v8, v11 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv8i8.nxv8i16.nxv8i8( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv8i8.nxv8i16.nxv8i8( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_wv_nxv8i8_nxv8i16_nxv8i8( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_wv_nxv8i8_nxv8i16_nxv8i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v8, v10, v9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv8i8.nxv8i16.nxv8i8( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv16i8.nxv16i16.nxv16i8( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_wv_nxv16i8_nxv16i16_nxv16i8( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_wv_nxv16i8_nxv16i16_nxv16i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v14, v8, v12 +; CHECK-NEXT: th.vmv.v.v v8, v14 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv16i8.nxv16i16.nxv16i8( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv16i8.nxv16i16.nxv16i8( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_wv_nxv16i8_nxv16i16_nxv16i8( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_wv_nxv16i8_nxv16i16_nxv16i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v8, v12, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv16i8.nxv16i16.nxv16i8( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv32i8.nxv32i16.nxv32i8( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_wv_nxv32i8_nxv32i16_nxv32i8( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_wv_nxv32i8_nxv32i16_nxv32i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v20, v8, v16 +; CHECK-NEXT: th.vmv.v.v v8, v20 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv32i8.nxv32i16.nxv32i8( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv32i8.nxv32i16.nxv32i8( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_wv_nxv32i8_nxv32i16_nxv32i8( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_wv_nxv32i8_nxv32i16_nxv32i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v8, v16, v12, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv32i8.nxv32i16.nxv32i8( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv4i16.nxv4i32.nxv4i16( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_wv_nxv4i16_nxv4i32_nxv4i16( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_wv_nxv4i16_nxv4i32_nxv4i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v11, v8, v10 +; CHECK-NEXT: th.vmv.v.v v8, v11 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv4i16.nxv4i32.nxv4i16( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv4i16.nxv4i32.nxv4i16( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_wv_nxv4i16_nxv4i32_nxv4i16( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_wv_nxv4i16_nxv4i32_nxv4i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v8, v10, v9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv4i16.nxv4i32.nxv4i16( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv8i16.nxv8i32.nxv8i16( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_wv_nxv8i16_nxv8i32_nxv8i16( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_wv_nxv8i16_nxv8i32_nxv8i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v14, v8, v12 +; CHECK-NEXT: th.vmv.v.v v8, v14 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv8i16.nxv8i32.nxv8i16( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv8i16.nxv8i32.nxv8i16( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_wv_nxv8i16_nxv8i32_nxv8i16( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_wv_nxv8i16_nxv8i32_nxv8i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v8, v12, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv8i16.nxv8i32.nxv8i16( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv16i16.nxv16i32.nxv16i16( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_wv_nxv16i16_nxv16i32_nxv16i16( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_wv_nxv16i16_nxv16i32_nxv16i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v20, v8, v16 +; CHECK-NEXT: th.vmv.v.v v8, v20 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv16i16.nxv16i32.nxv16i16( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv16i16.nxv16i32.nxv16i16( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_wv_nxv16i16_nxv16i32_nxv16i16( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_wv_nxv16i16_nxv16i32_nxv16i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v8, v16, v12, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv16i16.nxv16i32.nxv16i16( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv2i32.nxv2i64.nxv2i32( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_wv_nxv2i32_nxv2i64_nxv2i32( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_wv_nxv2i32_nxv2i64_nxv2i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v11, v8, v10 +; CHECK-NEXT: th.vmv.v.v v8, v11 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv2i32.nxv2i64.nxv2i32( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv2i32.nxv2i64.nxv2i32( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_wv_nxv2i32_nxv2i64_nxv2i32( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_wv_nxv2i32_nxv2i64_nxv2i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v8, v10, v9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv2i32.nxv2i64.nxv2i32( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv4i32.nxv4i64.nxv4i32( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_wv_nxv4i32_nxv4i64_nxv4i32( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_wv_nxv4i32_nxv4i64_nxv4i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v14, v8, v12 +; CHECK-NEXT: th.vmv.v.v v8, v14 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv4i32.nxv4i64.nxv4i32( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv4i32.nxv4i64.nxv4i32( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_wv_nxv4i32_nxv4i64_nxv4i32( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_wv_nxv4i32_nxv4i64_nxv4i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v8, v12, v10, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv4i32.nxv4i64.nxv4i32( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv8i32.nxv8i64.nxv8i32( + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_wv_nxv8i32_nxv8i64_nxv8i32( %0, %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_wv_nxv8i32_nxv8i64_nxv8i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v20, v8, v16 +; CHECK-NEXT: th.vmv.v.v v8, v20 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv8i32.nxv8i64.nxv8i32( + undef, + %0, + %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv8i32.nxv8i64.nxv8i32( + , + , + , + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_wv_nxv8i32_nxv8i64_nxv8i32( %0, %1, %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_wv_nxv8i32_nxv8i64_nxv8i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vv v8, v16, v12, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv8i32.nxv8i64.nxv8i32( + %0, + %1, + %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv8i8.nxv8i16( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclipu_vx_nxv8i8_nxv8i16( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vx_nxv8i8_nxv8i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e8, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v10, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv8i8.nxv8i16( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv8i8.nxv8i16( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_vx_nxv8i8_nxv8i16( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vx_nxv8i8_nxv8i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e8, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v8, v10, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv8i8.nxv8i16( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv16i8.nxv16i16( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclipu_vx_nxv16i8_nxv16i16( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vx_nxv16i8_nxv16i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e8, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v12, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv16i8.nxv16i16( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv16i8.nxv16i16( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_vx_nxv16i8_nxv16i16( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vx_nxv16i8_nxv16i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e8, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v8, v12, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv16i8.nxv16i16( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv32i8.nxv32i16( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclipu_vx_nxv32i8_nxv32i16( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vx_nxv32i8_nxv32i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e8, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v16, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv32i8.nxv32i16( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv32i8.nxv32i16( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_vx_nxv32i8_nxv32i16( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vx_nxv32i8_nxv32i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e8, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v8, v16, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv32i8.nxv32i16( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv4i16.nxv4i32( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclipu_vx_nxv4i16_nxv4i32( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vx_nxv4i16_nxv4i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e16, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v10, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv4i16.nxv4i32( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv4i16.nxv4i32( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_vx_nxv4i16_nxv4i32( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vx_nxv4i16_nxv4i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e16, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v8, v10, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv4i16.nxv4i32( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv8i16.nxv8i32( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclipu_vx_nxv8i16_nxv8i32( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vx_nxv8i16_nxv8i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e16, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v12, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv8i16.nxv8i32( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv8i16.nxv8i32( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_vx_nxv8i16_nxv8i32( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vx_nxv8i16_nxv8i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e16, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v8, v12, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv8i16.nxv8i32( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv16i16.nxv16i32( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclipu_vx_nxv16i16_nxv16i32( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vx_nxv16i16_nxv16i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e16, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v16, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv16i16.nxv16i32( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv16i16.nxv16i32( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_vx_nxv16i16_nxv16i32( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vx_nxv16i16_nxv16i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e16, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v8, v16, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv16i16.nxv16i32( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv2i32.nxv2i64( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclipu_vx_nxv2i32_nxv2i64( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vx_nxv2i32_nxv2i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e32, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v10, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv2i32.nxv2i64( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv2i32.nxv2i64( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_vx_nxv2i32_nxv2i64( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vx_nxv2i32_nxv2i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e32, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v8, v10, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv2i32.nxv2i64( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv4i32.nxv4i64( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclipu_vx_nxv4i32_nxv4i64( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vx_nxv4i32_nxv4i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e32, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v12, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv4i32.nxv4i64( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv4i32.nxv4i64( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_vx_nxv4i32_nxv4i64( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vx_nxv4i32_nxv4i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e32, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v8, v12, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv4i32.nxv4i64( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.nxv8i32.nxv8i64( + , + , + iXLen, iXLen, iXLen); + +define @intrinsic_vnclipu_vx_nxv8i32_nxv8i64( %0, iXLen %1, iXLen %2) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vx_nxv8i32_nxv8i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e32, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v16, v8, a0 +; CHECK-NEXT: th.vmv.v.v v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv8i32.nxv8i64( + undef, + %0, + iXLen %1, + iXLen 0, iXLen %2) + + ret %a +} + +declare @llvm.riscv.th.vnclipu.mask.nxv8i32.nxv8i64( + , + , + iXLen, + , + iXLen, iXLen); + +define @intrinsic_vnclipu_mask_vx_nxv8i32_nxv8i64( %0, %1, iXLen %2, %3, iXLen %4) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vx_nxv8i32_nxv8i64: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: csrr a2, vl +; CHECK-NEXT: csrr a3, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a2, a3 +; CHECK-NEXT: th.vsetvli zero, a1, e32, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vx v8, v16, a0, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv8i32.nxv8i64( + %0, + %1, + iXLen %2, + %3, + iXLen 0, iXLen %4) + + ret %a +} + +define @intrinsic_vnclipu_vi_nxv8i8_nxv8i16_i8( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vi_nxv8i8_nxv8i16_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v10, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv8i8.nxv8i16( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclipu_mask_vi_nxv8i8_nxv8i16_i8( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vi_nxv8i8_nxv8i16_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v8, v10, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv8i8.nxv8i16( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclipu_vi_nxv16i8_nxv16i16_i8( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vi_nxv16i8_nxv16i16_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v12, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv16i8.nxv16i16( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclipu_mask_vi_nxv16i8_nxv16i16_i8( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vi_nxv16i8_nxv16i16_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v8, v12, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv16i8.nxv16i16( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclipu_vi_nxv32i8_nxv32i16_i8( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vi_nxv32i8_nxv32i16_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v16, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv32i8.nxv32i16( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclipu_mask_vi_nxv32i8_nxv32i16_i8( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vi_nxv32i8_nxv32i16_i8: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e8, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v8, v16, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv32i8.nxv32i16( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclipu_vi_nxv4i16_nxv4i32_i16( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vi_nxv4i16_nxv4i32_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v10, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv4i16.nxv4i32( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclipu_mask_vi_nxv4i16_nxv4i32_i16( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vi_nxv4i16_nxv4i32_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v8, v10, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv4i16.nxv4i32( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclipu_vi_nxv8i16_nxv8i32_i16( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vi_nxv8i16_nxv8i32_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v12, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv8i16.nxv8i32( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclipu_mask_vi_nxv8i16_nxv8i32_i16( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vi_nxv8i16_nxv8i32_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v8, v12, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv8i16.nxv8i32( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclipu_vi_nxv16i16_nxv16i32_i16( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vi_nxv16i16_nxv16i32_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v16, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv16i16.nxv16i32( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclipu_mask_vi_nxv16i16_nxv16i32_i16( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vi_nxv16i16_nxv16i32_i16: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e16, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v8, v16, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv16i16.nxv16i32( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclipu_vi_nxv2i32_nxv2i64_i32( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vi_nxv2i32_nxv2i64_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v10, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v10 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv2i32.nxv2i64( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclipu_mask_vi_nxv2i32_nxv2i64_i32( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vi_nxv2i32_nxv2i64_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m1, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v8, v10, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv2i32.nxv2i64( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclipu_vi_nxv4i32_nxv4i64_i32( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vi_nxv4i32_nxv4i64_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v12, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v12 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv4i32.nxv4i64( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclipu_mask_vi_nxv4i32_nxv4i64_i32( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vi_nxv4i32_nxv4i64_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m2, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v8, v12, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv4i32.nxv4i64( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +} + +define @intrinsic_vnclipu_vi_nxv8i32_nxv8i64_i32( %0, iXLen %1) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_vi_nxv8i32_nxv8i64_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v16, v8, 9 +; CHECK-NEXT: th.vmv.v.v v8, v16 +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.nxv8i32.nxv8i64( + undef, + %0, + iXLen 9, + iXLen 0, iXLen %1) + + ret %a +} + +define @intrinsic_vnclipu_mask_vi_nxv8i32_nxv8i64_i32( %0, %1, %2, iXLen %3) nounwind { +; CHECK-LABEL: intrinsic_vnclipu_mask_vi_nxv8i32_nxv8i64_i32: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: csrr a1, vl +; CHECK-NEXT: csrr a2, vtype +; CHECK-NEXT: th.vsetvli zero, zero, e8, m1, d1 +; CHECK-NEXT: th.vsetvl zero, a1, a2 +; CHECK-NEXT: th.vsetvli zero, a0, e32, m4, d1 +; CHECK-NEXT: csrwi vxrm, 0 +; CHECK-NEXT: th.vnclipu.vi v8, v16, 9, v0.t +; CHECK-NEXT: ret +entry: + %a = call @llvm.riscv.th.vnclipu.mask.nxv8i32.nxv8i64( + %0, + %1, + iXLen 9, + %2, + iXLen 0, iXLen %3) + + ret %a +}