Changeset 4278 for trunk


Ignore:
Timestamp:
Oct 31, 2014, 3:42:32 PM (4 years ago)
Author:
linmengl
Message:

add tests for i128 shift left

Location:
trunk/lib_ir/gen
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib_ir/gen/gen.py

    r4005 r4278  
    1616FunctionListI4 = ["add", "sub", "mult", "eq", "lt", "gt", "ult", "ugt", "vsll", "vsrl", "vsra"]
    1717FunctionListI8 = ["add", "sub", "mult", "eq", "lt", "gt", "ult", "ugt", "vsll", "vsrl", "vsra"]
     18
     19LongShiftAmount128 = [1,3,5,63,64,65,126,127]
     20LongShiftAmount256 = [1,3,5,63,64,65,127,128,129,191,192,193,254,255]
    1821
    1922FW = 2
     
    7679                             FunctionNamesI4 = FunctionNamesI4,
    7780                             FunctionNamesI8 = FunctionNamesI8,
     81                             LongShiftAmount128 = LongShiftAmount128,
     82                             LongShiftAmount256 = LongShiftAmount256,
    7883                             ))
    7984
     
    8489                             FunctionNamesI8 = FunctionNamesI8,
    8590                             FunctionNamesI1 = FunctionNamesI1,
     91                             LongShiftAmount128 = LongShiftAmount128,
     92                             LongShiftAmount256 = LongShiftAmount256,
    8693                             ))
    8794
  • trunk/lib_ir/gen/llc_func.pytemplate.ll

    r4236 r4278  
    167167}
    168168
     169{% for sh in LongShiftAmount128 %}
     170define <4 x i32> @long_shift_left_{{sh}}(<4 x i32> %a) {
     171entry:
     172  %aa = bitcast <4 x i32> %a to i128
     173  %c = shl i128 %aa, {{sh}}
     174  %cc = bitcast i128 %c to <4 x i32>
     175  ret <4 x i32> %cc
     176}
     177{% endfor %}
     178 
     179 
  • trunk/lib_ir/gen/test_llc.pytemplate.cpp

    r4236 r4278  
    3232{% for fw in [128]%}
    3333void uadd_with_overflow_i{{ fw }}(bitblock{{fw}}_t a, bitblock{{fw}}_t b, bitblock{{fw}}_t *sum, unsigned short *obit);
     34{% endfor %}
     35
     36{% for sh in LongShiftAmount128 %}
     37SIMD_type long_shift_left_{{sh}}(SIMD_type a);
    3438{% endfor %}
    3539}
     
    135139}
    136140
     141int test_long_shift(const SIMD_type &a)
     142{
     143  SIMD_type b, c, d;
     144  {% for sh in LongShiftAmount128 %}
     145  b = simd<128>::slli<{{sh}}>(a);
     146  c = long_shift_left_{{sh}}(a);
     147  if (to_string(b) != to_string(c)) {
     148    cout << "long_shift_left with sh = {{sh}} failed." << endl;
     149    return 1;
     150  }
     151
     152  {% endfor %}
     153
     154  return 0;
     155}
     156
    137157int main() {
    138158  SIMD_type a, b, c, d, e, f;
     
    216236    if (test_long_stream_addition(a, b))
    217237      return 1;
     238
     239    if (test_long_shift(a))
     240      return 1;
    218241  }
    219242
Note: See TracChangeset for help on using the changeset viewer.