Beispiel #1
0
static void get4x4var_sse2(const uint8_t *src, int src_stride,
                           const uint8_t *ref, int ref_stride,
                           unsigned int *sse, int *sum) {
  const __m128i zero = _mm_setzero_si128();
  const __m128i src0 = _mm_unpacklo_epi8(READ64(src, src_stride, 0), zero);
  const __m128i src1 = _mm_unpacklo_epi8(READ64(src, src_stride, 2), zero);
  const __m128i ref0 = _mm_unpacklo_epi8(READ64(ref, ref_stride, 0), zero);
  const __m128i ref1 = _mm_unpacklo_epi8(READ64(ref, ref_stride, 2), zero);
  const __m128i diff0 = _mm_sub_epi16(src0, ref0);
  const __m128i diff1 = _mm_sub_epi16(src1, ref1);

  // sum
  __m128i vsum = _mm_add_epi16(diff0, diff1);
  vsum = _mm_add_epi16(vsum, _mm_srli_si128(vsum, 8));
  vsum = _mm_add_epi16(vsum, _mm_srli_si128(vsum, 4));
  vsum = _mm_add_epi16(vsum, _mm_srli_si128(vsum, 2));
  *sum = (int16_t)_mm_extract_epi16(vsum, 0);

  // sse
  vsum =
      _mm_add_epi32(_mm_madd_epi16(diff0, diff0), _mm_madd_epi16(diff1, diff1));
  vsum = _mm_add_epi32(vsum, _mm_srli_si128(vsum, 8));
  vsum = _mm_add_epi32(vsum, _mm_srli_si128(vsum, 4));
  *sse = _mm_cvtsi128_si32(vsum);
}
/**
 * Fast scan test. This test is meant to find gross errors caused by read/write
 * level failing on a single rank or dimm. The idea is to scan through all of
 * memory in large steps. The large steps hit each rank multiple times, but not
 * every byte. If the whole rank has errors, his should find it quickly. This test
 * is suitable for an alive test during early boot.
 *
 * @param area   Starting physical address
 * @param max_address
 *               Ending physical address, exclusive
 * @param bursts Burst to run
 *
 * @return Number of errors
 */
int __bdk_dram_test_fast_scan(uint64_t area, uint64_t max_address, int bursts)
{
    int failures = 0;
    const uint64_t step = 0x10008; /* The 8 is so we walk through cache lines too */
    const uint64_t pattern1 = 0xaaaaaaaaaaaaaaaa;
    const uint64_t pattern2 = 0x5555555555555555;

    /* Walk through the region incrementing our offset by STEP */
    uint64_t a = area;
    while (a + 16 <= max_address)
    {
        WRITE64(a, pattern1);
        WRITE64(a+8, pattern2);
        __bdk_dram_flush_to_mem_range(a, a + 16);
        a += step;
    }

    /* Read back, checking the writes */
    a = area;
    while (a + 16 <= max_address)
    {
        /* Prefetch 3 ahead for better performance */
        uint64_t pre = a + step * 2;
        if (pre + 16 < max_address)
            BDK_PREFETCH(pre, 0);
        /* Check pattern 1 */
        uint64_t data1 = READ64(a);
        if (bdk_unlikely(data1 != pattern1))
        {
            failures++;
            __bdk_dram_report_error(a, data1, pattern1, 0, -1);
        }
        /* Check pattern 2 */
        uint64_t data2 = READ64(a+8);
        if (bdk_unlikely(data2 != pattern2))
        {
            failures++;
            __bdk_dram_report_error(a+8, data2, pattern2, 0, -1);
        }
        a += step;
    }

    return failures;
}
Beispiel #3
0
char *
mono_interp_dis_mintop(const guint16 *base, const guint16 *ip)
{
	GString *str = g_string_new ("");
	guint32 token;
	int target;

	g_string_append_printf (str, "IL_%04x: %-10s", ip - base, mono_interp_opname [*ip]);
	switch (mono_interp_opargtype [*ip]) {
	case MintOpNoArgs:
		break;
	case MintOpUShortInt:
		g_string_append_printf (str, " %u", * (guint16 *)(ip + 1));
		break;
	case MintOpTwoShorts:
		g_string_append_printf (str, " %u,%u", * (guint16 *)(ip + 1), * (guint16 *)(ip + 2));
		break;
	case MintOpShortAndInt:
		g_string_append_printf (str, " %u,%u", * (guint16 *)(ip + 1), (guint32)READ32(ip + 2));
		break;
	case MintOpShortInt:
		g_string_append_printf (str, " %d", * (short *)(ip + 1));
		break;
	case MintOpClassToken:
	case MintOpMethodToken:
	case MintOpFieldToken:
		token = * (guint16 *)(ip + 1);
		g_string_append_printf (str, " %u", token);
		break;
	case MintOpInt:
		g_string_append_printf (str, " %d", (gint32)READ32 (ip + 1));
		break;
	case MintOpLongInt:
		g_string_append_printf (str, " %lld", (gint64)READ64 (ip + 1));
		break;
	case MintOpFloat: {
		gint32 tmp = READ32 (ip + 1);
		g_string_append_printf (str, " %g", * (float *)&tmp);
		break;
	}
	case MintOpDouble: {
		gint64 tmp = READ64 (ip + 1);
		g_string_append_printf (str, " %g", * (double *)&tmp);
		break;
	}
	case MintOpShortBranch:
		target = ip + * (short *)(ip + 1) - base;
		g_string_append_printf (str, " IL_%04x", target);
		break;
	case MintOpBranch:
		target = ip + (gint32)READ32 (ip + 1) - base;
		g_string_append_printf (str, " IL_%04x", target);
		break;
	case MintOpSwitch: {
		const guint16 *p = ip + 1;
		int sval = (gint32)READ32 (p);
		int i;
		p += 2;
		g_string_append_printf (str, "(");
		for (i = 0; i < sval; ++i) {
			int offset;
			if (i > 0)
				g_string_append_printf (str, ", ");
			offset = (gint32)READ32 (p);
			g_string_append_printf (str, "IL_%04x", p + offset - base);
			p += 2;
		}
		g_string_append_printf (str, ")");
		break;
	}
	default:
		g_string_append_printf (str, "unknown arg type\n");
	}

	return g_string_free (str, FALSE);
}