當前位置: 首頁>>代碼示例>>C++>>正文


C++ CALC函數代碼示例

本文整理匯總了C++中CALC函數的典型用法代碼示例。如果您正苦於以下問題:C++ CALC函數的具體用法?C++ CALC怎麽用?C++ CALC使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CALC函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: TEST

void
TEST (void)
{
  int i, sign = 1;
  UNION_TYPE (AVX512F_LEN, i_q) src1, src2;
  MASK_TYPE res_ref, res1, res2;
  MASK_TYPE mask = MASK_VALUE;
  res1 = 0;
  res2 = 0;

  for (i = 0; i < SIZE; i++)
    {
      src1.a[i] = i * i * sign;
      src2.a[i] = i + 20;
      sign = -sign;
    }

  res1 = INTRINSIC (_testn_epi64_mask) (src1.x, src2.x);
  res2 = INTRINSIC (_mask_testn_epi64_mask) (mask, src1.x, src2.x);

  CALC (&res_ref, src1.a, src2.a);

  if (res1 != res_ref)
    abort ();

  res_ref &= mask;

  if (res2 != res_ref)
    abort ();
}
開發者ID:0day-ci,項目名稱:gcc,代碼行數:30,代碼來源:avx512f-vptestnmq-2.c

示例2: TEST

void
TEST (void)
{
  UNION_TYPE (AVX512F_LEN, i_w) s1, s2, res1, res2, res3;
  short res_ref[SIZE];
  MASK_TYPE mask = MASK_VALUE;
  int i;
  int fail = 0;

  for (i = 0; i < SIZE; i++)
    {
      s1.a[i] = i * 17 + i;
      s2.a[i] = i * -17 + i * 2;
      res2.a[i] = DEFAULT_VALUE;
    }

  res1.x = INTRINSIC (_maddubs_epi16) (s1.x, s2.x);
  res2.x = INTRINSIC (_mask_maddubs_epi16) (res2.x, mask, s1.x, s2.x);
  res3.x = INTRINSIC (_maskz_maddubs_epi16) (mask, s1.x, s2.x);

  CALC(s1.a, s2.a, res_ref);

  if (UNION_CHECK (AVX512F_LEN, i_w) (res1, res_ref))
    abort ();

  MASK_MERGE (i_w) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_w) (res2, res_ref))
    abort ();

  MASK_ZERO (i_w) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_w) (res3, res_ref))
    abort ();
}
開發者ID:Automatic,項目名稱:firmware-gcc,代碼行數:33,代碼來源:avx512bw-vpmaddubsw-2.c

示例3: TEST

void
TEST (void)
{
  UNION_TYPE (AVX512F_LEN, i_b) s1, s2, res1, res2 ,res3;
  MASK_TYPE mask = MASK_VALUE;
  char res_ref[SIZE];
  int i;

  for (i = 0; i < SIZE; i++)
    {
      s1.a[i] = i + 15;
      s2.a[i] = i + 14;
      res2.a[i] = DEFAULT_VALUE;
    }

  res1.x = INTRINSIC (_avg_epu8) (s1.x, s2.x);
  res2.x = INTRINSIC (_mask_avg_epu8) (res2.x, mask, s1.x, s2.x);
  res3.x = INTRINSIC (_maskz_avg_epu8) (mask, s1.x, s2.x);

  CALC (s1.a, s2.a, res_ref);

  if (UNION_CHECK (AVX512F_LEN, i_b) (res1, res_ref))
    abort ();

  MASK_MERGE (i_b) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_b) (res2, res_ref))
    abort ();

  MASK_ZERO (i_b) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_b) (res3, res_ref))
    abort ();
}
開發者ID:0day-ci,項目名稱:gcc,代碼行數:32,代碼來源:avx512bw-vpavgb-2.c

示例4: TEST

static void
TEST (void)
{
  UNION_TYPE (AVX512F_LEN, i_d) src1, src2, res1, res2, res3;
  MASK_TYPE mask = MASK_VALUE;
  int dst_ref[SIZE];
  int i;

  for (i = 0; i < SIZE; i++)
    {
      src1.a[i] = i + 50;
      src2.a[i] = i + 100;
    }

  for (i = 0; i < SIZE; i++)
    res2.a[i] = DEFAULT_VALUE;

  res1.x = INTRINSIC (_mullo_epi32) (src1.x, src2.x);
  res2.x = INTRINSIC (_mask_mullo_epi32) (res2.x, mask, src1.x, src2.x);
  res3.x = INTRINSIC (_maskz_mullo_epi32) (mask, src1.x, src2.x);

  CALC (src1.a, src2.a, dst_ref);

  if (UNION_CHECK (AVX512F_LEN, i_d) (res1, dst_ref))
    abort ();

  MASK_MERGE (i_d) (dst_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_d) (res2, dst_ref))
    abort ();

  MASK_ZERO (i_d) (dst_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_d) (res3, dst_ref))
    abort ();

}
開發者ID:ds2dev,項目名稱:gcc,代碼行數:35,代碼來源:avx512f-vpmulld-2.c

