summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2005-01-27 06:51:45 +0000
committermarcel <marcel@FreeBSD.org>2005-01-27 06:51:45 +0000
commitbf144c55eafcdb7849bbaab349e3734166d083a7 (patch)
tree58686dad3e3ca825ec4a02663bbe4f2b6eafad40
parent4722d1539a3f9156b110a9d0d817b14fe443d719 (diff)
downloadFreeBSD-src-bf144c55eafcdb7849bbaab349e3734166d083a7.zip
FreeBSD-src-bf144c55eafcdb7849bbaab349e3734166d083a7.tar.gz
The unit test for unaligned loads/stores can be found under ../ia64.
-rw-r--r--tools/regression/ia64_unaligned/Makefile6
-rw-r--r--tools/regression/ia64_unaligned/unaligned.c131
2 files changed, 0 insertions, 137 deletions
diff --git a/tools/regression/ia64_unaligned/Makefile b/tools/regression/ia64_unaligned/Makefile
deleted file mode 100644
index 69da89f..0000000
--- a/tools/regression/ia64_unaligned/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# $FreeBSD$
-
-PROG= unaligned
-NO_MAN=
-
-.include <bsd.prog.mk>
diff --git a/tools/regression/ia64_unaligned/unaligned.c b/tools/regression/ia64_unaligned/unaligned.c
deleted file mode 100644
index e45bcd9..0000000
--- a/tools/regression/ia64_unaligned/unaligned.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*-
- * Copyright (c) 2001 Doug Rabson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <sys/param.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-static u_int64_t ld2(char** pp, int add)
-{
- u_int64_t p = (u_int64_t) *pp;
- u_int64_t v;
- __asm __volatile("ld2 %0=[%1]" : "=r" (v) : "r" (p));
- return v;
-}
-
-static u_int64_t ld4(char** pp, int add)
-{
- u_int64_t p = (u_int64_t) *pp;
- u_int64_t v;
- __asm __volatile("ld4 %0=[%1]" : "=r" (v) : "r" (p));
- return v;
-}
-
-static u_int64_t ld8(char** pp, int add)
-{
- u_int64_t p = (u_int64_t) *pp;
- u_int64_t v;
- __asm __volatile("ld8 %0=[%1]" : "=r" (v) : "r" (p));
- return v;
-}
-
-static u_int64_t ld8_reg(char** pp, int add)
-{
- u_int64_t p = (u_int64_t) *pp;
- u_int64_t v;
- __asm __volatile("ld8 %0=[%1],%3"
- : "=r" (v), "=r" (p)
- : "1" (p), "r" (add));
- *pp = (char*) p;
- return v;
-}
-
-static u_int64_t ld8_8(char** pp, int add)
-{
- u_int64_t p = (u_int64_t) *pp;
- u_int64_t v;
- __asm __volatile("ld8 %0=[%1],8"
- : "=r" (v), "=r" (p)
- : "1" (p));
- *pp = (char*) p;
- return v;
-}
-
-struct load_test {
- u_int64_t (*ldfunc)(char**, int);
- int off, add;
- u_int64_t value;
-};
-
-char testbuf[16] = {
- 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,
- 0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff
-};
-
-struct load_test tests[] = {
- {ld8, 1, 0, 0x8877665544332211L},
- {ld8, 2, 0, 0x9988776655443322L},
- {ld4, 1, 0, 0x44332211L},
- {ld4, 2, 0, 0x55443322L},
- {ld2, 1, 0, 0x2211L},
- {ld8_reg, 1, 4, 0x8877665544332211L},
- {ld8_8, 1, 8, 0x8877665544332211L},
-};
-
-int
-main(int argc, char** argv)
-{
- int verbose = 0;
- int passed = 1;
- int i;
-
- if (argc == 2 && !strcmp(argv[1], "-v"))
- verbose = 1;
-
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
- struct load_test *tp = &tests[i];
- char* p;
- u_int64_t value;
- p = &testbuf[tp->off];
- value = tp->ldfunc(&p, tp->add);
- if (verbose)
- printf("read 0x%lx, expected 0x%lx\n",
- value, tp->value);
- if (value != tp->value)
- passed = 0;
- if (p - &testbuf[tp->off] != tp->add) {
- printf("postincrement was %d, %d expected\n",
- p - &testbuf[tp->off], tp->add);
- passed = 0;
- }
- }
- if (passed)
- printf("passed\n");
- else
- printf("failed\n");
-}
OpenPOWER on IntegriCloud