@@ -26,7 +26,7 @@ class IsFloat<string type> {
26
26
27
27
let SupportOverloading = false,
28
28
MaskedPolicyScheme = NonePolicy in {
29
- class RVVVLEMaskBuiltin : RVVOutBuiltin <"m", "mPCUe", "c"> {
29
+ class RVVVLEMaskBuiltin : RVVOutOp0Builtin <"m", "mPCUe", "c"> {
30
30
let Name = "vlm_v";
31
31
let IRName = "vlm";
32
32
let HasMasked = false;
@@ -40,9 +40,9 @@ let SupportOverloading = false,
40
40
IRName = "vle",
41
41
MaskedIRName ="vle_mask" in {
42
42
foreach type = types in {
43
- def : RVVOutBuiltin <"v", "vPCe", type>;
43
+ def : RVVOutOp0Builtin <"v", "vPCe", type>;
44
44
if !not(IsFloat<type>.val) then {
45
- def : RVVOutBuiltin <"Uv", "UvPCUe", type>;
45
+ def : RVVOutOp0Builtin <"Uv", "UvPCUe", type>;
46
46
}
47
47
}
48
48
}
@@ -63,11 +63,11 @@ multiclass RVVVLEFFBuiltin<list<string> types> {
63
63
if ((PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA))
64
64
Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
65
65
Ops.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
66
- IntrinsicTypes = {ResultType, Ops[4]->getType()};
66
+ IntrinsicTypes = {ResultType, Ops[4]->getType(), Ops[2]->getType() };
67
67
} else {
68
68
if (PolicyAttrs & RVV_VTA)
69
69
Ops.insert(Ops.begin(), llvm::PoisonValue::get(ResultType));
70
- IntrinsicTypes = {ResultType, Ops[3]->getType()};
70
+ IntrinsicTypes = {ResultType, Ops[3]->getType(), Ops[1]->getType() };
71
71
}
72
72
Value *NewVL = Ops[2];
73
73
Ops.erase(Ops.begin() + 2);
@@ -102,9 +102,9 @@ multiclass RVVVLSEBuiltin<list<string> types> {
102
102
SupportOverloading = false,
103
103
UnMaskedPolicyScheme = HasPassthruOperand in {
104
104
foreach type = types in {
105
- def : RVVOutBuiltin <"v", "vPCet", type>;
105
+ def : RVVOutOp0Builtin <"v", "vPCet", type>;
106
106
if !not(IsFloat<type>.val) then {
107
- def : RVVOutBuiltin <"Uv", "UvPCUet", type>;
107
+ def : RVVOutOp0Builtin <"Uv", "UvPCUet", type>;
108
108
}
109
109
}
110
110
}
@@ -120,9 +120,9 @@ multiclass RVVIndexedLoad<string op> {
120
120
RequiredFeatures = !if(!eq(type, "x"), ["Zvfhmin"],
121
121
!if(!eq(type, "y"), ["Zvfbfmin"],
122
122
[]<string>)) in {
123
- def: RVVOutOp1Builtin <"v", "vPCe" # eew_type # "Uv", type>;
123
+ def: RVVOutOp0Op1Builtin <"v", "vPCe" # eew_type # "Uv", type>;
124
124
if !not(IsFloat<type>.val) then {
125
- def: RVVOutOp1Builtin <"Uv", "UvPCUe" # eew_type # "Uv", type>;
125
+ def: RVVOutOp0Op1Builtin <"Uv", "UvPCUe" # eew_type # "Uv", type>;
126
126
}
127
127
}
128
128
}
@@ -132,9 +132,9 @@ multiclass RVVIndexedLoad<string op> {
132
132
RequiredFeatures = !if(!eq(type, "x"), ["Zvfhmin", "RV64"],
133
133
!if(!eq(type, "y"), ["Zvfbfmin", "RV64"],
134
134
["RV64"])) in {
135
- def: RVVOutOp1Builtin <"v", "vPCe" # eew64_type # "Uv", type>;
135
+ def: RVVOutOp0Op1Builtin <"v", "vPCe" # eew64_type # "Uv", type>;
136
136
if !not(IsFloat<type>.val) then {
137
- def: RVVOutOp1Builtin <"Uv", "UvPCUe" # eew64_type # "Uv", type>;
137
+ def: RVVOutOp0Op1Builtin <"Uv", "UvPCUe" # eew64_type # "Uv", type>;
138
138
}
139
139
}
140
140
}
@@ -152,9 +152,9 @@ let HasMaskedOffOperand = false,
152
152
std::swap(Ops[0], Ops[1]);
153
153
}
154
154
if (IsMasked)
155
- IntrinsicTypes = {Ops[0]->getType(), Ops[3]->getType()};
155
+ IntrinsicTypes = {Ops[0]->getType(), Ops[1]->getType(), Ops[ 3]->getType()};
156
156
else
157
- IntrinsicTypes = {Ops[0]->getType(), Ops[2]->getType()};
157
+ IntrinsicTypes = {Ops[0]->getType(), Ops[1]->getType(), Ops[ 2]->getType()};
158
158
}] in {
159
159
class RVVVSEMaskBuiltin : RVVBuiltin<"m", "0PUem", "c"> {
160
160
let Name = "vsm_v";
@@ -190,9 +190,9 @@ multiclass RVVVSSEBuiltin<list<string> types> {
190
190
std::rotate(Ops.begin(), Ops.begin() + 2, Ops.begin() + 3);
191
191
}
192
192
if (IsMasked)
193
- IntrinsicTypes = {Ops[0]->getType(), Ops[4]->getType()};
193
+ IntrinsicTypes = {Ops[0]->getType(), Ops[1]->getType(), Ops[ 4]->getType()};
194
194
else
195
- IntrinsicTypes = {Ops[0]->getType(), Ops[3]->getType()};
195
+ IntrinsicTypes = {Ops[0]->getType(), Ops[1]->getType(), Ops[ 3]->getType()};
196
196
}] in {
197
197
foreach type = types in {
198
198
def : RVVBuiltin<"v", "0Petv", type>;
@@ -215,9 +215,9 @@ multiclass RVVIndexedStore<string op> {
215
215
std::rotate(Ops.begin(), Ops.begin() + 2, Ops.begin() + 3);
216
216
}
217
217
if (IsMasked)
218
- IntrinsicTypes = {Ops[0]->getType(), Ops[2]->getType(), Ops[4]->getType()};
218
+ IntrinsicTypes = {Ops[0]->getType(), Ops[1]->getType(), Ops[ 2]->getType(), Ops[4]->getType()};
219
219
else
220
- IntrinsicTypes = {Ops[0]->getType(), Ops[2]->getType(), Ops[3]->getType()};
220
+ IntrinsicTypes = {Ops[0]->getType(), Ops[1]->getType(), Ops[ 2]->getType(), Ops[3]->getType()};
221
221
}] in {
222
222
foreach type = TypeList in {
223
223
foreach eew_list = EEWList[0-2] in {
@@ -762,17 +762,18 @@ multiclass RVVUnitStridedSegLoadTuple<string op> {
762
762
[]<string>)),
763
763
ManualCodegen = [{
764
764
{
765
- if (IsMasked)
766
- IntrinsicTypes = {ResultType, Ops[0]->getType(), Ops.back()->getType()};
767
- else
768
- IntrinsicTypes = {ResultType, Ops.back()->getType()};
769
765
SmallVector<llvm::Value*, 6> Operands;
770
766
771
767
bool NoPassthru =
772
768
(IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) |
773
769
(!IsMasked && (PolicyAttrs & RVV_VTA));
774
770
unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
775
771
772
+ if (IsMasked)
773
+ IntrinsicTypes = {ResultType, Ops[Offset]->getType(), Ops[0]->getType(), Ops.back()->getType()};
774
+ else
775
+ IntrinsicTypes = {ResultType, Ops[Offset]->getType(), Ops.back()->getType()};
776
+
776
777
if (NoPassthru) { // Push poison into passthru
777
778
Operands.push_back(llvm::PoisonValue::get(ResultType));
778
779
} else { // Push intrinsics operands into passthru
@@ -845,9 +846,9 @@ multiclass RVVUnitStridedSegStoreTuple<string op> {
845
846
Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
846
847
847
848
if (IsMasked)
848
- IntrinsicTypes = {Operands[0]->getType(), Ops[0]->getType(), Operands.back()->getType()};
849
+ IntrinsicTypes = {Operands[0]->getType(), Ops[Offset]->getType(), Ops[ 0]->getType(), Operands.back()->getType()};
849
850
else
850
- IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType()};
851
+ IntrinsicTypes = {Operands[0]->getType(), Ops[Offset]->getType(), Operands.back()->getType()};
851
852
llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
852
853
return Builder.CreateCall(F, Operands, "");
853
854
}
@@ -882,17 +883,18 @@ multiclass RVVUnitStridedSegLoadFFTuple<string op> {
882
883
[]<string>)),
883
884
ManualCodegen = [{
884
885
{
885
- if (IsMasked)
886
- IntrinsicTypes = {ResultType, Ops.back()->getType(), Ops[0]->getType()};
887
- else
888
- IntrinsicTypes = {ResultType, Ops.back()->getType()};
889
886
SmallVector<llvm::Value*, 6> Operands;
890
887
891
888
bool NoPassthru =
892
889
(IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) |
893
890
(!IsMasked && (PolicyAttrs & RVV_VTA));
894
891
unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
895
892
893
+ if (IsMasked)
894
+ IntrinsicTypes = {ResultType, Ops.back()->getType(), Ops[Offset]->getType(), Ops[0]->getType()};
895
+ else
896
+ IntrinsicTypes = {ResultType, Ops.back()->getType(), Ops[Offset]->getType()};
897
+
896
898
if (NoPassthru) { // Push poison into passthru
897
899
Operands.push_back(llvm::PoisonValue::get(ResultType));
898
900
} else { // Push intrinsics operands into passthru
@@ -957,17 +959,18 @@ multiclass RVVStridedSegLoadTuple<string op> {
957
959
[]<string>)),
958
960
ManualCodegen = [{
959
961
{
960
- if (IsMasked)
961
- IntrinsicTypes = {ResultType, Ops.back()->getType(), Ops[0]->getType()};
962
- else
963
- IntrinsicTypes = {ResultType, Ops.back()->getType()};
964
962
SmallVector<llvm::Value*, 7> Operands;
965
963
966
964
bool NoPassthru =
967
965
(IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) |
968
966
(!IsMasked && (PolicyAttrs & RVV_VTA));
969
967
unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
970
968
969
+ if (IsMasked)
970
+ IntrinsicTypes = {ResultType, Ops[Offset]->getType(), Ops.back()->getType(), Ops[0]->getType()};
971
+ else
972
+ IntrinsicTypes = {ResultType, Ops[Offset]->getType(), Ops.back()->getType()};
973
+
971
974
if (NoPassthru) { // Push poison into passthru
972
975
Operands.push_back(llvm::PoisonValue::get(ResultType));
973
976
} else { // Push intrinsics operands into passthru
@@ -1043,9 +1046,9 @@ multiclass RVVStridedSegStoreTuple<string op> {
1043
1046
Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
1044
1047
1045
1048
if (IsMasked)
1046
- IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType(), Ops[0]->getType()};
1049
+ IntrinsicTypes = {Operands[0]->getType(), Operands[1]->getType(), Operands .back()->getType(), Ops[0]->getType()};
1047
1050
else
1048
- IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType()};
1051
+ IntrinsicTypes = {Operands[0]->getType(), Operands[1]->getType(), Operands .back()->getType()};
1049
1052
llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
1050
1053
return Builder.CreateCall(F, Operands, "");
1051
1054
}
@@ -1099,11 +1102,13 @@ multiclass RVVIndexedSegLoadTuple<string op> {
1099
1102
Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
1100
1103
1101
1104
if (IsMasked)
1102
- IntrinsicTypes = {ResultType, Ops[Offset + 1]->getType(),
1105
+ IntrinsicTypes = {ResultType, Ops[Offset]->getType(),
1106
+ Ops[Offset + 1]->getType(),
1103
1107
Ops[0]->getType(),
1104
1108
Ops.back()->getType()};
1105
1109
else
1106
- IntrinsicTypes = {ResultType, Ops[Offset + 1]->getType(),
1110
+ IntrinsicTypes = {ResultType, Ops[Offset]->getType(),
1111
+ Ops[Offset + 1]->getType(),
1107
1112
Ops.back()->getType()};
1108
1113
llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
1109
1114
llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
@@ -1160,11 +1165,11 @@ multiclass RVVIndexedSegStoreTuple<string op> {
1160
1165
Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
1161
1166
1162
1167
if (IsMasked)
1163
- IntrinsicTypes = {Operands[0]->getType(), Ops[Offset + 1]->getType(),
1168
+ IntrinsicTypes = {Operands[0]->getType(), Ops[Offset]->getType(), Ops[Offset + 1]->getType(),
1164
1169
Ops[0]->getType(),
1165
1170
Operands.back()->getType()};
1166
1171
else
1167
- IntrinsicTypes = {Operands[0]->getType(), Ops[Offset + 1]->getType(),
1172
+ IntrinsicTypes = {Operands[0]->getType(), Ops[Offset]->getType(), Ops[Offset + 1]->getType(),
1168
1173
Operands.back()->getType()};
1169
1174
llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
1170
1175
return Builder.CreateCall(F, Operands, "");
0 commit comments