示例5: TEST

void static
TEST (void)
{
  int i, sign;
  UNION_TYPE (AVX512F_LEN, i_d) src1, src2, res1, res2, res3;
  MASK_TYPE mask = MASK_VALUE;
  int res_ref[SIZE];

  for (i = 0; i < SIZE; i++)
    {
      src1.a[i] =  i * sign;
      src2.a[i] = (i + 2000) * sign;
      sign = -sign;
      res2.a[i] = DEFAULT_VALUE;
    }

  res1.x = INTRINSIC (_min_epi32) (src1.x, src2.x);
  res2.x = INTRINSIC (_mask_min_epi32) (res2.x, mask, src1.x, src2.x);
  res3.x = INTRINSIC (_maskz_min_epi32) (mask, src1.x, src2.x);

  CALC (src1.a, src2.a, res_ref);

  if (UNION_CHECK (AVX512F_LEN, i_d) (res1, res_ref))
    abort ();

  MASK_MERGE (i_d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_d) (res2, res_ref))
    abort ();

  MASK_ZERO (i_d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_d) (res3, res_ref))
    abort ();
}
開發者ID:ds2dev,項目名稱:gcc,代碼行數:33,代碼來源:avx512f-vpminsd-2.c

示例6: TEST

void
TEST (void)
{
  int i;
  UNION_TYPE (AVX512F_LEN, i_q) src1, src2;
  MASK_TYPE res1, res_ref, res2;
  res1 = 0;

  for (i = 0; i < SIZE / 2; i++)
    {
      src1.a[i * 2] = i;
      src1.a[i * 2 + 1] = i * i;
      src2.a[i * 2] = 2 * i;
      src2.a[i * 2 + 1] = i * i;
    }

  res1 = INTRINSIC (_cmplt_epi64_mask) (src1.x, src2.x);
  res2 = INTRINSIC (_mask_cmplt_epi64_mask) (MASK_VALUE, src1.x, src2.x);

  CALC (&res_ref, src1.a, src2.a);

  if (res1 != res_ref)
    abort ();

  res_ref &= MASK_VALUE;

  if (res2 != res_ref)
    abort ();
}
開發者ID:0day-ci,項目名稱:gcc,代碼行數:29,代碼來源:avx512f-vpcmpltq-2.c

示例7: TEST

void
TEST (void)
{
  UNION_TYPE (AVX512F_LEN, d) s1, s2, res1, res2, res3;
  MASK_TYPE mask = MASK_VALUE;
  double res_ref[SIZE];
  int i, sign = 1;

  for (i = 0; i < SIZE; i++)
    {
      s1.a[i] = 234.567 * i * sign;
      s2.a[i] = 100 * (i + 1);
      res2.a[i] = DEFAULT_VALUE;
      sign = -sign;
    }

  res1.x = INTRINSIC (_range_pd) (s1.x, s2.x, IMM);
  res2.x = INTRINSIC (_mask_range_pd) (res2.x, mask, s1.x, s2.x, IMM);
  res3.x = INTRINSIC (_maskz_range_pd) (mask, s1.x, s2.x, IMM);

  CALC (s1.a, s2.a, res_ref);

  if (UNION_CHECK (AVX512F_LEN, d) (res1, res_ref))
    abort ();

  MASK_MERGE (d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, d) (res2, res_ref))
    abort ();

  MASK_ZERO (d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, d) (res3, res_ref))
    abort ();
}
開發者ID:AlexMioMio,項目名稱:gcc,代碼行數:33,代碼來源:avx512dq-vrangepd-2.c

示例8: TEST

void static
TEST (void)
{
  UNION_TYPE (AVX512F_LEN, d) s, res1, res2, res3;
  MASK_TYPE mask = MASK_VALUE;
  double res_ref[SIZE];
  int i;

  for (i = 0; i < SIZE; i++)
    {
      s.a[i] = i * 123.2 + 32.6;
      res2.a[i] = DEFAULT_VALUE;
    }

  res1.x = INTRINSIC (_movedup_pd) (s.x);
  res2.x = INTRINSIC (_mask_movedup_pd) (res2.x, mask, s.x);
  res3.x = INTRINSIC (_maskz_movedup_pd) (mask, s.x);

  CALC (s.a, res_ref);

  if (UNION_CHECK (AVX512F_LEN, d) (res1, res_ref))
    abort ();

  MASK_MERGE (d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, d) (res2, res_ref))
    abort ();

  MASK_ZERO (d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, d) (res3, res_ref))
    abort ();
}
開發者ID:crizeridsdf,項目名稱:gcc,代碼行數:31,代碼來源:avx512f-vmovddup-2.c

