qemu/tests/tcg/s390x/mxdb.c
<<
>>
Prefs
   1/*
   2 * Test the MXDB and MXDBR instructions.
   3 *
   4 * SPDX-License-Identifier: GPL-2.0-or-later
   5 */
   6#include <assert.h>
   7#include <stdlib.h>
   8
   9int main(void)
  10{
  11    union {
  12        double d[2];
  13        long double ld;
  14    } a;
  15    double b;
  16
  17    a.d[0] = 1.2345;
  18    a.d[1] = 999;
  19    b = 6.789;
  20    asm("mxdb %[a],%[b]" : [a] "+f" (a.ld) : [b] "R" (b));
  21    assert(a.ld > 8.38 && a.ld < 8.39);
  22
  23    a.d[0] = 1.2345;
  24    a.d[1] = 999;
  25    b = 6.789;
  26    asm("mxdbr %[a],%[b]" : [a] "+f" (a.ld) : [b] "f" (b));
  27    assert(a.ld > 8.38 && a.ld < 8.39);
  28
  29    return EXIT_SUCCESS;
  30}
  31