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: [RFC PATCH 1/2] unsigned multiplication is also associative
Date: Sun, 18 Feb 2018 10:15:18 +0100	[thread overview]
Message-ID: <20180218091519.6708-2-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20180218091519.6708-1-luc.vanoostenryck@gmail.com>

Currently, only signed multiplication is considered as associative
but in truth both signed & unsigned are.

So, make unsigned multiplication associative too.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 simplify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index dbea438e7..a20cc7e7c 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1168,6 +1168,7 @@ int simplify_instruction(struct instruction *insn)
 		return 0;
 	switch (insn->opcode) {
 	case OP_ADD: case OP_MULS:
+	case OP_MULU:
 	case OP_AND: case OP_OR: case OP_XOR:
 	case OP_AND_BOOL: case OP_OR_BOOL:
 		canonicalize_commutative(insn);
@@ -1175,7 +1176,6 @@ int simplify_instruction(struct instruction *insn)
 			return REPEAT_CSE;
 		return simplify_associative_binop(insn);
 
-	case OP_MULU:
 	case OP_SET_EQ: case OP_SET_NE:
 		canonicalize_commutative(insn);
 		return simplify_binop(insn);
-- 
2.16.0


  reply	other threads:[~2018-02-18  9:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-18  9:15 [RFC PATCH 0/2] use a single multiplication instruction Luc Van Oostenryck
2018-02-18  9:15 ` Luc Van Oostenryck [this message]
2018-02-18  9:15 ` [RFC PATCH 2/2] no need for signed & unsigned multiplication 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=20180218091519.6708-2-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).