mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Implement ConstantRange::multiply based on the code in LoopVR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75410 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -550,9 +550,19 @@ ConstantRange::add(const ConstantRange &Other) const {
|
||||
|
||||
ConstantRange
|
||||
ConstantRange::multiply(const ConstantRange &Other) const {
|
||||
// TODO: Implement multiply.
|
||||
return ConstantRange(getBitWidth(),
|
||||
!(isEmptySet() || Other.isEmptySet()));
|
||||
if (isEmptySet() || Other.isEmptySet())
|
||||
return ConstantRange(getBitWidth(), /*isFullSet=*/false);
|
||||
if (isFullSet() || Other.isFullSet())
|
||||
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
|
||||
|
||||
ConstantRange this_zext = zeroExtend(getBitWidth() * 2);
|
||||
ConstantRange Other_zext = Other.zeroExtend(getBitWidth() * 2);
|
||||
|
||||
ConstantRange Result_zext = ConstantRange(
|
||||
this_zext.getLower() * Other_zext.getLower(),
|
||||
((this_zext.getUpper()-1) * (Other_zext.getUpper()-1)) + 1);
|
||||
|
||||
return Result_zext.truncate(getBitWidth());
|
||||
}
|
||||
|
||||
ConstantRange
|
||||
|
||||
Reference in New Issue
Block a user