Changeset 4144


Ignore:
Timestamp:
Sep 9, 2014, 3:53:43 PM (4 years ago)
Author:
linmengl
Message:

add special testcases for long stream addition. works for now.

File:
1 edited

Legend:

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

    r4143 r4144  
    3030
    3131{% for fw in [128]%}
    32 void uadd_with_overflow_i{{ fw }}(bitblock{{fw}}_t a, bitblock{{fw}}_t b, bitblock{{fw}}_t *sum, short *obit);
     32void uadd_with_overflow_i{{ fw }}(bitblock{{fw}}_t a, bitblock{{fw}}_t b, bitblock{{fw}}_t *sum, unsigned short *obit);
    3333{% endfor %}
    3434}
     
    4040}
    4141
     42string to_string(const SIMD_type &a) {
     43  return Store2String(a,1);
     44}
     45
    4246int test_long_stream_addition(const SIMD_type &a, const SIMD_type &b)
    4347{
    4448    SIMD_type c, d, e, f;
    4549    short x, y;
     50    SIMD_type sum0, obit0, sum1, sum2, obit2;
     51    unsigned short obit1;
    4652
    4753    //test uadd.with.overflow.i128
    4854    c = mvmd<32>::fill(0);
    49     SIMD_type sum0, obit0, sum1, sum2, obit2;
    50     short obit1;
    5155    adc(a, b, c, obit0, sum0);
    5256    uadd_with_overflow_i128(a, b, &sum1, &obit1);
     
    6670      cout << "sum1 =   " << Store2String(sum1, 1) << endl;
    6771      cout << "obit0 =  " << Store2String(obit0, 1) << endl;
     72      cout << "obit1 =  " << obit1 << endl;
     73      return 1;
     74    }
     75
     76    //test a + not(a)
     77    uadd_with_overflow_i128(a, simd_not(a), &sum1, &obit1);
     78    if (to_string(sum1) != to_string(simd_not(simd<32>::constant<0>())) ||
     79        obit1 != 0)
     80    {
     81      cout << "a + not(a) error: " << endl;
     82      cout << "sum1 =   " << Store2String(sum1, 1) << endl;
     83      cout << "obit1 =  " << obit1 << endl;
     84      return 1;
     85    }
     86
     87    //test all ones + 1
     88    sum1 = simd_not(simd<32>::constant<0>());
     89    uadd_with_overflow_i128(sum1, mvmd<128>::fill(1), &sum1, &obit1);
     90    if (to_string(sum1) != to_string(simd<32>::constant<0>()) ||
     91        obit1 != 1) {
     92      cout << "all ones + 1 error: " << endl;
     93      cout << "sum1 =   " << to_string(sum1) << endl;
    6894      cout << "obit1 =  " << obit1 << endl;
    6995      return 1;
Note: See TracChangeset for help on using the changeset viewer.