linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 4/9] simplify (x & M) cmpu C
Date: Wed, 10 Mar 2021 22:49:45 +0100	[thread overview]
Message-ID: <20210310214950.84192-5-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20210310214950.84192-1-luc.vanoostenryck@gmail.com>

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 simplify.c                   | 16 ++++++++++++++++
 validation/optim/cmpu-and0.c |  1 -
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index 90b0c5ba0127..ee29c9619bdc 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1281,6 +1281,22 @@ static int simplify_compare_constant(struct instruction *insn, long long value)
 			if (value >= (long long)bits)
 				return replace_with_value(insn, 0);
 			break;
+		case OP_SET_B:
+			if (value > bits)
+				return replace_with_value(insn, 1);
+			break;
+		case OP_SET_BE:
+			if (value >= bits)
+				return replace_with_value(insn, 1);
+			break;
+		case OP_SET_AE:
+			if (value > bits)
+				return replace_with_value(insn, 0);
+			break;
+		case OP_SET_A:
+			if (value >= bits)
+				return replace_with_value(insn, 0);
+			break;
 		}
 		break;
 	case OP_SEXT:				// sext(x) cmp C --> x cmp trunc(C)
diff --git a/validation/optim/cmpu-and0.c b/validation/optim/cmpu-and0.c
index 253212941779..927b9fb65f52 100644
--- a/validation/optim/cmpu-and0.c
+++ b/validation/optim/cmpu-and0.c
@@ -11,7 +11,6 @@ int cmps_and_gtu_eq(int a) { return ((a & MASK) >  (MASK + 0)) + 1; }
 /*
  * check-name: cmpu-and0
  * check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
  *
  * check-output-ignore
  * check-output-returns: 1
-- 
2.30.0


  parent reply	other threads:[~2021-03-10 22:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 21:49 [PATCH 0/9] simplify CMP(AND(x,M), C) and CMP(OR(x,M), C) Luc Van Oostenryck
2021-03-10 21:49 ` [PATCH 1/9] change testing of signed compares against SMIN or SMAX Luc Van Oostenryck
2021-03-10 21:49 ` [PATCH 2/9] add testcases for constant compares against AND/OR Luc Van Oostenryck
2021-03-10 21:49 ` [PATCH 3/9] simplify (x & M) cmps C Luc Van Oostenryck
2021-03-10 21:49 ` Luc Van Oostenryck [this message]
2021-03-10 21:49 ` [PATCH 5/9] simplify (x & M) cmps 0 Luc Van Oostenryck
2021-03-10 21:49 ` [PATCH 6/9] simplify (x & M) {==,!=} C Luc Van Oostenryck
2021-03-10 21:49 ` [PATCH 7/9] simplify (x | " Luc Van Oostenryck
2021-03-10 21:49 ` [PATCH 8/9] simplify (x | M) cmps C Luc Van Oostenryck
2021-03-10 21:49 ` [PATCH 9/9] simplify (x | M) cmpu C Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210310214950.84192-5-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).