qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 03/18] qemu/int128: addition of div/rem 128-bit operations


From: Frédéric Pétrot
Subject: Re: [PATCH v6 03/18] qemu/int128: addition of div/rem 128-bit operations
Date: Mon, 29 Nov 2021 15:27:16 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2

On 29/11/2021 11:07, Richard Henderson wrote:
On 11/28/21 2:57 PM, Frédéric Pétrot wrote:
--- /dev/null
+++ b/util/int128.c
@@ -0,0 +1,145 @@
+#include "qemu/osdep.h"
+#include "qemu/host-utils.h"
+#include "qemu/int128.h"

Missing file header and copyright boilerplate.

+#ifdef CONFIG_INT128
+
+Int128 int128_divu(Int128 a, Int128 b)
+{
+    return (__uint128_t)a / (__uint128_t)b;
+}
+
+Int128 int128_remu(Int128 a, Int128 b)
+{
+    return (__uint128_t)a % (__uint128_t)b;
+}
+
+Int128 int128_divs(Int128 a, Int128 b)
+{
+    return a / b;
+}
+
+Int128 int128_rems(Int128 a, Int128 b)
+{
+    return a % b;
+}

I think we should simply expose these inline, and let the compiler call its runtime function directly.

  Thanks.
  Ok, I'll drop that and handle the CONFIG_INT128 directly in the rv128
  div/rem helpers then.
  Frédéric


r~

--
+---------------------------------------------------------------------------+
| Frédéric Pétrot, Pr. Grenoble INP-Ensimag/TIMA,   Ensimag deputy director |
| Mob/Pho: +33 6 74 57 99 65/+33 4 76 57 48 70      Ad augusta  per angusta |
| http://tima.univ-grenoble-alpes.fr frederic.petrot@univ-grenoble-alpes.fr |
+---------------------------------------------------------------------------+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]