Ignore:
Timestamp:
Sep 8, 2014, 6:22:08 PM (4 years ago)
Author:
linmengl
Message:

add some more lib files; add tests for long stream addition.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib_ir/gen/test_llc.pytemplate.cpp

    r4076 r4138  
    66
    77#include "utility.h"
     8#include <ctime>
    89#include <iostream>
    910#include <cstdlib>
     
    2526SIMD_type add_128(SIMD_type a, SIMD_type b);
    2627SIMD_type sll_128(SIMD_type a, SIMD_type b);
     28
     29int sign_mask_64(SIMD_type a);
     30
     31{% for fw in [128]%}
     32void uadd_with_overflow_i{{ fw }}(bitblock{{fw}}_t a, bitblock{{fw}}_t b, bitblock{{fw}}_t *sum, short *obit);
     33{% endfor %}
    2734}
    2835
    2936void fill_random(SIMD_type &a, SIMD_type &b)
    3037{
    31   a = mvmd<32>::fill((int)rand() % 10000);
    32   b = mvmd<32>::fill((int)rand() % 10000);
     38  a = mvmd<8>::fill((int)rand() % (1 << 8));
     39  b = mvmd<8>::fill((int)rand() % (1 << 8));
    3340}
    3441
    3542int main() {
    36   SIMD_type a, b, c, d, f;
     43  SIMD_type a, b, c, d, e, f;
    3744  short x, y;
     45  srand(time(0));
    3846
    3947  for (unsigned i = 0; i < 50; ++i) {
     
    110118      return 1;
    111119    }
     120
     121    //i128 long stream addition
     122    c = mvmd<32>::fill(0);
     123    SIMD_type sum0, obit0, sum1;
     124    short obit1;
     125    adc(a, b, c, obit0, sum0);
     126    uadd_with_overflow_i128(a, b, &sum1, &obit1);
     127    x = 0;
     128    if (Store2String(sum0,1) != Store2String(sum1,1)) {
     129      cout << "uadd_with_overflow_i128, sum error" << endl;
     130      x = 1;
     131    }
     132    if (Store2String(mvmd<128>::fill(obit1),1) != Store2String(obit0,1)) {
     133      cout << "uadd_with_overflow_i128 failed, obit error" << endl;
     134      x = 1;
     135    }
     136    if (x) {
     137      cout << "a =      " << Store2String(a, 1) << endl;
     138      cout << "b =      " << Store2String(b, 1) << endl;
     139      cout << "sum0 =   " << Store2String(sum0, 1) << endl;
     140      cout << "sum1 =   " << Store2String(sum1, 1) << endl;
     141      cout << "obit0 =  " << Store2String(obit0, 1) << endl;
     142      cout << "obit1 =  " << obit1 << endl;
     143      return 1;
     144    }
     145
    112146  }
    113147
Note: See TracChangeset for help on using the changeset viewer.