]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common header files not applicable to open-vm-tools.
authorJohn Wolfe <jwolfe@vmware.com>
Tue, 18 Aug 2020 14:14:11 +0000 (07:14 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Tue, 18 Aug 2020 14:14:11 +0000 (07:14 -0700)
open-vm-tools/lib/include/vm_basic_asm_arm64.h
open-vm-tools/lib/include/vm_basic_asm_x86_64.h

index 369020d13bb20e2e2654f966805515a6a67da638..c28ca3fda21adc90d451ee9168547f84ba26cbf6 100644 (file)
@@ -500,19 +500,16 @@ Mul64x6464(uint64 multiplicand,
            uint64 multiplier,
            uint32 shift)
 {
-   uint64 resLow, resHi;
-
-   asm("mul   %0, %2, %3" "\n\t"
-       "umulh %1, %2, %3"
-       : "=&r" (resLow), "=r" (resHi)
-       : "r" (multiplicand), "r" (multiplier));
-
    if (shift == 0) {
-      return resLow;
+      return multiplicand * multiplier;
    } else {
-      return (resLow >> shift) +
-         (resHi << (64 - shift)) +
-         ((resLow >> (shift - 1)) & 1);
+      uint64 lo, hi;
+
+      asm("mul   %0, %2, %3" "\n\t"
+          "umulh %1, %2, %3"
+          : "=&r" (lo), "=r" (hi)
+          : "r" (multiplicand), "r" (multiplier));
+      return (hi << (64 - shift) | lo >> shift) + (lo >> (shift - 1) & 1);
    }
 }
 
@@ -540,19 +537,16 @@ Muls64x64s64(int64 multiplicand,
              int64 multiplier,
              uint32 shift)
 {
-   uint64 resLow, resHi;
-
-   asm("mul   %0, %2, %3" "\n\t"
-       "smulh %1, %2, %3"
-       : "=&r" (resLow), "=r" (resHi)
-       : "r" (multiplicand), "r" (multiplier));
-
    if (shift == 0) {
-      return resLow;
+      return multiplicand * multiplier;
    } else {
-      return (resLow >> shift) +
-         (resHi << (64 - shift)) +
-         ((resLow >> (shift - 1)) & 1);
+      uint64 lo, hi;
+
+      asm("mul   %0, %2, %3" "\n\t"
+          "smulh %1, %2, %3"
+          : "=&r" (lo), "=r" (hi)
+          : "r" (multiplicand), "r" (multiplier));
+      return (hi << (64 - shift) | lo >> shift) + (lo >> (shift - 1) & 1);
    }
 }
 
index 5229d6b5ab2439edbb7fdffca10fa11addef429d..21ec721acc777cc3f507385c1273bbcd6d828051 100644 (file)
@@ -399,13 +399,13 @@ Mul64x6464(uint64 multiplicand,
     *      discarded by the shift.
     *    Return the low-order 64 bits of the above.
     */
-   uint64 tmplo, tmphi;
-   tmplo = _umul128(multiplicand, multiplier, &tmphi);
    if (shift == 0) {
-      return tmplo;
+      return multiplicand * multiplier;
    } else {
-      return __shiftright128(tmplo, tmphi, (uint8) shift) +
-         ((tmplo >> (shift - 1)) & 1);
+      uint64 lo, hi;
+
+      lo = _umul128(multiplicand, multiplier, &hi);
+      return __shiftright128(lo, hi, (uint8)shift) + (lo >> (shift - 1) & 1);
    }
 }
 
@@ -486,13 +486,13 @@ Muls64x64s64(int64 multiplicand,
     * Note: using an unsigned shift is correct because shift < 64 and
     * we return only the low 64 bits of the shifted result.
     */
-   int64 tmplo, tmphi;
-   tmplo = _mul128(multiplicand, multiplier, &tmphi);
    if (shift == 0) {
-      return tmplo;
+      return multiplicand * multiplier;
    } else {
-      return __shiftright128(tmplo, tmphi, (uint8) shift) +
-         ((tmplo >> (shift - 1)) & 1);
+      int64 lo, hi;
+
+      lo = _mul128(multiplicand, multiplier, &hi);
+      return __shiftright128(lo, hi, (uint8)shift) + (lo >> (shift - 1) & 1);
    }
 }