[llvm] [DAG] visitTRUNCATE - more aggressively fold trunc(add(x,x)) -> add(trunc(x),trunc(x)) (PR #164227)
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 20 06:02:25 PDT 2025
================
@@ -58,9 +58,8 @@ define i128 @f4(ptr %ptr) {
define i64 @f5(i128 %a) {
; CHECK-LABEL: f5:
; CHECK: # %bb.0:
-; CHECK-NEXT: vl %v0, 0(%r2), 3
-; CHECK-NEXT: vaq %v0, %v0, %v0
-; CHECK-NEXT: vlgvg %r2, %v0, 1
+; CHECK-NEXT: lg %r1, 8(%r2)
+; CHECK-NEXT: la %r2, 0(%r1,%r1)
----------------
uweigand wrote:
Hmm. These tests were intended to verify we get the correct sequence for a full i128->... truncation. The `add i128` was supposed to ensure we actually enter that path. Now that we optimize a truncation of addition, the tests are becoming somewhat pointless.
I guess we should then change those tests to use something else than `add`. Either some other operation that isn't optimized - or we might have to fall back to something like an inline asm to make really sure it cannot be optimized.
https://github.com/llvm/llvm-project/pull/164227
More information about the llvm-commits
mailing list