@@ -1373,110 +1373,23 @@ def extract_vector_element_different_indices : GICombineRule<
13731373 [{ return Helper.matchExtractVectorElementWithDifferentIndices(${root}, ${matchinfo}); }]),
13741374 (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
13751375
1376- def extract_vector_element_build_vector2 : GICombineRule<
1376+ def extract_vector_element_build_vector : GICombineRule<
13771377 (defs root:$root, build_fn_matchinfo:$matchinfo),
1378- (match (G_BUILD_VECTOR $src, $x, $y),
1379- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1380- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1381- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1382-
1383- def extract_vector_element_build_vector3 : GICombineRule<
1384- (defs root:$root, build_fn_matchinfo:$matchinfo),
1385- (match (G_BUILD_VECTOR $src, $x, $y, $z),
1386- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1387- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1388- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1389-
1390- def extract_vector_element_build_vector4 : GICombineRule<
1391- (defs root:$root, build_fn_matchinfo:$matchinfo),
1392- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a),
1393- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1394- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1395- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1396-
1397- def extract_vector_element_build_vector5 : GICombineRule<
1398- (defs root:$root, build_fn_matchinfo:$matchinfo),
1399- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a, $b),
1400- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1401- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1402- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1403-
1404- def extract_vector_element_build_vector6 : GICombineRule<
1405- (defs root:$root, build_fn_matchinfo:$matchinfo),
1406- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a, $b, $c),
1407- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1408- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1409- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1410-
1411- def extract_vector_element_build_vector7 : GICombineRule<
1412- (defs root:$root, build_fn_matchinfo:$matchinfo),
1413- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a, $b, $c, $d),
1414- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1415- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1416- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1417-
1418- def extract_vector_element_build_vector8 : GICombineRule<
1419- (defs root:$root, build_fn_matchinfo:$matchinfo),
1420- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a, $b, $c, $d, $e),
1421- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1422- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1423- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1424-
1425- def extract_vector_element_build_vector9 : GICombineRule<
1426- (defs root:$root, build_fn_matchinfo:$matchinfo),
1427- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a, $b, $c, $d, $e, $f),
1428- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1429- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1430- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1431-
1432- def extract_vector_element_build_vector10 : GICombineRule<
1433- (defs root:$root, build_fn_matchinfo:$matchinfo),
1434- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a, $b, $c, $d, $e, $f, $g),
1435- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1436- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1437- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1438-
1439- def extract_vector_element_build_vector11 : GICombineRule<
1440- (defs root:$root, build_fn_matchinfo:$matchinfo),
1441- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a, $b, $c, $d, $e, $f, $g, $h),
1442- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1443- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1444- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1445-
1446- def extract_vector_element_build_vector12 : GICombineRule<
1447- (defs root:$root, build_fn_matchinfo:$matchinfo),
1448- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a, $b, $c, $d, $e, $f, $g, $h, $i),
1449- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1450- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1451- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1452-
1453- def extract_vector_element_build_vector13 : GICombineRule<
1454- (defs root:$root, build_fn_matchinfo:$matchinfo),
1455- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a, $b, $c, $d, $e, $f, $g, $h, $i, $j),
1456- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1457- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1458- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1378+ (match (G_CONSTANT $idx, $imm),
1379+ (G_BUILD_VECTOR $src, GIVariadic<>:$unused):$Build,
1380+ (G_EXTRACT_VECTOR_ELT $root, $src, $idx):$Extract,
1381+ [{ return Helper.matchExtractVectorElementWithBuildVector(*${Extract}, *${Build},
1382+ ${matchinfo}); }]),
1383+ (apply [{ Helper.applyBuildFn(*${Extract}, ${matchinfo}); }])>;
14591384
1460- def extract_vector_element_build_vector14 : GICombineRule<
1461- (defs root:$root, build_fn_matchinfo:$matchinfo),
1462- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k),
1463- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1464- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1465- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1466-
1467- def extract_vector_element_build_vector15 : GICombineRule<
1385+ def extract_vector_element_shuffle_vector : GICombineRule<
14681386 (defs root:$root, build_fn_matchinfo:$matchinfo),
1469- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l),
1470- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1471- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1472- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1473-
1474- def extract_vector_element_build_vector16 : GICombineRule<
1475- (defs root:$root, build_fn_matchinfo:$matchinfo),
1476- (match (G_BUILD_VECTOR $src, $x, $y, $z, $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m),
1477- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1478- [{ return Helper.matchExtractVectorElementWithBuildVector(${root}, ${matchinfo}); }]),
1479- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1387+ (match (G_CONSTANT $idx, $imm),
1388+ (G_SHUFFLE_VECTOR $src, $src1, $src2, $mask):$Shuffle,
1389+ (G_EXTRACT_VECTOR_ELT $root, $src, $idx):$Extract,
1390+ [{ return Helper.matchExtractVectorElementWithShuffleVector(*${Extract}, *${Shuffle},
1391+ ${matchinfo}); }]),
1392+ (apply [{ Helper.applyBuildFn(*${Extract}, ${matchinfo}); }])>;
14801393
14811394def extract_vector_element_build_vector_trunc2 : GICombineRule<
14821395 (defs root:$root, build_fn_matchinfo:$matchinfo),
@@ -1547,13 +1460,6 @@ def nneg_zext : GICombineRule<
15471460 [{ return Helper.matchNonNegZext(${root}, ${matchinfo}); }]),
15481461 (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
15491462
1550- def extract_vector_element_shuffle_vector : GICombineRule<
1551- (defs root:$root, build_fn_matchinfo:$matchinfo),
1552- (match (G_SHUFFLE_VECTOR $src, $src1, $src2, $mask),
1553- (G_EXTRACT_VECTOR_ELT $root, $src, $idx),
1554- [{ return Helper.matchExtractVectorElementWithShuffleVector(${root}, ${matchinfo}); }]),
1555- (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
1556-
15571463// Combines concat operations
15581464def concat_matchinfo : GIDefMatchData<"SmallVector<Register>">;
15591465def combine_concat_vector : GICombineRule<
@@ -1647,20 +1553,7 @@ match_extract_of_element,
16471553insert_vector_elt_oob,
16481554extract_vector_element_not_const,
16491555extract_vector_element_different_indices,
1650- extract_vector_element_build_vector2,
1651- extract_vector_element_build_vector3,
1652- extract_vector_element_build_vector4,
1653- extract_vector_element_build_vector5,
1654- extract_vector_element_build_vector7,
1655- extract_vector_element_build_vector8,
1656- extract_vector_element_build_vector9,
1657- extract_vector_element_build_vector10,
1658- extract_vector_element_build_vector11,
1659- extract_vector_element_build_vector12,
1660- extract_vector_element_build_vector13,
1661- extract_vector_element_build_vector14,
1662- extract_vector_element_build_vector15,
1663- extract_vector_element_build_vector16,
1556+ extract_vector_element_build_vector,
16641557extract_vector_element_build_vector_trunc2,
16651558extract_vector_element_build_vector_trunc3,
16661559extract_vector_element_build_vector_trunc4,
0 commit comments