[all-commits] [llvm/llvm-project] f33ea5: [RISCV] Remove redundant czero in multi-word compa...
Craig Topper via All-commits
all-commits at lists.llvm.org
Mon Feb 9 21:48:36 PST 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f33ea53451f01bd82cbe7bc7f795f5b4ba731f2b
https://github.com/llvm/llvm-project/commit/f33ea53451f01bd82cbe7bc7f795f5b4ba731f2b
Author: Craig Topper <craig.topper at sifive.com>
Date: 2026-02-09 (Mon, 09 Feb 2026)
Changed paths:
M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
M llvm/test/CodeGen/RISCV/condops.ll
M llvm/test/CodeGen/RISCV/xaluo.ll
Log Message:
-----------
[RISCV] Remove redundant czero in multi-word comparisons (#180485)
When comparing multi-word integers with Zicond, we generate:
(or (czero_eqz (lo1 < lo2), (hi1 == hi2)),
(czero_nez (hi1 < hi2), (hi1 == hi2)))
The czero_nez is redundant because when hi1 == hi2 is true, hi1 < hi2 is
already 0. This patch adds a DAG combine to recognize:
czero_nez (setcc X, Y, CC), (setcc X, Y, eq) -> (setcc X, Y, CC)
when CC is a strict inequality (lt, gt, ult, ugt).
This saves one instruction in 128-bit comparisons on RV64 with Zicond.
Note the czero_nez becomes a czero.eqz in the final assembly because the
seteq is replaced by an xor that produces 0 when the values are equal.
Part of #179584
Assisted-by: claude
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list