summaryrefslogtreecommitdiff
path: root/test/CodeGen/CellSPU/useful-harnesses
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/CellSPU/useful-harnesses')
-rw-r--r--test/CodeGen/CellSPU/useful-harnesses/README.txt5
-rw-r--r--test/CodeGen/CellSPU/useful-harnesses/i32operations.c69
-rw-r--r--test/CodeGen/CellSPU/useful-harnesses/i64operations.c673
-rw-r--r--test/CodeGen/CellSPU/useful-harnesses/i64operations.h43
-rw-r--r--test/CodeGen/CellSPU/useful-harnesses/lit.local.cfg1
-rw-r--r--test/CodeGen/CellSPU/useful-harnesses/vecoperations.c179
6 files changed, 0 insertions, 970 deletions
diff --git a/test/CodeGen/CellSPU/useful-harnesses/README.txt b/test/CodeGen/CellSPU/useful-harnesses/README.txt
deleted file mode 100644
index d87b3989e4..0000000000
--- a/test/CodeGen/CellSPU/useful-harnesses/README.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-This directory contains code that's not part of the DejaGNU test suite,
-but is generally useful as various test harnesses.
-
-vecoperations.c: Various vector operation sanity checks, e.g., shuffles,
- 8-bit vector add and multiply.
diff --git a/test/CodeGen/CellSPU/useful-harnesses/i32operations.c b/test/CodeGen/CellSPU/useful-harnesses/i32operations.c
deleted file mode 100644
index 12fc30bf65..0000000000
--- a/test/CodeGen/CellSPU/useful-harnesses/i32operations.c
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <stdio.h>
-
-typedef unsigned int uint32_t;
-typedef int int32_t;
-
-const char *boolstring(int val) {
- return val ? "true" : "false";
-}
-
-int i32_eq(int32_t a, int32_t b) {
- return (a == b);
-}
-
-int i32_neq(int32_t a, int32_t b) {
- return (a != b);
-}
-
-int32_t i32_eq_select(int32_t a, int32_t b, int32_t c, int32_t d) {
- return ((a == b) ? c : d);
-}
-
-int32_t i32_neq_select(int32_t a, int32_t b, int32_t c, int32_t d) {
- return ((a != b) ? c : d);
-}
-
-struct pred_s {
- const char *name;
- int (*predfunc)(int32_t, int32_t);
- int (*selfunc)(int32_t, int32_t, int32_t, int32_t);
-};
-
-struct pred_s preds[] = {
- { "eq", i32_eq, i32_eq_select },
- { "neq", i32_neq, i32_neq_select }
-};
-
-int main(void) {
- int i;
- int32_t a = 1234567890;
- int32_t b = 345678901;
- int32_t c = 1234500000;
- int32_t d = 10001;
- int32_t e = 10000;
-
- printf("a = %12d (0x%08x)\n", a, a);
- printf("b = %12d (0x%08x)\n", b, b);
- printf("c = %12d (0x%08x)\n", c, c);
- printf("d = %12d (0x%08x)\n", d, d);
- printf("e = %12d (0x%08x)\n", e, e);
- printf("----------------------------------------\n");
-
- for (i = 0; i < sizeof(preds)/sizeof(preds[0]); ++i) {
- printf("a %s a = %s\n", preds[i].name, boolstring((*preds[i].predfunc)(a, a)));
- printf("a %s a = %s\n", preds[i].name, boolstring((*preds[i].predfunc)(a, a)));
- printf("a %s b = %s\n", preds[i].name, boolstring((*preds[i].predfunc)(a, b)));
- printf("a %s c = %s\n", preds[i].name, boolstring((*preds[i].predfunc)(a, c)));
- printf("d %s e = %s\n", preds[i].name, boolstring((*preds[i].predfunc)(d, e)));
- printf("e %s e = %s\n", preds[i].name, boolstring((*preds[i].predfunc)(e, e)));
-
- printf("a %s a ? c : d = %d\n", preds[i].name, (*preds[i].selfunc)(a, a, c, d));
- printf("a %s a ? c : d == c (%s)\n", preds[i].name, boolstring((*preds[i].selfunc)(a, a, c, d) == c));
- printf("a %s b ? c : d = %d\n", preds[i].name, (*preds[i].selfunc)(a, b, c, d));
- printf("a %s b ? c : d == d (%s)\n", preds[i].name, boolstring((*preds[i].selfunc)(a, b, c, d) == d));
-
- printf("----------------------------------------\n");
- }
-
- return 0;
-}
diff --git a/test/CodeGen/CellSPU/useful-harnesses/i64operations.c b/test/CodeGen/CellSPU/useful-harnesses/i64operations.c
deleted file mode 100644
index b613bd872e..0000000000
--- a/test/CodeGen/CellSPU/useful-harnesses/i64operations.c
+++ /dev/null
@@ -1,673 +0,0 @@
-#include <stdio.h>
-#include "i64operations.h"
-
-int64_t tval_a = 1234567890003LL;
-int64_t tval_b = 2345678901235LL;
-int64_t tval_c = 1234567890001LL;
-int64_t tval_d = 10001LL;
-int64_t tval_e = 10000LL;
-uint64_t tval_f = 0xffffff0750135eb9;
-int64_t tval_g = -1;
-
-/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- */
-
-int
-i64_eq(int64_t a, int64_t b)
-{
- return (a == b);
-}
-
-int
-i64_neq(int64_t a, int64_t b)
-{
- return (a != b);
-}
-
-int
-i64_gt(int64_t a, int64_t b)
-{
- return (a > b);
-}
-
-int
-i64_le(int64_t a, int64_t b)
-{
- return (a <= b);
-}
-
-int
-i64_ge(int64_t a, int64_t b) {
- return (a >= b);
-}
-
-int
-i64_lt(int64_t a, int64_t b) {
- return (a < b);
-}
-
-int
-i64_uge(uint64_t a, uint64_t b)
-{
- return (a >= b);
-}
-
-int
-i64_ult(uint64_t a, uint64_t b)
-{
- return (a < b);
-}
-
-int
-i64_ugt(uint64_t a, uint64_t b)
-{
- return (a > b);
-}
-
-int
-i64_ule(uint64_t a, uint64_t b)
-{
- return (a <= b);
-}
-
-int64_t
-i64_eq_select(int64_t a, int64_t b, int64_t c, int64_t d)
-{
- return ((a == b) ? c : d);
-}
-
-int64_t
-i64_neq_select(int64_t a, int64_t b, int64_t c, int64_t d)
-{
- return ((a != b) ? c : d);
-}
-
-int64_t
-i64_gt_select(int64_t a, int64_t b, int64_t c, int64_t d) {
- return ((a > b) ? c : d);
-}
-
-int64_t
-i64_le_select(int64_t a, int64_t b, int64_t c, int64_t d) {
- return ((a <= b) ? c : d);
-}
-
-int64_t
-i64_ge_select(int64_t a, int64_t b, int64_t c, int64_t d) {
- return ((a >= b) ? c : d);
-}
-
-int64_t
-i64_lt_select(int64_t a, int64_t b, int64_t c, int64_t d) {
- return ((a < b) ? c : d);
-}
-
-uint64_t
-i64_ugt_select(uint64_t a, uint64_t b, uint64_t c, uint64_t d)
-{
- return ((a > b) ? c : d);
-}
-
-uint64_t
-i64_ule_select(uint64_t a, uint64_t b, uint64_t c, uint64_t d)
-{
- return ((a <= b) ? c : d);
-}
-
-uint64_t
-i64_uge_select(uint64_t a, uint64_t b, uint64_t c, uint64_t d) {
- return ((a >= b) ? c : d);
-}
-
-uint64_t
-i64_ult_select(uint64_t a, uint64_t b, uint64_t c, uint64_t d) {
- return ((a < b) ? c : d);
-}
-
-/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- */
-
-struct harness_int64_pred int64_tests_eq[] = {
- {"a %s a", &tval_a, &tval_a, &tval_c, &tval_d, TRUE_VAL, &tval_c},
- {"a %s b", &tval_a, &tval_b, &tval_c, &tval_d, FALSE_VAL, &tval_d},
- {"a %s c", &tval_a, &tval_c, &tval_c, &tval_d, FALSE_VAL, &tval_d},
- {"d %s e", &tval_d, &tval_e, &tval_c, &tval_d, FALSE_VAL, &tval_d},
- {"e %s e", &tval_e, &tval_e, &tval_c, &tval_d, TRUE_VAL, &tval_c}
-};
-
-struct harness_int64_pred int64_tests_neq[] = {
- {"a %s a", &tval_a, &tval_a, &tval_c, &tval_d, FALSE_VAL, &tval_d},
- {"a %s b", &tval_a, &tval_b, &tval_c, &tval_d, TRUE_VAL, &tval_c},
- {"a %s c", &tval_a, &tval_c, &tval_c, &tval_d, TRUE_VAL, &tval_c},
- {"d %s e", &tval_d, &tval_e, &tval_c, &tval_d, TRUE_VAL, &tval_c},
- {"e %s e", &tval_e, &tval_e, &tval_c, &tval_d, FALSE_VAL, &tval_d}
-};
-
-struct harness_int64_pred int64_tests_sgt[] = {
- {"a %s a", &tval_a, &tval_a, &tval_c, &tval_d, FALSE_VAL, &tval_d},
- {"a %s b", &tval_a, &tval_b, &tval_c, &tval_d, FALSE_VAL, &tval_d},
- {"a %s c", &tval_a, &tval_c, &tval_c, &tval_d, TRUE_VAL, &tval_c},
- {"d %s e", &tval_d, &tval_e, &tval_c, &tval_d, TRUE_VAL, &tval_c},
- {"e %s e", &tval_e, &tval_e, &tval_c, &tval_d, FALSE_VAL, &tval_d}
-};
-
-struct harness_int64_pred int64_tests_sle[] = {
- {"a %s a", &tval_a, &tval_a, &tval_c, &tval_d, TRUE_VAL, &tval_c},
- {"a %s b", &tval_a, &tval_b, &tval_c, &tval_d, TRUE_VAL, &tval_c},
- {"a %s c", &tval_a, &tval_c, &tval_c, &tval_d, FALSE_VAL, &tval_d},
- {"d %s e", &tval_d, &tval_e, &tval_c, &tval_d, FALSE_VAL, &tval_d},
- {"e %s e", &tval_e, &tval_e, &tval_c, &tval_d, TRUE_VAL, &tval_c}
-};
-
-struct harness_int64_pred int64_tests_sge[] = {
- {"a %s a", &tval_a, &tval_a, &tval_c, &tval_d, TRUE_VAL, &tval_c},
- {"a %s b", &tval_a, &tval_b, &tval_c, &tval_d, FALSE_VAL, &tval_d},
- {"a %s c", &tval_a, &tval_c, &tval_c, &tval_d, TRUE_VAL, &tval_c},
- {"d %s e", &tval_d, &tval_e, &tval_c, &tval_d, TRUE_VAL, &tval_c},
- {"e %s e", &tval_e, &tval_e, &tval_c, &tval_d, TRUE_VAL, &tval_c}
-};
-
-struct harness_int64_pred int64_tests_slt[] = {
- {"a %s a", &tval_a, &tval_a, &tval_c, &tval_d, FALSE_VAL, &tval_d},
- {"a %s b", &tval_a, &tval_b, &tval_c, &tval_d, TRUE_VAL, &tval_c},
- {"a %s c", &tval_a, &tval_c, &tval_c, &tval_d, FALSE_VAL, &tval_d},
- {"d %s e", &tval_d, &tval_e, &tval_c, &tval_d, FALSE_VAL, &tval_d},
- {"e %s e", &tval_e, &tval_e, &tval_c, &tval_d, FALSE_VAL, &tval_d}
-};
-
-struct int64_pred_s int64_preds[] = {
- {"eq", i64_eq, i64_eq_select,
- int64_tests_eq, ARR_SIZE(int64_tests_eq)},
- {"neq", i64_neq, i64_neq_select,
- int64_tests_neq, ARR_SIZE(int64_tests_neq)},
- {"gt", i64_gt, i64_gt_select,
- int64_tests_sgt, ARR_SIZE(int64_tests_sgt)},
- {"le", i64_le, i64_le_select,
- int64_tests_sle, ARR_SIZE(int64_tests_sle)},
- {"ge", i64_ge, i64_ge_select,
- int64_tests_sge, ARR_SIZE(int64_tests_sge)},
- {"lt", i64_lt, i64_lt_select,
- int64_tests_slt, ARR_SIZE(int64_tests_slt)}
-};
-
-/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- */
-
-struct harness_uint64_pred uint64_tests_ugt[] = {
- {"a %s a", (uint64_t *) &tval_a, (uint64_t *) &tval_a, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, FALSE_VAL, (uint64_t *) &tval_d},
- {"a %s b", (uint64_t *) &tval_a, (uint64_t *) &tval_b, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, FALSE_VAL, (uint64_t *) &tval_d },
- {"a %s c", (uint64_t *) &tval_a, (uint64_t *) &tval_c, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, TRUE_VAL, (uint64_t *) &tval_c },
- {"d %s e", (uint64_t *) &tval_d, (uint64_t *) &tval_e, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, TRUE_VAL, (uint64_t *) &tval_c },
- {"e %s e", (uint64_t *) &tval_e, (uint64_t *) &tval_e, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, FALSE_VAL, (uint64_t *) &tval_d }
-};
-
-struct harness_uint64_pred uint64_tests_ule[] = {
- {"a %s a", (uint64_t *) &tval_a, (uint64_t *) &tval_a, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, TRUE_VAL, (uint64_t *) &tval_c},
- {"a %s b", (uint64_t *) &tval_a, (uint64_t *) &tval_b, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, TRUE_VAL, (uint64_t *) &tval_c},
- {"a %s c", (uint64_t *) &tval_a, (uint64_t *) &tval_c, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, FALSE_VAL, (uint64_t *) &tval_d},
- {"d %s e", (uint64_t *) &tval_d, (uint64_t *) &tval_e, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, FALSE_VAL, (uint64_t *) &tval_d},
- {"e %s e", (uint64_t *) &tval_e, (uint64_t *) &tval_e, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, TRUE_VAL, (uint64_t *) &tval_c}
-};
-
-struct harness_uint64_pred uint64_tests_uge[] = {
- {"a %s a", (uint64_t *) &tval_a, (uint64_t *) &tval_a, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, TRUE_VAL, (uint64_t *) &tval_c},
- {"a %s b", (uint64_t *) &tval_a, (uint64_t *) &tval_b, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, FALSE_VAL, (uint64_t *) &tval_d},
- {"a %s c", (uint64_t *) &tval_a, (uint64_t *) &tval_c, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, TRUE_VAL, (uint64_t *) &tval_c},
- {"d %s e", (uint64_t *) &tval_d, (uint64_t *) &tval_e, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, TRUE_VAL, (uint64_t *) &tval_c},
- {"e %s e", (uint64_t *) &tval_e, (uint64_t *) &tval_e, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, TRUE_VAL, (uint64_t *) &tval_c}
-};
-
-struct harness_uint64_pred uint64_tests_ult[] = {
- {"a %s a", (uint64_t *) &tval_a, (uint64_t *) &tval_a, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, FALSE_VAL, (uint64_t *) &tval_d},
- {"a %s b", (uint64_t *) &tval_a, (uint64_t *) &tval_b, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, TRUE_VAL, (uint64_t *) &tval_c},
- {"a %s c", (uint64_t *) &tval_a, (uint64_t *) &tval_c, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, FALSE_VAL, (uint64_t *) &tval_d},
- {"d %s e", (uint64_t *) &tval_d, (uint64_t *) &tval_e, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, FALSE_VAL, (uint64_t *) &tval_d},
- {"e %s e", (uint64_t *) &tval_e, (uint64_t *) &tval_e, (uint64_t *) &tval_c,
- (uint64_t *) &tval_d, FALSE_VAL, (uint64_t *) &tval_d}
-};
-
-struct uint64_pred_s uint64_preds[] = {
- {"ugt", i64_ugt, i64_ugt_select,
- uint64_tests_ugt, ARR_SIZE(uint64_tests_ugt)},
- {"ule", i64_ule, i64_ule_select,
- uint64_tests_ule, ARR_SIZE(uint64_tests_ule)},
- {"uge", i64_uge, i64_uge_select,
- uint64_tests_uge, ARR_SIZE(uint64_tests_uge)},
- {"ult", i64_ult, i64_ult_select,
- uint64_tests_ult, ARR_SIZE(uint64_tests_ult)}
-};
-
-int
-compare_expect_int64(const struct int64_pred_s * pred)
-{
- int j, failed = 0;
-
- for (j = 0; j < pred->n_tests; ++j) {
- int pred_result;
-
- pred_result = (*pred->predfunc) (*pred->tests[j].lhs, *pred->tests[j].rhs);
-
- if (pred_result != pred->tests[j].expected) {
- char str[64];
-
- sprintf(str, pred->tests[j].fmt_string, pred->name);
- printf("%s: returned value is %d, expecting %d\n", str,
- pred_result, pred->tests[j].expected);
- printf(" lhs = %19lld (0x%016llx)\n", *pred->tests[j].lhs,
- *pred->tests[j].lhs);
- printf(" rhs = %19lld (0x%016llx)\n", *pred->tests[j].rhs,
- *pred->tests[j].rhs);
- ++failed;
- } else {
- int64_t selresult;
-
- selresult = (pred->selfunc) (*pred->tests[j].lhs, *pred->tests[j].rhs,
- *pred->tests[j].select_a,
- *pred->tests[j].select_b);
-
- if (selresult != *pred->tests[j].select_expected) {
- char str[64];
-
- sprintf(str, pred->tests[j].fmt_string, pred->name);
- printf("%s select: returned value is %d, expecting %d\n", str,
- pred_result, pred->tests[j].expected);
- printf(" lhs = %19lld (0x%016llx)\n", *pred->tests[j].lhs,
- *pred->tests[j].lhs);
- printf(" rhs = %19lld (0x%016llx)\n", *pred->tests[j].rhs,
- *pred->tests[j].rhs);
- printf(" true = %19lld (0x%016llx)\n", *pred->tests[j].select_a,
- *pred->tests[j].select_a);
- printf(" false = %19lld (0x%016llx)\n", *pred->tests[j].select_b,
- *pred->tests[j].select_b);
- ++failed;
- }
- }
- }
-
- printf(" %d tests performed, should be %d.\n", j, pred->n_tests);
-
- return failed;
-}
-
-int
-compare_expect_uint64(const struct uint64_pred_s * pred)
-{
- int j, failed = 0;
-
- for (j = 0; j < pred->n_tests; ++j) {
- int pred_result;
-
- pred_result = (*pred->predfunc) (*pred->tests[j].lhs, *pred->tests[j].rhs);
- if (pred_result != pred->tests[j].expected) {
- char str[64];
-
- sprintf(str, pred->tests[j].fmt_string, pred->name);
- printf("%s: returned value is %d, expecting %d\n", str,
- pred_result, pred->tests[j].expected);
- printf(" lhs = %19llu (0x%016llx)\n", *pred->tests[j].lhs,
- *pred->tests[j].lhs);
- printf(" rhs = %19llu (0x%016llx)\n", *pred->tests[j].rhs,
- *pred->tests[j].rhs);
- ++failed;
- } else {
- uint64_t selresult;
-
- selresult = (pred->selfunc) (*pred->tests[j].lhs, *pred->tests[j].rhs,
- *pred->tests[j].select_a,
- *pred->tests[j].select_b);
- if (selresult != *pred->tests[j].select_expected) {
- char str[64];
-
- sprintf(str, pred->tests[j].fmt_string, pred->name);
- printf("%s select: returned value is %d, expecting %d\n", str,
- pred_result, pred->tests[j].expected);
- printf(" lhs = %19llu (0x%016llx)\n", *pred->tests[j].lhs,
- *pred->tests[j].lhs);
- printf(" rhs = %19llu (0x%016llx)\n", *pred->tests[j].rhs,
- *pred->tests[j].rhs);
- printf(" true = %19llu (0x%016llx)\n", *pred->tests[j].select_a,
- *pred->tests[j].select_a);
- printf(" false = %19llu (0x%016llx)\n", *pred->tests[j].select_b,
- *pred->tests[j].select_b);
- ++failed;
- }
- }
- }
-
- printf(" %d tests performed, should be %d.\n", j, pred->n_tests);
-
- return failed;
-}
-
-/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- */
-
-int
-test_i64_sext_i32(int in, int64_t expected) {
- int64_t result = (int64_t) in;
-
- if (result != expected) {
- char str[64];
- sprintf(str, "i64_sext_i32(%d) returns %lld\n", in, result);
- return 1;
- }
-
- return 0;
-}
-
-int
-test_i64_sext_i16(short in, int64_t expected) {
- int64_t result = (int64_t) in;
-
- if (result != expected) {
- char str[64];
- sprintf(str, "i64_sext_i16(%hd) returns %lld\n", in, result);
- return 1;
- }
-
- return 0;
-}
-
-int
-test_i64_sext_i8(signed char in, int64_t expected) {
- int64_t result = (int64_t) in;
-
- if (result != expected) {
- char str[64];
- sprintf(str, "i64_sext_i8(%d) returns %lld\n", in, result);
- return 1;
- }
-
- return 0;
-}
-
-int
-test_i64_zext_i32(unsigned int in, uint64_t expected) {
- uint64_t result = (uint64_t) in;
-
- if (result != expected) {
- char str[64];
- sprintf(str, "i64_zext_i32(%u) returns %llu\n", in, result);
- return 1;
- }
-
- return 0;
-}
-
-int
-test_i64_zext_i16(unsigned short in, uint64_t expected) {
- uint64_t result = (uint64_t) in;
-
- if (result != expected) {
- char str[64];
- sprintf(str, "i64_zext_i16(%hu) returns %llu\n", in, result);
- return 1;
- }
-
- return 0;
-}
-
-int
-test_i64_zext_i8(unsigned char in, uint64_t expected) {
- uint64_t result = (uint64_t) in;
-
- if (result != expected) {
- char str[64];
- sprintf(str, "i64_zext_i8(%u) returns %llu\n", in, result);
- return 1;
- }
-
- return 0;
-}
-
-/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- */
-
-int64_t
-i64_shl_const(int64_t a) {
- return a << 10;
-}
-
-int64_t
-i64_shl(int64_t a, int amt) {
- return a << amt;
-}
-
-uint64_t
-u64_shl_const(uint64_t a) {
- return a << 10;
-}
-
-uint64_t
-u64_shl(uint64_t a, int amt) {
- return a << amt;
-}
-
-int64_t
-i64_srl_const(int64_t a) {
- return a >> 10;
-}
-
-int64_t
-i64_srl(int64_t a, int amt) {
- return a >> amt;
-}
-
-uint64_t
-u64_srl_const(uint64_t a) {
- return a >> 10;
-}
-
-uint64_t
-u64_srl(uint64_t a, int amt) {
- return a >> amt;
-}
-
-int64_t
-i64_sra_const(int64_t a) {
- return a >> 10;
-}
-
-int64_t
-i64_sra(int64_t a, int amt) {
- return a >> amt;
-}
-
-uint64_t
-u64_sra_const(uint64_t a) {
- return a >> 10;
-}
-
-uint64_t
-u64_sra(uint64_t a, int amt) {
- return a >> amt;
-}
-
-int
-test_u64_constant_shift(const char *func_name, uint64_t (*func)(uint64_t), uint64_t a, uint64_t expected) {
- uint64_t result = (*func)(a);
-
- if (result != expected) {
- printf("%s(0x%016llx) returns 0x%016llx, expected 0x%016llx\n", func_name, a, result, expected);
- return 1;
- }
-
- return 0;
-}
-
-int
-test_i64_constant_shift(const char *func_name, int64_t (*func)(int64_t), int64_t a, int64_t expected) {
- int64_t result = (*func)(a);
-
- if (result != expected) {
- printf("%s(0x%016llx) returns 0x%016llx, expected 0x%016llx\n", func_name, a, result, expected);
- return 1;
- }
-
- return 0;
-}
-
-int
-test_u64_variable_shift(const char *func_name, uint64_t (*func)(uint64_t, int), uint64_t a, unsigned int b, uint64_t expected) {
- uint64_t result = (*func)(a, b);
-
- if (result != expected) {
- printf("%s(0x%016llx, %d) returns 0x%016llx, expected 0x%016llx\n", func_name, a, b, result, expected);
- return 1;
- }
-
- return 0;
-}
-
-int
-test_i64_variable_shift(const char *func_name, int64_t (*func)(int64_t, int), int64_t a, unsigned int b, int64_t expected) {
- int64_t result = (*func)(a, b);
-
- if (result != expected) {
- printf("%s(0x%016llx, %d) returns 0x%016llx, expected 0x%016llx\n", func_name, a, b, result, expected);
- return 1;
- }
-
- return 0;
-}
-
-/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- */
-
-int64_t i64_mul(int64_t a, int64_t b) {
- return a * b;
-}
-
-/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- */
-
-int
-main(void)
-{
- int i, j, failed = 0;
- const char *something_failed = " %d tests failed.\n";
- const char *all_tests_passed = " All tests passed.\n";
-
- printf("tval_a = %20lld (0x%016llx)\n", tval_a, tval_a);
- printf("tval_b = %20lld (0x%016llx)\n", tval_b, tval_b);
- printf("tval_c = %20lld (0x%016llx)\n", tval_c, tval_c);
- printf("tval_d = %20lld (0x%016llx)\n", tval_d, tval_d);
- printf("tval_e = %20lld (0x%016llx)\n", tval_e, tval_e);
- printf("tval_f = %20llu (0x%016llx)\n", tval_f, tval_f);
- printf("tval_g = %20llu (0x%016llx)\n", tval_g, tval_g);
- printf("----------------------------------------\n");
-
- for (i = 0; i < ARR_SIZE(int64_preds); ++i) {
- printf("%s series:\n", int64_preds[i].name);
- if ((failed = compare_expect_int64(int64_preds + i)) > 0) {
- printf(something_failed, failed);
- } else {
- printf(all_tests_passed);
- }
-
- printf("----------------------------------------\n");
- }
-
- for (i = 0; i < ARR_SIZE(uint64_preds); ++i) {
- printf("%s series:\n", uint64_preds[i].name);
- if ((failed = compare_expect_uint64(uint64_preds + i)) > 0) {
- printf(something_failed, failed);
- } else {
- printf(all_tests_passed);
- }
-
- printf("----------------------------------------\n");
- }
-
- /*----------------------------------------------------------------------*/
-
- puts("signed/zero-extend tests:");
-
- failed = 0;
- failed += test_i64_sext_i32(-1, -1LL);
- failed += test_i64_sext_i32(10, 10LL);
- failed += test_i64_sext_i32(0x7fffffff, 0x7fffffffLL);
- failed += test_i64_sext_i16(-1, -1LL);
- failed += test_i64_sext_i16(10, 10LL);
- failed += test_i64_sext_i16(0x7fff, 0x7fffLL);
- failed += test_i64_sext_i8(-1, -1LL);
- failed += test_i64_sext_i8(10, 10LL);
- failed += test_i64_sext_i8(0x7f, 0x7fLL);
-
- failed += test_i64_zext_i32(0xffffffff, 0x00000000ffffffffLLU);
- failed += test_i64_zext_i32(0x01234567, 0x0000000001234567LLU);
- failed += test_i64_zext_i16(0xffff, 0x000000000000ffffLLU);
- failed += test_i64_zext_i16(0x569a, 0x000000000000569aLLU);
- failed += test_i64_zext_i8(0xff, 0x00000000000000ffLLU);
- failed += test_i64_zext_i8(0xa0, 0x00000000000000a0LLU);
-
- if (failed > 0) {
- printf(" %d tests failed.\n", failed);
- } else {
- printf(" All tests passed.\n");
- }
-
- printf("----------------------------------------\n");
-
- failed = 0;
- puts("signed left/right shift tests:");
- failed += test_i64_constant_shift("i64_shl_const", i64_shl_const, tval_a, 0x00047dc7ec114c00LL);
- failed += test_i64_variable_shift("i64_shl", i64_shl, tval_a, 10, 0x00047dc7ec114c00LL);
- failed += test_i64_constant_shift("i64_srl_const", i64_srl_const, tval_a, 0x0000000047dc7ec1LL);
- failed += test_i64_variable_shift("i64_srl", i64_srl, tval_a, 10, 0x0000000047dc7ec1LL);
- failed += test_i64_constant_shift("i64_sra_const", i64_sra_const, tval_a, 0x0000000047dc7ec1LL);
- failed += test_i64_variable_shift("i64_sra", i64_sra, tval_a, 10, 0x0000000047dc7ec1LL);
-
- if (failed > 0) {
- printf(" %d tests ailed.\n", failed);
- } else {
- printf(" All tests passed.\n");
- }
-
- printf("----------------------------------------\n");
-
- failed = 0;
- puts("unsigned left/right shift tests:");
- failed += test_u64_constant_shift("u64_shl_const", u64_shl_const, tval_f, 0xfffc1d404d7ae400LL);
- failed += test_u64_variable_shift("u64_shl", u64_shl, tval_f, 10, 0xfffc1d404d7ae400LL);
- failed += test_u64_constant_shift("u64_srl_const", u64_srl_const, tval_f, 0x003fffffc1d404d7LL);
- failed += test_u64_variable_shift("u64_srl", u64_srl, tval_f, 10, 0x003fffffc1d404d7LL);
- failed += test_i64_constant_shift("i64_sra_const", i64_sra_const, tval_f, 0xffffffffc1d404d7LL);
- failed += test_i64_variable_shift("i64_sra", i64_sra, tval_f, 10, 0xffffffffc1d404d7LL);
- failed += test_u64_constant_shift("u64_sra_const", u64_sra_const, tval_f, 0x003fffffc1d404d7LL);
- failed += test_u64_variable_shift("u64_sra", u64_sra, tval_f, 10, 0x003fffffc1d404d7LL);
-
- if (failed > 0) {
- printf(" %d tests ailed.\n", failed);
- } else {
- printf(" All tests passed.\n");
- }
-
- printf("----------------------------------------\n");
-
- int64_t result;
-
- result = i64_mul(tval_g, tval_g);
- printf("%20lld * %20lld = %20lld (0x%016llx)\n", tval_g, tval_g, result, result);
- result = i64_mul(tval_d, tval_e);
- printf("%20lld * %20lld = %20lld (0x%016llx)\n", tval_d, tval_e, result, result);
- /* 0xba7a664f13077c9 */
- result = i64_mul(tval_a, tval_b);
- printf("%20lld * %20lld = %20lld (0x%016llx)\n", tval_a, tval_b, result, result);
-
- printf("----------------------------------------\n");
-
- return 0;
-}
diff --git a/test/CodeGen/CellSPU/useful-harnesses/i64operations.h b/test/CodeGen/CellSPU/useful-harnesses/i64operations.h
deleted file mode 100644
index 7a02794cd7..0000000000
--- a/test/CodeGen/CellSPU/useful-harnesses/i64operations.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#define TRUE_VAL (!0)
-#define FALSE_VAL 0
-#define ARR_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
-
-typedef unsigned long long int uint64_t;
-typedef long long int int64_t;
-
-/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- */
-struct harness_int64_pred {
- const char *fmt_string;
- int64_t *lhs;
- int64_t *rhs;
- int64_t *select_a;
- int64_t *select_b;
- int expected;
- int64_t *select_expected;
-};
-
-struct harness_uint64_pred {
- const char *fmt_string;
- uint64_t *lhs;
- uint64_t *rhs;
- uint64_t *select_a;
- uint64_t *select_b;
- int expected;
- uint64_t *select_expected;
-};
-
-struct int64_pred_s {
- const char *name;
- int (*predfunc) (int64_t, int64_t);
- int64_t (*selfunc) (int64_t, int64_t, int64_t, int64_t);
- struct harness_int64_pred *tests;
- int n_tests;
-};
-
-struct uint64_pred_s {
- const char *name;
- int (*predfunc) (uint64_t, uint64_t);
- uint64_t (*selfunc) (uint64_t, uint64_t, uint64_t, uint64_t);
- struct harness_uint64_pred *tests;
- int n_tests;
-};
diff --git a/test/CodeGen/CellSPU/useful-harnesses/lit.local.cfg b/test/CodeGen/CellSPU/useful-harnesses/lit.local.cfg
deleted file mode 100644
index e6f55eef7a..0000000000
--- a/test/CodeGen/CellSPU/useful-harnesses/lit.local.cfg
+++ /dev/null
@@ -1 +0,0 @@
-config.suffixes = []
diff --git a/test/CodeGen/CellSPU/useful-harnesses/vecoperations.c b/test/CodeGen/CellSPU/useful-harnesses/vecoperations.c
deleted file mode 100644
index c4c86e3763..0000000000
--- a/test/CodeGen/CellSPU/useful-harnesses/vecoperations.c
+++ /dev/null
@@ -1,179 +0,0 @@
-#include <stdio.h>
-
-typedef unsigned char v16i8 __attribute__((ext_vector_type(16)));
-typedef short v8i16 __attribute__((ext_vector_type(16)));
-typedef int v4i32 __attribute__((ext_vector_type(4)));
-typedef float v4f32 __attribute__((ext_vector_type(4)));
-typedef long long v2i64 __attribute__((ext_vector_type(2)));
-typedef double v2f64 __attribute__((ext_vector_type(2)));
-
-void print_v16i8(const char *str, const v16i8 v) {
- union {
- unsigned char elts[16];
- v16i8 vec;
- } tv;
- tv.vec = v;
- printf("%s = { %hhu, %hhu, %hhu, %hhu, %hhu, %hhu, %hhu, "
- "%hhu, %hhu, %hhu, %hhu, %hhu, %hhu, %hhu, "
- "%hhu, %hhu }\n",
- str, tv.elts[0], tv.elts[1], tv.elts[2], tv.elts[3], tv.elts[4], tv.elts[5],
- tv.elts[6], tv.elts[7], tv.elts[8], tv.elts[9], tv.elts[10], tv.elts[11],
- tv.elts[12], tv.elts[13], tv.elts[14], tv.elts[15]);
-}
-
-void print_v16i8_hex(const char *str, const v16i8 v) {
- union {
- unsigned char elts[16];
- v16i8 vec;
- } tv;
- tv.vec = v;
- printf("%s = { 0x%02hhx, 0x%02hhx, 0x%02hhx, 0x%02hhx, 0x%02hhx, 0x%02hhx, 0x%02hhx, "
- "0x%02hhx, 0x%02hhx, 0x%02hhx, 0x%02hhx, 0x%02hhx, 0x%02hhx, 0x%02hhx, "
- "0x%02hhx, 0x%02hhx }\n",
- str, tv.elts[0], tv.elts[1], tv.elts[2], tv.elts[3], tv.elts[4], tv.elts[5],
- tv.elts[6], tv.elts[7], tv.elts[8], tv.elts[9], tv.elts[10], tv.elts[11],
- tv.elts[12], tv.elts[13], tv.elts[14], tv.elts[15]);
-}
-
-void print_v8i16_hex(const char *str, v8i16 v) {
- union {
- short elts[8];
- v8i16 vec;
- } tv;
- tv.vec = v;
- printf("%s = { 0x%04hx, 0x%04hx, 0x%04hx, 0x%04hx, 0x%04hx, "
- "0x%04hx, 0x%04hx, 0x%04hx }\n",
- str, tv.elts[0], tv.elts[1], tv.elts[2], tv.elts[3], tv.elts[4],
- tv.elts[5], tv.elts[6], tv.elts[7]);
-}
-
-void print_v4i32(const char *str, v4i32 v) {
- printf("%s = { %d, %d, %d, %d }\n", str, v.x, v.y, v.z, v.w);
-}
-
-void print_v4f32(const char *str, v4f32 v) {
- printf("%s = { %f, %f, %f, %f }\n", str, v.x, v.y, v.z, v.w);
-}
-
-void print_v2i64(const char *str, v2i64 v) {
- printf("%s = { %lld, %lld }\n", str, v.x, v.y);
-}
-
-void print_v2f64(const char *str, v2f64 v) {
- printf("%s = { %g, %g }\n", str, v.x, v.y);
-}
-
-/*----------------------------------------------------------------------*/
-
-v16i8 v16i8_mpy(v16i8 v1, v16i8 v2) {
- return v1 * v2;
-}
-
-v16i8 v16i8_add(v16i8 v1, v16i8 v2) {
- return v1 + v2;
-}
-
-v4i32 v4i32_shuffle_1(v4i32 a) {
- v4i32 c2 = a.yzwx;
- return c2;
-}
-
-v4i32 v4i32_shuffle_2(v4i32 a) {
- v4i32 c2 = a.zwxy;
- return c2;
-}
-
-v4i32 v4i32_shuffle_3(v4i32 a) {
- v4i32 c2 = a.wxyz;
- return c2;
-}
-
-v4i32 v4i32_shuffle_4(v4i32 a) {
- v4i32 c2 = a.xyzw;
- return c2;
-}
-
-v4i32 v4i32_shuffle_5(v4i32 a) {
- v4i32 c2 = a.xwzy;
- return c2;
-}
-
-v4f32 v4f32_shuffle_1(v4f32 a) {
- v4f32 c2 = a.yzwx;
- return c2;
-}
-
-v4f32 v4f32_shuffle_2(v4f32 a) {
- v4f32 c2 = a.zwxy;
- return c2;
-}
-
-v4f32 v4f32_shuffle_3(v4f32 a) {
- v4f32 c2 = a.wxyz;
- return c2;
-}
-
-v4f32 v4f32_shuffle_4(v4f32 a) {
- v4f32 c2 = a.xyzw;
- return c2;
-}
-
-v4f32 v4f32_shuffle_5(v4f32 a) {
- v4f32 c2 = a.xwzy;
- return c2;
-}
-
-v2i64 v2i64_shuffle(v2i64 a) {
- v2i64 c2 = a.yx;
- return c2;
-}
-
-v2f64 v2f64_shuffle(v2f64 a) {
- v2f64 c2 = a.yx;
- return c2;
-}
-
-int main(void) {
- v16i8 v00 = { 0xf4, 0xad, 0x01, 0xe9, 0x51, 0x78, 0xc1, 0x8a,
- 0x94, 0x7c, 0x49, 0x6c, 0x21, 0x32, 0xb2, 0x04 };
- v16i8 va0 = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10 };
- v16i8 va1 = { 0x11, 0x83, 0x4b, 0x63, 0xff, 0x90, 0x32, 0xe5,
- 0x5a, 0xaa, 0x20, 0x01, 0x0d, 0x15, 0x77, 0x05 };
- v8i16 v01 = { 0x1a87, 0x0a14, 0x5014, 0xfff0,
- 0xe194, 0x0184, 0x801e, 0x5940 };
- v4i32 v1 = { 1, 2, 3, 4 };
- v4f32 v2 = { 1.0, 2.0, 3.0, 4.0 };
- v2i64 v3 = { 691043ll, 910301513ll };
- v2f64 v4 = { 5.8e56, 9.103e-62 };
-
- puts("---- vector tests start ----");
-
- print_v16i8_hex("v00 ", v00);
- print_v16i8_hex("va0 ", va0);
- print_v16i8_hex("va1 ", va1);
- print_v16i8_hex("va0 x va1 ", v16i8_mpy(va0, va1));
- print_v16i8_hex("va0 + va1 ", v16i8_add(va0, va1));
- print_v8i16_hex("v01 ", v01);
-
- print_v4i32("v4i32_shuffle_1(1, 2, 3, 4)", v4i32_shuffle_1(v1));
- print_v4i32("v4i32_shuffle_2(1, 2, 3, 4)", v4i32_shuffle_2(v1));
- print_v4i32("v4i32_shuffle_3(1, 2, 3, 4)", v4i32_shuffle_3(v1));
- print_v4i32("v4i32_shuffle_4(1, 2, 3, 4)", v4i32_shuffle_4(v1));
- print_v4i32("v4i32_shuffle_5(1, 2, 3, 4)", v4i32_shuffle_5(v1));
-
- print_v4f32("v4f32_shuffle_1(1, 2, 3, 4)", v4f32_shuffle_1(v2));
- print_v4f32("v4f32_shuffle_2(1, 2, 3, 4)", v4f32_shuffle_2(v2));
- print_v4f32("v4f32_shuffle_3(1, 2, 3, 4)", v4f32_shuffle_3(v2));
- print_v4f32("v4f32_shuffle_4(1, 2, 3, 4)", v4f32_shuffle_4(v2));
- print_v4f32("v4f32_shuffle_5(1, 2, 3, 4)", v4f32_shuffle_5(v2));
-
- print_v2i64("v3 ", v3);
- print_v2i64("v2i64_shuffle ", v2i64_shuffle(v3));
- print_v2f64("v4 ", v4);
- print_v2f64("v2f64_shuffle ", v2f64_shuffle(v4));
-
- puts("---- vector tests end ----");
-
- return 0;
-}