[llvm] [GlobalISel] Combine into abd[su] and legalize abd[su] (PR #118865)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 22:32:24 PST 2024


================
@@ -93,9 +147,14 @@ define <8 x i16> @abdu_const_bothhigh() {
 }
 
 define <8 x i16> @abdu_undef(<8 x i16> %src1) {
-; CHECK-LABEL: abdu_undef:
-; CHECK:       // %bb.0:
-; CHECK-NEXT:    ret
+; CHECK-SD-LABEL: abdu_undef:
+; CHECK-SD:       // %bb.0:
+; CHECK-SD-NEXT:    ret
+;
+; CHECK-GI-LABEL: abdu_undef:
+; CHECK-GI:       // %bb.0:
+; CHECK-GI-NEXT:    uabd v0.8h, v0.8h, v0.8h
----------------
tschuett wrote:

The IRTranslator almost faithfully imports the LLVM-IR. We combine the pattern into G_ABDU(%src1, undef). The instruction selector selects the G_ABDU as an uabd. My guess is that undef lead to picking the default register for the RHS aka v0. It looks odd that both operands are v0, but the RHS is probably the default pick.

https://github.com/llvm/llvm-project/pull/118865


More information about the llvm-commits mailing list