示例9: TEST

void static
TEST (void)
{
  int i, sign;
  UNION_TYPE (AVX512F_LEN, d) res1, res2, res3, src1, src2;
  MASK_TYPE mask = MASK_VALUE;
  double res_ref[SIZE];

  sign = -1;
  for (i = 0; i < SIZE; i++)
    {
      src1.a[i] = 1.5 + 34.67 * i * sign;
      src2.a[i] = -22.17 * i * sign;
      sign = sign * -1;
    }
  for (i = 0; i < SIZE; i++)
    res2.a[i] = DEFAULT_VALUE;

  res1.x = INTRINSIC (_max_pd) (src1.x, src2.x);
  res2.x = INTRINSIC (_mask_max_pd) (res2.x, mask, src1.x, src2.x);
  res3.x = INTRINSIC (_maskz_max_pd) (mask, src1.x, src2.x);

  CALC (res_ref, src1.a, src2.a);

  if (UNION_CHECK (AVX512F_LEN, d) (res1, res_ref))
    abort ();

  MASK_MERGE (d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, d) (res2, res_ref))
    abort ();

  MASK_ZERO (d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, d) (res3, res_ref))
    abort ();
}
開發者ID:crizeridsdf,項目名稱:gcc,代碼行數:35,代碼來源:avx512f-vmaxpd-2.c

示例10: TEST

void
TEST (void)
{
  UNION_TYPE (AVX512F_LEN, d) s1, s2, res1, res2, res3;
  MASK_TYPE mask = MASK_VALUE;
  double res_ref[SIZE];
  int i;

  for (i = 0; i < SIZE; i++)
    {
      s1.a[i] = 13. * i;
      s2.a[i] = 17. * i;
      res2.a[i] = DEFAULT_VALUE;
    }

  res1.x = INTRINSIC (_and_pd) (s1.x, s2.x);
  res2.x = INTRINSIC (_mask_and_pd) (res2.x, mask, s1.x, s2.x);
  res3.x = INTRINSIC (_maskz_and_pd) (mask, s1.x, s2.x);

  CALC (s1.a, s2.a, res_ref);

  if (UNION_CHECK (AVX512F_LEN, d) (res1, res_ref))
    abort ();

  MASK_MERGE (d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, d) (res2, res_ref))
    abort ();

  MASK_ZERO (d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, d) (res3, res_ref))
    abort ();
}
開發者ID:AlexMioMio,項目名稱:gcc,代碼行數:32,代碼來源:avx512dq-vandpd-2.c

示例11: TEST

void
TEST (void)
{
  int i;
  UNION_TYPE (AVX512F_LEN, i_w) res1, res2, res3, src1, src2;
  MASK_TYPE mask = MASK_VALUE;
  unsigned short res_ref[SIZE];

  for (i = 0; i < SIZE; i++)
    {
      src1.a[i] = 2 + 7 * i % 291;
      src2.a[i] = 3 + 11 * (i % 377) * i;
    }
  for (i = 0; i < SIZE; i++)
    res2.a[i] = DEFAULT_VALUE;

  res1.x = INTRINSIC (_subs_epu16) (src1.x, src2.x);
  res2.x = INTRINSIC (_mask_subs_epu16) (res2.x, mask, src1.x, src2.x);
  res3.x = INTRINSIC (_maskz_subs_epu16) (mask, src1.x, src2.x);

  CALC (res_ref, src1.a, src2.a);

  if (UNION_CHECK (AVX512F_LEN, i_w) (res1, res_ref))
    abort ();

  MASK_MERGE (i_w) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_w) (res2, res_ref))
    abort ();

  MASK_ZERO (i_w) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_w) (res3, res_ref))
    abort ();
}
開發者ID:0day-ci,項目名稱:gcc,代碼行數:33,代碼來源:avx512bw-vpsubusw-2.c

示例12: TEST

