Changeset 3981 for trunk


Ignore:
Timestamp:
Aug 8, 2014, 11:34:47 PM (4 years ago)
Author:
linmengl
Message:

more testings done, on v64i2 add/sub/mul/eq/lt/gt/ult/ugt/vsll/vsrl/vsra

Location:
trunk/lib_ir/gen
Files:
3 edited

Legend:

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

    r3977 r3981  
    1212FuncOutput      = "ParabixGeneratedFuncs.h"
    1313
    14 FunctionList = ["add", "sub", "mult", "eq", "lt", "gt", "ult", "ugt"]
     14FunctionList = ["add", "sub", "mult", "eq", "lt", "gt", "ult", "ugt", "vsll", "vsrl", "vsra"]
    1515
    1616def C(name):
     
    1818
    1919def CXX(name):
     20    if name in ["vsll", "vsrl", "vsra"]:
     21        return "simd<2>::" + name[1:] + "i"
    2022    return "simd<2>::" + name
    2123
     
    2729    if name in ["lt", "gt"]:
    2830        return "icmp s" + name
     31    if name == "vsll":
     32        return "shl"
     33    if name in ["vsrl", "vsra"]:
     34        return name[-1:] + "shr"
    2935
    3036    return name
    3137
    32 FunctionNames = [{"c": C(name), "cxx": CXX(name), "op": OP(name)}
     38def FLAG(name):
     39    if name in ["vsll", "vsrl", "vsra"]:
     40        return "shifting"
     41    return ""
     42
     43FunctionNames = [{"c": C(name), "cxx": CXX(name), "op": OP(name), "flag": FLAG(name)}
    3344                    for name in FunctionList]
    3445
    3546#configuring Jinja2
    3647env = Environment(loader=FileSystemLoader(['.', 'gen/', '../../gen']),
    37                   trim_blocks=True)
     48                  trim_blocks=True,
     49                  lstrip_blocks=True)
    3850
    3951def fillTemplate(template, output, params):
     
    6173    genTestFile()
    6274    genLLFile()
    63     #genFuncFile()
     75    genFuncFile()
    6476
  • trunk/lib_ir/gen/impl_data.py

    r3977 r3981  
    3939    tmpAns = simd_or(simd_and(tmp, arg2), simd_and(simd_slli(curRegSize, 1, simd_and(tmp, arg2)), simd_or(tmp, arg2)))
    4040    return simd_ifh(1, simd_himask(fw), tmpAns, simd_srli(curRegSize, 1, tmpAns))''',
     41
     42"vsll_2": r'''
     43    tmp1 = b.SHL<1>(arg2)
     44    tmp = simd_or(simd_and(b.SHL<1>(arg1), tmp1), simd_and(arg1, simd_not(tmp1)))
     45    return simd_ifh(1, simd_himask(fw), tmp, simd_and(arg1, simd_not(arg2)))''',
     46
     47"vsrl_2": r'''
     48    tmp = simd_or(simd_and(arg1, simd_not(arg2)), simd_and(b.SRL<1>(arg1), arg2))
     49    return simd_ifh(1, simd_himask(fw), simd_and(arg1, simd_not(b.SHL<1>(arg2))), tmp)''',
     50
     51"vsra_2": r'''
     52    return simd_ifh(1, simd_himask(fw), arg1, simd_or(simd_and(arg1, simd_not(arg2)), simd_and(arg2, b.SRL<1>(arg1))))''',
    4153}
    4254
  • trunk/lib_ir/gen/test_llc.pytemplate.cpp

    r3977 r3981  
    2828    fill_random(a, b);
    2929
    30 {% for name in FunctionNames %}
     30  {% for name in FunctionNames %}
     31    {% if name.flag == "" %}
    3132    c = {{ name.c }}(a, b);
    3233    d = {{ name.cxx }}(a, b);
     
    3637    }
    3738
    38 {% endfor %}
     39    {% endif %}
     40  {% endfor %}
     41
     42    //Shifting tests need special treatment
     43  {% for name in FunctionNames %}
     44    {% if name.flag == "shifting" %}
     45      {% for x in [0, 1] %}
     46    b = mvmd<2>::fill({{ x }});
     47    c = {{ name.cxx }}<{{ x }}>(a);
     48    d = {{ name.c }}(a, b);
     49    if (Store2String(c,1) != Store2String(d,1)) {
     50      cout << "{{ name.c }} faild." << endl;
     51      return 1;
     52    }
     53
     54      {% endfor %}
     55    {% endif %}
     56  {% endfor %}
    3957  }
    4058
Note: See TracChangeset for help on using the changeset viewer.