17 printf(
"=== RUN %s\n", __func__);
21 unsigned tid = 0; tid += blockIdx.z;
22 tid *= gridDim.y; tid += blockIdx.y;
23 tid *= gridDim.x; tid += blockIdx.x;
24 tid *= blockDim.z; tid += threadIdx.z;
25 tid *= blockDim.y; tid += threadIdx.y;
26 tid *= blockDim.x; tid += threadIdx.x;
28 uint64_t v[6] = { tid + 2, 0, 0, 0, 0, 0 };
34 if (x[0] != tid+2) pass =
false;
35 if (x[1] != 0) pass =
false;
36 if (x[2] != 0) pass =
false;
37 if (x[3] != 0) pass =
false;
38 if (x[4] != 0) pass =
false;
39 if (x[5] != 0) pass =
false;
42 printf(
"%d: FAILED after fp_fromUint64\n", tid);
48 if (y[0] == tid+2) pass =
false;
51 printf(
"%d: FAILED after fp_inv\n", tid);
59 if (z[0] != 1) pass =
false;
60 if (z[1] != 0) pass =
false;
61 if (z[2] != 0) pass =
false;
62 if (z[3] != 0) pass =
false;
63 if (z[4] != 0) pass =
false;
64 if (z[5] != 0) pass =
false;
67 printf(
"%d: FAILED test of inverse\n", tid);
75 if (z[0] != v[0]) pass =
false;
76 if (z[1] != v[1]) pass =
false;
77 if (z[2] != v[2]) pass =
false;
78 if (z[3] != v[3]) pass =
false;
79 if (z[4] != v[4]) pass =
false;
80 if (z[5] != v[5]) pass =
false;
83 printf(
"%d: FAILED to match input value\n", tid);
__device__ __host__ void fp_fromUint64(fp_t &z, const uint64_t *x)
Converts uint64_t[6] to fp_t. After this operation, z represents x mod p.
__device__ void fp_reduce6(fp_t &z)
Narrow reduction of a residue modulo p, reducing to the canonical representation.
uint64_t fp_t[6]
Residue modulo p. Any 384-bit representative of each residue is allowed, and stored as a 6-element li...
__device__ void fp_mul(fp_t &z, const fp_t &x, const fp_t &y)
Multiplies two Fp residues x and y, stores in z.
__device__ void fp_inv(fp_t &z, const fp_t &x)
Calculates the multiplicative inverse of x and stores in z.
__managed__ testval_t testval[TESTVALS]
__global__ void FpTestInv(testval_t *testval)
Test for multiplicative inverse mod p in Fp.