9 Commits

Author SHA1 Message Date
Matt Arsenault
94202e7b17
CodeGen: Port ExpandLargeDivRem to new pass manager (#71022) 2023-11-03 08:34:15 +09:00
Matt Arsenault
d636d73f94 Revert "Move ExpandLargeDivRem to llvm/test/CodeGen/X86 because they need a triple"
This reverts commit 6bf1b4e8e0776e6f27013434d8b632016ccc795c.

Requiring a triple does not require moving these to a codegen test directory.
Move these to an x86 specific subdirectory of a transforms test.
2023-11-02 14:38:12 +09:00
Matthias Gehre
6bf1b4e8e0 Move ExpandLargeDivRem to llvm/test/CodeGen/X86 because they need a triple 2022-09-13 08:29:54 +01:00
Matthias Gehre
c1502425ba Move TargetTransformInfo::maxLegalDivRemBitWidth -> TargetLowering::maxSupportedDivRemBitWidth
Also remove new-pass-manager version of ExpandLargeDivRem because there is no way
yet to access TargetLowering in the new pass manager.

Differential Revision: https://reviews.llvm.org/D133691
2022-09-12 17:06:16 +01:00
Matthias Gehre
af3758d678 Fix remaining test failures for "[llvm/CodeGen] Enable the ExpandLargeDivRem pass for X86, Arm and AArch64" 2022-09-06 16:38:43 +01:00
Nuno Lopes
858fe8664e Expand Div/Rem: consider the case where the dividend is zero
So we can't use ctlz in poison-producing mode
2022-09-01 17:04:26 +01:00
Nuno Lopes
fa154a9170 Revert "Expand Div/Rem: consider the case where the dividend is zero"
This reverts commit 4aed09868b5a51a29aade11d9d412c3313310f29.
2022-09-01 12:11:22 +01:00
Nuno Lopes
4aed09868b Expand Div/Rem: consider the case where the dividend is zero
So we can't use ctlz in poison-producing mode
2022-09-01 12:00:03 +01:00
Matthias Gehre
3e39b27101 [llvm/CodeGen] Add ExpandLargeDivRem pass
Adds a pass ExpandLargeDivRem to expand div/rem instructions
with more than 128 bits into a loop computing that value.

As discussed on https://reviews.llvm.org/D120327, this approach has the advantage
that it is independent of the runtime library. This also helps the clang driver,
which otherwise would need to understand enough about the runtime library
to know whether to allow _BitInts with more than 128 bits.

Targets are still free to disable this pass and instead provide a faster
implementation in a runtime library.

Fixes https://github.com/llvm/llvm-project/issues/44994

Differential Revision: https://reviews.llvm.org/D126644
2022-08-26 11:55:15 +01:00