@@ -1188,36 +1188,34 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
1188
1188
}
1189
1189
1190
1190
case ' w' :
1191
- if (Name.startswith (" wasm.fma." )) {
1192
- rename (F);
1193
- NewFn = Intrinsic::getDeclaration (
1194
- F->getParent (), Intrinsic::wasm_relaxed_madd, F->getReturnType ());
1195
- return true ;
1196
- }
1197
- if (Name.startswith (" wasm.fms." )) {
1198
- rename (F);
1199
- NewFn = Intrinsic::getDeclaration (
1200
- F->getParent (), Intrinsic::wasm_relaxed_nmadd, F->getReturnType ());
1201
- return true ;
1202
- }
1203
- if (Name.startswith (" wasm.laneselect." )) {
1204
- rename (F);
1205
- NewFn = Intrinsic::getDeclaration (
1206
- F->getParent (), Intrinsic::wasm_relaxed_laneselect,
1207
- F->getReturnType ());
1208
- return true ;
1209
- }
1210
- if (Name == " wasm.dot.i8x16.i7x16.signed" ) {
1211
- rename (F);
1212
- NewFn = Intrinsic::getDeclaration (
1213
- F->getParent (), Intrinsic::wasm_relaxed_dot_i8x16_i7x16_signed);
1214
- return true ;
1215
- }
1216
- if (Name == " wasm.dot.i8x16.i7x16.add.signed" ) {
1217
- rename (F);
1218
- NewFn = Intrinsic::getDeclaration (
1219
- F->getParent (), Intrinsic::wasm_relaxed_dot_i8x16_i7x16_add_signed);
1220
- return true ;
1191
+ if (Name.consume_front (" wasm." )) {
1192
+ Intrinsic::ID ID =
1193
+ StringSwitch<Intrinsic::ID>(Name)
1194
+ .StartsWith (" fma." , Intrinsic::wasm_relaxed_madd)
1195
+ .StartsWith (" fms." , Intrinsic::wasm_relaxed_nmadd)
1196
+ .StartsWith (" laneselect." , Intrinsic::wasm_relaxed_laneselect)
1197
+ .Default (Intrinsic::not_intrinsic);
1198
+ if (ID != Intrinsic::not_intrinsic) {
1199
+ rename (F);
1200
+ NewFn =
1201
+ Intrinsic::getDeclaration (F->getParent (), ID, F->getReturnType ());
1202
+ return true ;
1203
+ }
1204
+
1205
+ if (Name.consume_front (" dot.i8x16.i7x16." )) {
1206
+ ID = StringSwitch<Intrinsic::ID>(Name)
1207
+ .Case (" signed" , Intrinsic::wasm_relaxed_dot_i8x16_i7x16_signed)
1208
+ .Case (" add.signed" ,
1209
+ Intrinsic::wasm_relaxed_dot_i8x16_i7x16_add_signed)
1210
+ .Default (Intrinsic::not_intrinsic);
1211
+ if (ID != Intrinsic::not_intrinsic) {
1212
+ rename (F);
1213
+ NewFn = Intrinsic::getDeclaration (F->getParent (), ID);
1214
+ return true ;
1215
+ }
1216
+ break ; // No other 'wasm.dot.i8x16.i7x16.*'.
1217
+ }
1218
+ break ; // No other 'wasm.*'.
1221
1219
}
1222
1220
break ;
1223
1221
0 commit comments