[all-commits] [llvm/llvm-project] a7554d: [LoongArch][ISel] Check the number of sign bits i...
hev via All-commits
all-commits at lists.llvm.org
Mon Sep 30 23:52:00 PDT 2024
Branch: refs/heads/release/19.x
Home: https://github.com/llvm/llvm-project
Commit: a7554dfc222b13624426ebd6ef46e122b9c16ee7
https://github.com/llvm/llvm-project/commit/a7554dfc222b13624426ebd6ef46e122b9c16ee7
Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
Date: 2024-10-01 (Tue, 01 Oct 2024)
Changed paths:
M llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
M llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem.ll
Log Message:
-----------
[LoongArch][ISel] Check the number of sign bits in `PatGprGpr_32` (#107432)
After https://github.com/llvm/llvm-project/pull/92205, LoongArch ISel
selects `div.w` for `trunc i64 (sdiv i64 3202030857, (sext i32 X to
i64)) to i32`. It is incorrect since `3202030857` is not a signed 32-bit
constant. It will produce wrong result when `X == 2`:
https://alive2.llvm.org/ce/z/pzfGZZ
This patch adds additional `sexti32` checks to operands of
`PatGprGpr_32`.
Alive2 proof: https://alive2.llvm.org/ce/z/AkH5Mp
Fix #107414.
(cherry picked from commit a111f9119a5ec77c19a514ec09454218f739454f)
Commit: 99058521d4c80635f60b2c1442b683395e0ee818
https://github.com/llvm/llvm-project/commit/99058521d4c80635f60b2c1442b683395e0ee818
Author: hev <wangrui at loongson.cn>
Date: 2024-10-01 (Tue, 01 Oct 2024)
Changed paths:
M llvm/lib/Target/LoongArch/LoongArchOptWInstrs.cpp
M llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem.ll
Log Message:
-----------
[LoongArch] Eliminate the redundant sign extension of division (#107971)
If all incoming values of `div.d` are sign-extended and all users only
use the lower 32 bits, then convert them to W versions.
Fixes: #107946
(cherry picked from commit 0f47e3aebdd2a4a938468a272ea4224552dbf176)
Compare: https://github.com/llvm/llvm-project/compare/b3731b36421e...99058521d4c8
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