0001
0002
0003
0004
0005
0006
0007 #include <stdio.h>
0008 #include <stdint.h>
0009
0010 #include "utils.h"
0011
0012 extern void test_mma(uint16_t (*)[8], uint16_t (*)[8], uint32_t (*)[4*4]);
0013
0014 static int mma(void)
0015 {
0016 int i;
0017 int rc = 0;
0018 uint16_t x[] = {1, 0, 2, 0, 3, 0, 4, 0};
0019 uint16_t y[] = {1, 0, 2, 0, 3, 0, 4, 0};
0020 uint32_t z[4*4];
0021 uint32_t exp[4*4] = {1, 2, 3, 4,
0022 2, 4, 6, 8,
0023 3, 6, 9, 12,
0024 4, 8, 12, 16};
0025
0026 SKIP_IF_MSG(!have_hwcap2(PPC_FEATURE2_ARCH_3_1), "Need ISAv3.1");
0027 SKIP_IF_MSG(!have_hwcap2(PPC_FEATURE2_MMA), "Need MMA");
0028
0029 test_mma(&x, &y, &z);
0030
0031 for (i = 0; i < 16; i++) {
0032 printf("MMA[%d] = %d ", i, z[i]);
0033
0034 if (z[i] == exp[i]) {
0035 printf(" (Correct)\n");
0036 } else {
0037 printf(" (Incorrect)\n");
0038 rc = 1;
0039 }
0040 }
0041
0042 return rc;
0043 }
0044
0045 int main(int argc, char *argv[])
0046 {
0047 return test_harness(mma, "mma");
0048 }