public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: riscv: switch MIN/MAX to common min/max
@ 2021-04-27  3:29 Michael Frysinger
  0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2021-04-27  3:29 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2045d9d17f76fa266acd15a0aa4d3ceacdcb9197

commit 2045d9d17f76fa266acd15a0aa4d3ceacdcb9197
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Mon Apr 26 23:28:04 2021 -0400

    sim: riscv: switch MIN/MAX to common min/max
    
    The common sim-basics.h defines min/max already, so use them.

Diff:
---
 sim/riscv/ChangeLog  |  5 +++++
 sim/riscv/sim-main.c | 11 ++++-------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/sim/riscv/ChangeLog b/sim/riscv/ChangeLog
index 09939133215..37284a982a9 100644
--- a/sim/riscv/ChangeLog
+++ b/sim/riscv/ChangeLog
@@ -1,3 +1,8 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.c (MAX, MIN): Delete.
+	(execute_a): Change MAX/MIN to max/min.
+
 2021-04-26  Mike Frysinger  <vapier@gentoo.org>
 
 	* aclocal.m4, config.in, configure: Regenerate.
diff --git a/sim/riscv/sim-main.c b/sim/riscv/sim-main.c
index ff328a0dc20..a80dc683826 100644
--- a/sim/riscv/sim-main.c
+++ b/sim/riscv/sim-main.c
@@ -789,9 +789,6 @@ execute_m (SIM_CPU *cpu, unsigned_word iw, const struct riscv_opcode *op)
   return pc;
 }
 
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-
 static sim_cia
 execute_a (SIM_CPU *cpu, unsigned_word iw, const struct riscv_opcode *op)
 {
@@ -881,19 +878,19 @@ execute_a (SIM_CPU *cpu, unsigned_word iw, const struct riscv_opcode *op)
       break;
     case MATCH_AMOMAX_D:
     case MATCH_AMOMAX_W:
-      tmp = MAX ((signed_word) cpu->regs[rd], (signed_word) cpu->regs[rs2]);
+      tmp = max ((signed_word) cpu->regs[rd], (signed_word) cpu->regs[rs2]);
       break;
     case MATCH_AMOMAXU_D:
     case MATCH_AMOMAXU_W:
-      tmp = MAX ((unsigned_word) cpu->regs[rd], (unsigned_word) cpu->regs[rs2]);
+      tmp = max ((unsigned_word) cpu->regs[rd], (unsigned_word) cpu->regs[rs2]);
       break;
     case MATCH_AMOMIN_D:
     case MATCH_AMOMIN_W:
-      tmp = MIN ((signed_word) cpu->regs[rd], (signed_word) cpu->regs[rs2]);
+      tmp = min ((signed_word) cpu->regs[rd], (signed_word) cpu->regs[rs2]);
       break;
     case MATCH_AMOMINU_D:
     case MATCH_AMOMINU_W:
-      tmp = MIN ((unsigned_word) cpu->regs[rd], (unsigned_word) cpu->regs[rs2]);
+      tmp = min ((unsigned_word) cpu->regs[rd], (unsigned_word) cpu->regs[rs2]);
       break;
     case MATCH_AMOOR_D:
     case MATCH_AMOOR_W:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-27  3:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27  3:29 [binutils-gdb] sim: riscv: switch MIN/MAX to common min/max Michael Frysinger

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 read-only IMAP folder(s) and NNTP newsgroup(s).