void
TEST (void)
{
  UNION_TYPE (AVX512F_LEN, d) s;
  UNION_TYPE (AVX512F_LEN, i_q) res1, res2, res3;
  MASK_TYPE mask = MASK_VALUE;
  unsigned long long res_ref[SIZE];
  int i;

  for (i = 0; i < SIZE; i++)
    {
      s.a[i] = 123.456 * (i + 2000);
      res2.a[i] = DEFAULT_VALUE;
    }

  res1.x = INTRINSIC (_cvttpd_epu64) (s.x);
  res2.x = INTRINSIC (_mask_cvttpd_epu64) (res2.x, mask, s.x);
  res3.x = INTRINSIC (_maskz_cvttpd_epu64) (mask, s.x);

  CALC (s.a, res_ref);

  if (UNION_CHECK (AVX512F_LEN, i_q) (res1, res_ref))
    abort ();

  MASK_MERGE (i_q) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_q) (res2, res_ref))
    abort ();

  MASK_ZERO (i_q) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_q) (res3, res_ref))
    abort ();
}
開發者ID:0day-ci,項目名稱:gcc,代碼行數:32,代碼來源:avx512dq-vcvttpd2uqq-2.c

示例13: TEST

static void
TEST (void)
{
  int ck[SIZE];
  int i;
  UNION_TYPE (AVX512F_LEN, i_d) s, d, dm, dz;
  MASK_TYPE mask = MASK_VALUE;

  for (i = 0; i < SIZE; i++)
    {
      s.a[i] = i * 7 + (i << 15) + 356;
      d.a[i] = DEFAULT_VALUE;
      dm.a[i] = DEFAULT_VALUE;
      dz.a[i] = DEFAULT_VALUE;
    }

  CALC (s.a, ck);

  d.x = INTRINSIC (_abs_epi32) (s.x);
  dz.x = INTRINSIC (_maskz_abs_epi32) (mask, s.x);
  dm.x = INTRINSIC (_mask_abs_epi32) (dm.x, mask, s.x);

  if (UNION_CHECK (AVX512F_LEN, i_d) (d, ck))
    abort ();

  MASK_MERGE (i_d) (ck, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_d) (dm, ck))
    abort ();

  MASK_ZERO (i_d) (ck, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_d) (dz, ck))
    abort ();
}
開發者ID:crizeridsdf,項目名稱:gcc,代碼行數:33,代碼來源:avx512f-vpabsd-2.c

示例14: TEST

void
TEST (void)
{
  UNION_TYPE (AVX512F_LEN, i_d) res1, res2, res3, src, src0;
  MASK_TYPE mask = MASK_VALUE;
  TYPE res_ref[SIZE];
  src.x = INTRINSIC (_set1_epi8) (0x3D);
  int i;

  for (i = 0; i < SIZE; i++)
  {
    res_ref[i] = CALC (src.a[i]);
    src0.a[i] = DEFAULT_VALUE;
  }

  res1.x = INTRINSIC (_popcnt_epi32)       (src.x);
  res2.x = INTRINSIC (_mask_popcnt_epi32)  (src.x, mask, src0.x);
  res3.x = INTRINSIC (_maskz_popcnt_epi32) (mask, src.x);

  if (UNION_CHECK (AVX512F_LEN, i_d) (res1, res_ref))
    abort ();

  MASK_MERGE (i_d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_d) (res2, res_ref))
    abort ();

  MASK_ZERO (i_d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_d) (res3, res_ref))
    abort ();
}
開發者ID:MaxKellermann,項目名稱:gcc,代碼行數:30,代碼來源:avx512vpopcntdq-vpopcntd-1.c

示例15: TEST

void
TEST (void)
{
  int i, sign;
  UNION_TYPE (AVX512F_LEN, i_d) res1, res2, res3;
  UNION_TYPE (256, i_d) src;
  MASK_TYPE mask = SIZE | 123;
  int res_ref[SIZE];

  sign = -1;
  for (i = 0; i < 8; i++)
    {
      src.a[i] = 34 * i * sign;
      sign = sign * -1;
    }
  for (i = 0; i < SIZE; i++)
    res2.a[i] = DEFAULT_VALUE;

  res1.x = INTRINSIC (_broadcast_i32x8) (src.x);
  res2.x = INTRINSIC (_mask_broadcast_i32x8) (res2.x, mask, src.x);
  res3.x = INTRINSIC (_maskz_broadcast_i32x8) (mask, src.x);

  CALC (res_ref, src.a);

  if (UNION_CHECK (AVX512F_LEN, i_d) (res1, res_ref))
    abort ();

  MASK_MERGE (i_d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_d) (res2, res_ref))
    abort ();

  MASK_ZERO (i_d) (res_ref, mask, SIZE);
  if (UNION_CHECK (AVX512F_LEN, i_d) (res3, res_ref))
    abort ();
}
開發者ID:AlexMioMio,項目名稱:gcc,代碼行數:35,代碼來源:avx512dq-vbroadcasti32x8-2.c


注:本文中的CALC函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。