~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/powerpc/ptrace/ptrace-vsx.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * Copyright (C) 2015 Anshuman Khandual, IBM Corporation.
  4  */
  5 #define VEC_MAX 128
  6 #define VSX_MAX 32
  7 #define VMX_MAX 32
  8 
  9 /*
 10  * unsigned long vsx[32]
 11  * unsigned long load[128]
 12  */
 13 int validate_vsx(unsigned long *vsx, unsigned long *load)
 14 {
 15         int i;
 16 
 17         for (i = 0; i < VSX_MAX; i++) {
 18                 if (vsx[i] != load[2 * i + 1]) {
 19                         printf("vsx[%d]: %lx load[%d] %lx\n",
 20                                         i, vsx[i], 2 * i + 1, load[2 * i + 1]);
 21                         return TEST_FAIL;
 22                 }
 23         }
 24         return TEST_PASS;
 25 }
 26 
 27 /*
 28  * unsigned long vmx[32][2]
 29  * unsigned long load[128]
 30  */
 31 int validate_vmx(unsigned long vmx[][2], unsigned long *load)
 32 {
 33         int i;
 34 
 35         for (i = 0; i < VMX_MAX; i++) {
 36                 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
 37                 if ((vmx[i][0] != load[64 + 2 * i]) ||
 38                                 (vmx[i][1] != load[65 + 2 * i])) {
 39                         printf("vmx[%d][0]: %lx load[%d] %lx\n",
 40                                         i, vmx[i][0], 64 + 2 * i,
 41                                         load[64 + 2 * i]);
 42                         printf("vmx[%d][1]: %lx load[%d] %lx\n",
 43                                         i, vmx[i][1], 65 + 2 * i,
 44                                         load[65 + 2 * i]);
 45                         return TEST_FAIL;
 46                 }
 47                 #else  /*
 48                         * In LE each value pair is stored in an
 49                         * alternate manner.
 50                         */
 51                 if ((vmx[i][0] != load[65 + 2 * i]) ||
 52                                 (vmx[i][1] != load[64 + 2 * i])) {
 53                         printf("vmx[%d][0]: %lx load[%d] %lx\n",
 54                                         i, vmx[i][0], 65 + 2 * i,
 55                                         load[65 + 2 * i]);
 56                         printf("vmx[%d][1]: %lx load[%d] %lx\n",
 57                                         i, vmx[i][1], 64 + 2 * i,
 58                                         load[64 + 2 * i]);
 59                         return TEST_FAIL;
 60                 }
 61                 #endif
 62         }
 63         return TEST_PASS;
 64 }
 65 
 66 /*
 67  * unsigned long store[128]
 68  * unsigned long load[128]
 69  */
 70 int compare_vsx_vmx(unsigned long *store, unsigned long *load)
 71 {
 72         int i;
 73 
 74         for (i = 0; i < VSX_MAX; i++) {
 75                 if (store[1 + 2 * i] != load[1 + 2 * i]) {
 76                         printf("store[%d]: %lx load[%d] %lx\n",
 77                                         1 + 2 * i, store[i],
 78                                         1 + 2 * i, load[i]);
 79                         return TEST_FAIL;
 80                 }
 81         }
 82 
 83         #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
 84         for (i = 64; i < VEC_MAX; i++) {
 85                 if (store[i] != load[i]) {
 86                         printf("store[%d]: %lx load[%d] %lx\n",
 87                                         i, store[i], i, load[i]);
 88                         return TEST_FAIL;
 89                 }
 90         }
 91         #else   /* In LE each value pair is stored in an alternate manner */
 92         for (i = 64; i < VEC_MAX; i++) {
 93                 if (!(i % 2) && (store[i] != load[i+1])) {
 94                         printf("store[%d]: %lx load[%d] %lx\n",
 95                                         i, store[i], i+1, load[i+1]);
 96                         return TEST_FAIL;
 97                 }
 98                 if ((i % 2) && (store[i] != load[i-1])) {
 99                         printf("here store[%d]: %lx load[%d] %lx\n",
100                                         i, store[i], i-1, load[i-1]);
101                         return TEST_FAIL;
102                 }
103         }
104         #endif
105         return TEST_PASS;
106 }
107 
108 void load_vsx_vmx(unsigned long *load, unsigned long *vsx,
109                 unsigned long vmx[][2])
110 {
111         int i;
112 
113         for (i = 0; i < VSX_MAX; i++)
114                 vsx[i] = load[1 + 2 * i];
115 
116         for (i = 0; i < VMX_MAX; i++) {
117                 vmx[i][0] = load[64 + 2 * i];
118                 vmx[i][1] = load[65 + 2 * i];
119         }
120 }
121 
122 void loadvsx(void *p, int tmp);
123 void storevsx(void *p, int tmp);
124 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php