Ignore:
Timestamp:
Aug 12, 2014, 1:54:54 PM (5 years ago)
Author:
linmengl
Message:

extend template system for i4 and i8.

File:
1 edited

Legend:

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

    r3981 r3996  
    1313
    1414FunctionList = ["add", "sub", "mult", "eq", "lt", "gt", "ult", "ugt", "vsll", "vsrl", "vsra"]
     15FunctionListI4 = ["add", "sub"]
     16FunctionListI8 = ["add", "sub", "mult", "eq", "lt", "gt", "ult", "ugt", "vsll", "vsrl", "vsra"]
     17
     18FW = 2
    1519
    1620def C(name):
    17     return name + "_2"
     21    return "{name}_{fw}".format(name=name, fw=FW)
    1822
    1923def CXX(name):
    2024    if name in ["vsll", "vsrl", "vsra"]:
    21         return "simd<2>::" + name[1:] + "i"
    22     return "simd<2>::" + name
     25        return "simd<{fw}>::{name}i".format(fw=FW, name=name[1:])
     26    return "simd<{fw}>::{name}".format(fw=FW, name=name)
    2327
    2428def OP(name):
     
    4145    return ""
    4246
    43 FunctionNames = [{"c": C(name), "cxx": CXX(name), "op": OP(name), "flag": FLAG(name)}
    44                     for name in FunctionList]
     47#Get all v64i2 names
     48FunctionNames = [{"c": C(name), "cxx": CXX(name), "op": OP(name),
     49                  "flag": FLAG(name), "fw": FW} for name in FunctionList]
     50FW = 4
     51FunctionNamesI4 = [{"c": C(name), "cxx": CXX(name), "op": OP(name),
     52                    "flag": FLAG(name), "fw": FW} for name in FunctionListI4]
     53FW = 8
     54FunctionNamesI8 = [{"c": C(name), "cxx": CXX(name), "op": OP(name),
     55                    "flag": FLAG(name), "fw": FW} for name in FunctionListI8]
    4556
    4657#configuring Jinja2
     
    5768    fillTemplate(template=TestTemplate, output=TestOutput,
    5869                 params=dict(HeaderComment = "AUTO GENERATED FILE",
    59                              FunctionNames = FunctionNames))
     70                             FunctionNames = FunctionNames,
     71                             FunctionNamesI4 = FunctionNamesI4,
     72                             FunctionNamesI8 = FunctionNamesI8,
     73                             ))
    6074
    6175def genLLFile():
    6276    fillTemplate(template=LLTemplate, output=LLOutput,
    63                  params=dict(FunctionNames = FunctionNames))
     77                 params=dict(FunctionNames = FunctionNames,
     78                             FunctionNamesI4 = FunctionNamesI4,
     79                             FunctionNamesI8 = FunctionNamesI8,
     80                             ))
    6481
    6582def genFuncFile():
     
    6885                             FunctionNames = FunctionNames,
    6986                             Implement = impl_data.getImplements()))
     87    # NEED to copy manually.
    7088    # mv ParabixGeneratedFuncs.h ~/llvm_suit/llvm_git/lib/Target/X86/
    7189
     
    7391    genTestFile()
    7492    genLLFile()
    75     genFuncFile()
     93    #genFuncFile()
    7694
Note: See TracChangeset for help on using the changeset viewer.