zsrkmyn wrote:
I'd appreciate much if you can help me commit it.
https://github.com/llvm/llvm-project/pull/120352
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/zsrkmyn updated
https://github.com/llvm/llvm-project/pull/120352
>From 19555edc7e2749a6e904c80d963a46431b23b6d1 Mon Sep 17 00:00:00 2001
From: Senran Zhang
Date: Tue, 17 Dec 2024 16:15:25 +0800
Subject: [PATCH] [ConstantRange] Estimate tighter lower (upper) bounds for
masked
@@ -2720,6 +2720,22 @@ TEST_F(ConstantRangeTest, binaryAnd) {
EXPECT_EQ(R16_32.binaryAnd(R0_99), R0_32);
EXPECT_EQ(R0_99.binaryAnd(R16_32), R0_32);
+ // 'And' with leading bits are masked (with common leading bits stripped)
zsrkmyn wrote:
Test added.
ht
@@ -2720,6 +2720,22 @@ TEST_F(ConstantRangeTest, binaryAnd) {
EXPECT_EQ(R16_32.binaryAnd(R0_99), R0_32);
EXPECT_EQ(R0_99.binaryAnd(R16_32), R0_32);
+ // 'And' with leading bits are masked (with common leading bits stripped)
+ ConstantRange RMaskedL(APInt(8, 0b10'00101'1)
@@ -1520,15 +1520,72 @@ ConstantRange ConstantRange::binaryNot() const {
return ConstantRange(APInt::getAllOnes(getBitWidth())).sub(*this);
}
+/// Estimate the 'bit-masked AND' operation's lower bound.
+///
+/// E.g., given two ranges as follows (single quotes are separators
https://github.com/zsrkmyn updated
https://github.com/llvm/llvm-project/pull/120352
>From c585a24277ddbf828f19faa6a66c6dd3bae699e2 Mon Sep 17 00:00:00 2001
From: Senran Zhang
Date: Tue, 17 Dec 2024 16:15:25 +0800
Subject: [PATCH] [ConstantRange] Estimate tighter lower (upper) bounds for
masked
@@ -2720,6 +2720,22 @@ TEST_F(ConstantRangeTest, binaryAnd) {
EXPECT_EQ(R16_32.binaryAnd(R0_99), R0_32);
EXPECT_EQ(R0_99.binaryAnd(R16_32), R0_32);
+ // 'And' with leading bits are masked (with common leading bits stripped)
zsrkmyn wrote:
Oh, if you're a
@@ -2720,6 +2720,22 @@ TEST_F(ConstantRangeTest, binaryAnd) {
EXPECT_EQ(R16_32.binaryAnd(R0_99), R0_32);
EXPECT_EQ(R0_99.binaryAnd(R16_32), R0_32);
+ // 'And' with leading bits are masked (with common leading bits stripped)
+ ConstantRange RMaskedL(APInt(8, 0b10'00101'1)
https://github.com/zsrkmyn edited
https://github.com/llvm/llvm-project/pull/120352
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2720,6 +2720,22 @@ TEST_F(ConstantRangeTest, binaryAnd) {
EXPECT_EQ(R16_32.binaryAnd(R0_99), R0_32);
EXPECT_EQ(R0_99.binaryAnd(R16_32), R0_32);
+ // 'And' with leading bits are masked (with common leading bits stripped)
zsrkmyn wrote:
'And' op is tri
@@ -1520,15 +1520,72 @@ ConstantRange ConstantRange::binaryNot() const {
return ConstantRange(APInt::getAllOnes(getBitWidth())).sub(*this);
}
+/// Estimate the 'bit-masked AND' operation's lower bound.
+///
+/// E.g., given two ranges as follows (single quotes are separators
zsrkmyn wrote:
A soft ping to @MaskRay @nikic . :-)
https://github.com/llvm/llvm-project/pull/120352
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/zsrkmyn edited
https://github.com/llvm/llvm-project/pull/120352
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1520,15 +1520,72 @@ ConstantRange ConstantRange::binaryNot() const {
return ConstantRange(APInt::getAllOnes(getBitWidth())).sub(*this);
}
+/// Estimate the 'bit-masked AND' operation's lower bound.
+///
+/// E.g., given two ranges as follows (single quotes are separators
https://github.com/zsrkmyn updated
https://github.com/llvm/llvm-project/pull/120352
>From 9c49208195b25c6cf5bdbd0f6d85ed5f8348812d Mon Sep 17 00:00:00 2001
From: Senran Zhang
Date: Tue, 17 Dec 2024 16:15:25 +0800
Subject: [PATCH] [ConstantRange] Estimate tighter lower (upper) bounds for
masked
@@ -1520,15 +1520,72 @@ ConstantRange ConstantRange::binaryNot() const {
return ConstantRange(APInt::getAllOnes(getBitWidth())).sub(*this);
}
+/// Estimate the 'bit-masked AND' operation's lower bound.
+///
+/// E.g., given two ranges as follows (single quotes are separators
zsrkmyn wrote:
Test updated.
https://github.com/llvm/llvm-project/pull/120352
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/zsrkmyn updated
https://github.com/llvm/llvm-project/pull/120352
>From 80ee70143f6754f53fc11d5d013bf571856c090c Mon Sep 17 00:00:00 2001
From: Senran Zhang
Date: Tue, 17 Dec 2024 16:15:25 +0800
Subject: [PATCH] [ConstantRange] Estimate tighter lower (upper) bounds for
masked
zsrkmyn wrote:
Ah, by applying the patch below, I just found the lower bound is still not
optimal for non-wrapped cases. E.g., for 4-bit ints, given 2 ranges,
```
[0011, ]
[1101, ]
```
the optimal lower bound is 1, while the algorithm gives 0.
```diff
diff --git a/llvm/unittests/IR/Co
zsrkmyn wrote:
> > I'm thinking if I need to add a new test mode to test the optimal lower
> > (upper) bound only for AND (OR).
>
> If you cannot make it optimal for all non-wrapped cases, please just add some
> special cases (e.g., `[7, 14) & [-1, 0) = [7, 14)`) before
> `TestBinaryOpExhaust
zsrkmyn wrote:
@dtcxzyw, I've updated the patch. It's quite simple. You can forget about the
previous patch and start a review from scratch.
unittests weren't updated with your patch, since the upper bound wasn't optimal
(for AND op). I'm thinking if I need to add a new test mode to test the o
https://github.com/zsrkmyn updated
https://github.com/llvm/llvm-project/pull/120352
>From 2cb7f076f4b101ab0503b51e84e3493ae2ba8060 Mon Sep 17 00:00:00 2001
From: Senran Zhang
Date: Tue, 17 Dec 2024 16:15:25 +0800
Subject: [PATCH] [ConstantRange] Estimate tighter lower (upper) bounds for
masked
@@ -1520,15 +1520,101 @@ ConstantRange ConstantRange::binaryNot() const {
return ConstantRange(APInt::getAllOnes(getBitWidth())).sub(*this);
}
+/// Estimate the 'bit-masked AND' operation's lower bound.
+///
+/// E.g., given two ranges as follows (single quotes are separator
@@ -1520,15 +1520,101 @@ ConstantRange ConstantRange::binaryNot() const {
return ConstantRange(APInt::getAllOnes(getBitWidth())).sub(*this);
}
+/// Estimate the 'bit-masked AND' operation's lower bound.
+///
+/// E.g., given two ranges as follows (single quotes are separator
https://github.com/zsrkmyn updated
https://github.com/llvm/llvm-project/pull/120352
>From 3351cf82f3fef3bf22cd274e16c3e23133cd7754 Mon Sep 17 00:00:00 2001
From: Senran Zhang
Date: Tue, 17 Dec 2024 16:15:25 +0800
Subject: [PATCH] [ConstantRange] Estimate tighter lower (upper) bounds for
masked
https://github.com/zsrkmyn edited
https://github.com/llvm/llvm-project/pull/120352
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1520,15 +1520,102 @@ ConstantRange ConstantRange::binaryNot() const {
return ConstantRange(APInt::getAllOnes(getBitWidth())).sub(*this);
}
+/// Estimate the 'bit-masked AND' operation's lower bound.
+///
+/// E.g., given two ranges as follows (single quotes are separator
@@ -1520,15 +1520,102 @@ ConstantRange ConstantRange::binaryNot() const {
return ConstantRange(APInt::getAllOnes(getBitWidth())).sub(*this);
}
+/// Estimate the 'bit-masked AND' operation's lower bound.
+///
+/// E.g., given two ranges as follows (single quotes are separator
@@ -1520,15 +1520,102 @@ ConstantRange ConstantRange::binaryNot() const {
return ConstantRange(APInt::getAllOnes(getBitWidth())).sub(*this);
}
+/// Estimate the 'bit-masked AND' operation's lower bound.
+///
+/// E.g., given two ranges as follows (single quotes are separator
@@ -1520,15 +1520,102 @@ ConstantRange ConstantRange::binaryNot() const {
return ConstantRange(APInt::getAllOnes(getBitWidth())).sub(*this);
}
+/// Estimate the 'bit-masked AND' operation's lower bound.
+///
+/// E.g., given two ranges as follows (single quotes are separator
zsrkmyn wrote:
> > Failed Tests
> > Clang.CodeGen/AArch64/fpm-helpers.c
>
> Is it related with this patch?
Thx! I thought it wasn't as it's 'Clang.CodeGen'. Fixed now.
https://github.com/llvm/llvm-project/pull/120352
___
cfe-commits mailing list
cfe-
@@ -1538,10 +1625,17 @@ ConstantRange ConstantRange::binaryOr(const
ConstantRange &Other) const {
ConstantRange KnownBitsRange =
fromKnownBits(toKnownBits() | Other.toKnownBits(), false);
+
+ // ~a & ~b>= x
+ // <=> ~(~a & ~b) <= ~x
+ // <=> a | b <
https://github.com/zsrkmyn updated
https://github.com/llvm/llvm-project/pull/120352
>From 90f753998f605cefa912fc92d776bc90a7ca74f5 Mon Sep 17 00:00:00 2001
From: Senran Zhang
Date: Tue, 17 Dec 2024 16:15:25 +0800
Subject: [PATCH] [ConstantRange] Estimate tighter lower (upper) bounds for
masked
Author: Senran Zhang
Date: 2022-04-24T14:50:59+08:00
New Revision: ae76eb32a5988c1f4ebb07e7e5eb9de2b036e194
URL:
https://github.com/llvm/llvm-project/commit/ae76eb32a5988c1f4ebb07e7e5eb9de2b036e194
DIFF:
https://github.com/llvm/llvm-project/commit/ae76eb32a5988c1f4ebb07e7e5eb9de2b036e194.diff
34 matches
Mail list logo