@@ -291,6 +291,21 @@ let TargetPrefix = "riscv" in {
291
291
[IntrNoMem]>, RISCVVIntrinsic {
292
292
let SplatOperand = 3;
293
293
}
294
+ // For destination vector type is the same as first source vector. The
295
+ // second source operand must match the destination type or be an XLen scalar.
296
+ // Input: (vector_in, vector_in/scalar_in, vl)
297
+ class RISCVBinaryAAShiftNoMask
298
+ : Intrinsic<[llvm_anyvector_ty],
299
+ [LLVMMatchType<0>, llvm_any_ty, llvm_anyint_ty],
300
+ [IntrNoMem]>, RISCVVIntrinsic;
301
+ // For destination vector type is the same as first source vector (with mask).
302
+ // The second source operand must match the destination type or be an XLen scalar.
303
+ // Input: (maskedoff, vector_in, vector_in/scalar_in, mask, vl)
304
+ class RISCVBinaryAAShiftMask
305
+ : Intrinsic<[llvm_anyvector_ty],
306
+ [LLVMMatchType<0>, LLVMMatchType<0>, llvm_any_ty,
307
+ LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty],
308
+ [IntrNoMem]>, RISCVVIntrinsic;
294
309
// For destination vector type is NOT the same as first source vector.
295
310
// Input: (vector_in, vector_in/scalar_in, vl)
296
311
class RISCVBinaryABXNoMask
@@ -308,6 +323,21 @@ let TargetPrefix = "riscv" in {
308
323
[IntrNoMem]>, RISCVVIntrinsic {
309
324
let SplatOperand = 3;
310
325
}
326
+ // For destination vector type is NOT the same as first source vector. The
327
+ // second source operand must match the destination type or be an XLen scalar.
328
+ // Input: (vector_in, vector_in/scalar_in, vl)
329
+ class RISCVBinaryABShiftNoMask
330
+ : Intrinsic<[llvm_anyvector_ty],
331
+ [llvm_anyvector_ty, llvm_any_ty, llvm_anyint_ty],
332
+ [IntrNoMem]>, RISCVVIntrinsic;
333
+ // For destination vector type is NOT the same as first source vector (with mask).
334
+ // The second source operand must match the destination type or be an XLen scalar.
335
+ // Input: (maskedoff, vector_in, vector_in/scalar_in, mask, vl)
336
+ class RISCVBinaryABShiftMask
337
+ : Intrinsic<[llvm_anyvector_ty],
338
+ [LLVMMatchType<0>, llvm_anyvector_ty, llvm_any_ty,
339
+ LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty],
340
+ [IntrNoMem]>, RISCVVIntrinsic;
311
341
// For binary operations with V0 as input.
312
342
// Input: (vector_in, vector_in/scalar_in, V0, vl)
313
343
class RISCVBinaryWithV0
@@ -393,24 +423,39 @@ let TargetPrefix = "riscv" in {
393
423
let SplatOperand = 3;
394
424
}
395
425
// For Saturating binary operations.
426
+ // The destination vector type is the same as first source vector.
427
+ // The second source operand matches the destination type or is an XLen scalar.
428
+ // Input: (vector_in, vector_in/scalar_in, vl)
429
+ class RISCVSaturatingBinaryAAShiftNoMask
430
+ : Intrinsic<[llvm_anyvector_ty],
431
+ [LLVMMatchType<0>, llvm_any_ty, llvm_anyint_ty],
432
+ [IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic;
433
+ // For Saturating binary operations with mask.
434
+ // The destination vector type is the same as first source vector.
435
+ // The second source operand matches the destination type or is an XLen scalar.
436
+ // Input: (maskedoff, vector_in, vector_in/scalar_in, mask, vl)
437
+ class RISCVSaturatingBinaryAAShiftMask
438
+ : Intrinsic<[llvm_anyvector_ty],
439
+ [LLVMMatchType<0>, LLVMMatchType<0>, llvm_any_ty,
440
+ LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty],
441
+ [IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic;
442
+ // For Saturating binary operations.
396
443
// The destination vector type is NOT the same as first source vector.
444
+ // The second source operand matches the destination type or is an XLen scalar.
397
445
// Input: (vector_in, vector_in/scalar_in, vl)
398
- class RISCVSaturatingBinaryABXNoMask
446
+ class RISCVSaturatingBinaryABShiftNoMask
399
447
: Intrinsic<[llvm_anyvector_ty],
400
448
[llvm_anyvector_ty, llvm_any_ty, llvm_anyint_ty],
401
- [IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic {
402
- let SplatOperand = 2;
403
- }
449
+ [IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic;
404
450
// For Saturating binary operations with mask.
405
451
// The destination vector type is NOT the same as first source vector (with mask).
452
+ // The second source operand matches the destination type or is an XLen scalar.
406
453
// Input: (maskedoff, vector_in, vector_in/scalar_in, mask, vl)
407
- class RISCVSaturatingBinaryABXMask
454
+ class RISCVSaturatingBinaryABShiftMask
408
455
: Intrinsic<[llvm_anyvector_ty],
409
456
[LLVMMatchType<0>, llvm_anyvector_ty, llvm_any_ty,
410
457
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty],
411
- [IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic {
412
- let SplatOperand = 3;
413
- }
458
+ [IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic;
414
459
class RISCVTernaryAAAXNoMask
415
460
: Intrinsic<[llvm_anyvector_ty],
416
461
[LLVMMatchType<0>, LLVMMatchType<0>, llvm_anyint_ty,
@@ -725,6 +770,12 @@ let TargetPrefix = "riscv" in {
725
770
def "int_riscv_" # NAME : RISCVBinaryAAXNoMask;
726
771
def "int_riscv_" # NAME # "_mask" : RISCVBinaryAAXMask;
727
772
}
773
+ // Like RISCVBinaryAAX, but the second operand is used a shift amount so it
774
+ // must be a vector or an XLen scalar.
775
+ multiclass RISCVBinaryAAShift {
776
+ def "int_riscv_" # NAME : RISCVBinaryAAShiftNoMask;
777
+ def "int_riscv_" # NAME # "_mask" : RISCVBinaryAAShiftMask;
778
+ }
728
779
multiclass RISCVRGatherVV {
729
780
def "int_riscv_" # NAME : RISCVRGatherVVNoMask;
730
781
def "int_riscv_" # NAME # "_mask" : RISCVRGatherVVMask;
@@ -743,6 +794,12 @@ let TargetPrefix = "riscv" in {
743
794
def "int_riscv_" # NAME : RISCVBinaryABXNoMask;
744
795
def "int_riscv_" # NAME # "_mask" : RISCVBinaryABXMask;
745
796
}
797
+ // Like RISCVBinaryABX, but the second operand is used a shift amount so it
798
+ // must be a vector or an XLen scalar.
799
+ multiclass RISCVBinaryABShift {
800
+ def "int_riscv_" # NAME : RISCVBinaryABShiftNoMask;
801
+ def "int_riscv_" # NAME # "_mask" : RISCVBinaryABShiftMask;
802
+ }
746
803
multiclass RISCVBinaryWithV0 {
747
804
def "int_riscv_" # NAME : RISCVBinaryWithV0;
748
805
}
@@ -756,9 +813,13 @@ let TargetPrefix = "riscv" in {
756
813
def "int_riscv_" # NAME : RISCVSaturatingBinaryAAXNoMask;
757
814
def "int_riscv_" # NAME # "_mask" : RISCVSaturatingBinaryAAXMask;
758
815
}
759
- multiclass RISCVSaturatingBinaryABX {
760
- def "int_riscv_" # NAME : RISCVSaturatingBinaryABXNoMask;
761
- def "int_riscv_" # NAME # "_mask" : RISCVSaturatingBinaryABXMask;
816
+ multiclass RISCVSaturatingBinaryAAShift {
817
+ def "int_riscv_" # NAME : RISCVSaturatingBinaryAAShiftNoMask;
818
+ def "int_riscv_" # NAME # "_mask" : RISCVSaturatingBinaryAAShiftMask;
819
+ }
820
+ multiclass RISCVSaturatingBinaryABShift {
821
+ def "int_riscv_" # NAME : RISCVSaturatingBinaryABShiftNoMask;
822
+ def "int_riscv_" # NAME # "_mask" : RISCVSaturatingBinaryABShiftMask;
762
823
}
763
824
multiclass RISCVTernaryAAAX {
764
825
def "int_riscv_" # NAME : RISCVTernaryAAAXNoMask;
@@ -880,12 +941,12 @@ let TargetPrefix = "riscv" in {
880
941
defm vor : RISCVBinaryAAX;
881
942
defm vxor : RISCVBinaryAAX;
882
943
883
- defm vsll : RISCVBinaryAAX ;
884
- defm vsrl : RISCVBinaryAAX ;
885
- defm vsra : RISCVBinaryAAX ;
944
+ defm vsll : RISCVBinaryAAShift ;
945
+ defm vsrl : RISCVBinaryAAShift ;
946
+ defm vsra : RISCVBinaryAAShift ;
886
947
887
- defm vnsrl : RISCVBinaryABX ;
888
- defm vnsra : RISCVBinaryABX ;
948
+ defm vnsrl : RISCVBinaryABShift ;
949
+ defm vnsra : RISCVBinaryABShift ;
889
950
890
951
defm vmseq : RISCVCompare;
891
952
defm vmsne : RISCVCompare;
@@ -1023,11 +1084,11 @@ let TargetPrefix = "riscv" in {
1023
1084
1024
1085
defm vsmul : RISCVSaturatingBinaryAAX;
1025
1086
1026
- defm vssrl : RISCVSaturatingBinaryAAX ;
1027
- defm vssra : RISCVSaturatingBinaryAAX ;
1087
+ defm vssrl : RISCVSaturatingBinaryAAShift ;
1088
+ defm vssra : RISCVSaturatingBinaryAAShift ;
1028
1089
1029
- defm vnclipu : RISCVSaturatingBinaryABX ;
1030
- defm vnclip : RISCVSaturatingBinaryABX ;
1090
+ defm vnclipu : RISCVSaturatingBinaryABShift ;
1091
+ defm vnclip : RISCVSaturatingBinaryABShift ;
1031
1092
1032
1093
defm vmfeq : RISCVCompare;
1033
1094
defm vmfne : RISCVCompare;
0 commit comments