From: Laurent Vivier <lvivier@redhat.com>
To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>
Subject: [Qemu-devel] [PATCH 1/3] scripts: add muldiv64() checking coccinelle scripts
Date: Wed, 4 May 2016 15:04:06 +0200 [thread overview]
Message-ID: <1462367048-20997-2-git-send-email-lvivier@redhat.com> (raw)
In-Reply-To: <1462367048-20997-1-git-send-email-lvivier@redhat.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
scripts/coccinelle/remove_muldiv64.cocci | 6 +++++
scripts/coccinelle/swap_muldiv64.cocci | 46 ++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+)
create mode 100644 scripts/coccinelle/remove_muldiv64.cocci
create mode 100644 scripts/coccinelle/swap_muldiv64.cocci
diff --git a/scripts/coccinelle/remove_muldiv64.cocci b/scripts/coccinelle/remove_muldiv64.cocci
new file mode 100644
index 0000000..4c10bd5
--- /dev/null
+++ b/scripts/coccinelle/remove_muldiv64.cocci
@@ -0,0 +1,6 @@
+// replace muldiv64(a, 1, b) by "a / b"
+@@
+expression a, b;
+@@
+-muldiv64(a, 1, b)
++a / b
diff --git a/scripts/coccinelle/swap_muldiv64.cocci b/scripts/coccinelle/swap_muldiv64.cocci
new file mode 100644
index 0000000..39a278d
--- /dev/null
+++ b/scripts/coccinelle/swap_muldiv64.cocci
@@ -0,0 +1,46 @@
+// replace muldiv64(i32, i64, x) by muldiv64(i64, i32, x)
+@filter@
+typedef uint64_t;
+typedef int64_t;
+typedef uint32_t;
+typedef int32_t;
+uint64_t u64;
+int64_t s64;
+uint32_t u32;
+int32_t s32;
+int si;
+unsigned int ui;
+long sl;
+unsigned long ul;
+expression b;
+position p;
+@@
+ muldiv64(
+(
+si
+|
+ui
+|
+s32
+|
+u32
+)
+,
+(
+sl
+|
+ul
+|
+u64
+|
+s64
+)
+, b)@p
+
+@swap@
+position filter.p;
+expression a, b, c;
+@@
+
+-muldiv64(a,b,c)@p
++muldiv64(b,a,c)
--
2.5.5
next prev parent reply other threads:[~2016-05-04 13:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-04 13:04 [Qemu-devel] [PATCH 0/3] muldiv64() trivial fixes Laurent Vivier
2016-05-04 13:04 ` Laurent Vivier [this message]
2016-05-04 13:04 ` [Qemu-devel] [PATCH 2/3] The only 64bit parameter of muldiv64() is the first one Laurent Vivier
2016-05-04 13:04 ` [Qemu-devel] [PATCH 3/3] remove useless muldiv64() Laurent Vivier
2016-05-04 18:12 ` [Qemu-devel] [PATCH 0/3] muldiv64() trivial fixes Richard Henderson
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=1462367048-20997-2-git-send-email-lvivier@redhat.com \
--to=lvivier@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.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).