summaryrefslogtreecommitdiff
path: root/none/tests/s390x/cvd.c
diff options
context:
space:
mode:
Diffstat (limited to 'none/tests/s390x/cvd.c')
-rw-r--r--none/tests/s390x/cvd.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/none/tests/s390x/cvd.c b/none/tests/s390x/cvd.c
new file mode 100644
index 00000000..3fe8f487
--- /dev/null
+++ b/none/tests/s390x/cvd.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+
+static signed int test[] ={
+ 0,
+ 1,
+ -1,
+ 0x7fffffff,
+ 0x80000000,
+ 0x12345678,
+ 0x87654321,
+ 0x55555555,
+ 0x11111111,
+ 0xaaaaaaaa,
+};
+
+
+static unsigned long hex_to_dec(signed int num)
+{
+ unsigned long addr = 0;
+
+ asm volatile(
+ " cvd %2,%0"
+ : "=m" (addr) : "a" (&addr) , "d" (num) : "memory");
+ return addr;
+}
+
+int main()
+{
+ int i;
+
+ for (i = 0; i < sizeof(test) / sizeof(test[0]); i++)
+ printf("%lx\n", hex_to_dec(test[i]));
+ return 0;
+}