Arm64/VectorOps: Remove redundant moves from SVE VSMin when possible

When the destination and first source alias one another, then we can
perform the operation in place without moving any data.
This commit is contained in:
Lioncache committed 2023-08-23 17:30:08 -04:00
1 parent c3faa019f5
commit 787b4f37fb
3 files changed
+15 -16

No files matched your search

@@ -1262,10 +1262,15 @@ DEF_OP(VSMin) {
if (HostSupportsSVE256 && Is256Bit) {
const auto Pred = PRED_TMP_32B.Merging();
// SVE SMIN is a destructive operation, so we need a temporary.
movprfx(VTMP1.Z(), Vector1.Z());
smin(SubRegSize, VTMP1.Z(), Pred, VTMP1.Z(), Vector2.Z());
mov(Dst.Z(), VTMP1.Z());
if (Dst == Vector1) {
// Trivial case where we can perform the operation in place.
smin(SubRegSize, Dst.Z(), Pred, Dst.Z(), Vector2.Z());
} else {
// SVE SMIN is a destructive operation, so we need a temporary.
movprfx(VTMP1.Z(), Vector1.Z());
smin(SubRegSize, VTMP1.Z(), Pred, VTMP1.Z(), Vector2.Z());
mov(Dst.Z(), VTMP1.Z());
}
} else {
switch (ElementSize) {
case 1:
+2 -4
View File
@@ -5959,7 +5959,7 @@
]
},
"vpminsw ymm0, ymm1, ymm2": {
"ExpectedInstructionCount": 6,
"ExpectedInstructionCount": 4,
"Optimal": "No",
"Comment": [
"Map 1 0b01 0xea 256-bit"
@@ -5967,9 +5967,7 @@
"ExpectedArm64ASM": [
"mov z4.d, p7/m, z17.d",
"mov z5.d, p7/m, z18.d",
"movprfx z0, z4",
"smin z0.h, p7/m, z0.h, z5.h",
"mov z4.d, z0.d",
"smin z4.h, p7/m, z4.h, z5.h",
"mov z16.d, p7/m, z4.d"
]
},
+4 -8
View File
@@ -1625,7 +1625,7 @@
]
},
"vpminsb ymm0, ymm1, ymm2": {
"ExpectedInstructionCount": 6,
"ExpectedInstructionCount": 4,
"Optimal": "No",
"Comment": [
"Map 2 0b01 0x38 256-bit"
@@ -1633,9 +1633,7 @@
"ExpectedArm64ASM": [
"mov z4.d, p7/m, z17.d",
"mov z5.d, p7/m, z18.d",
"movprfx z0, z4",
"smin z0.b, p7/m, z0.b, z5.b",
"mov z4.d, z0.d",
"smin z4.b, p7/m, z4.b, z5.b",
"mov z16.d, p7/m, z4.d"
]
},
@@ -1654,7 +1652,7 @@
]
},
"vpminsd ymm0, ymm1, ymm2": {
"ExpectedInstructionCount": 6,
"ExpectedInstructionCount": 4,
"Optimal": "No",
"Comment": [
"Map 2 0b01 0x39 256-bit"
@@ -1662,9 +1660,7 @@
"ExpectedArm64ASM": [
"mov z4.d, p7/m, z17.d",
"mov z5.d, p7/m, z18.d",
"movprfx z0, z4",
"smin z0.s, p7/m, z0.s, z5.s",
"mov z4.d, z0.d",
"smin z4.s, p7/m, z4.s, z5.s",
"mov z16.d, p7/m, z4.d"
]
},