swr: [rasterizer core/common/jitter] gl_double support
[mesa.git] / src / gallium / drivers / swr / rasterizer / jitter / scripts / gen_llvm_ir_macros.py
index 9c00f2264e0ce3ba32b2dd86e5f9a01a4025b7d2..70d35762bc5f92de71ab7d05442d9f3760d6310f 100644 (file)
@@ -84,6 +84,7 @@ inst_aliases = {
 }
 
 intrinsics = [
+        ["VGATHERPD", "x86_avx2_gather_d_pd_256", ["src", "pBase", "indices", "mask", "scale"]],
         ["VGATHERPS", "x86_avx2_gather_d_ps_256", ["src", "pBase", "indices", "mask", "scale"]],
         ["VGATHERDD", "x86_avx2_gather_d_d_256", ["src", "pBase", "indices", "mask", "scale"]],
         ["VSQRTPS", "x86_avx_sqrt_ps_256", ["a"]],
@@ -101,6 +102,7 @@ intrinsics = [
         ["VPSHUFB", "x86_avx2_pshuf_b", ["a", "b"]],
         ["VPERMD", "x86_avx2_permd", ["a", "idx"]],
         ["VPERMPS", "x86_avx2_permps", ["idx", "a"]],
+        ["VCVTPD2PS", "x86_avx_cvt_pd2_ps_256", ["a"]],
         ["VCVTPH2PS", "x86_vcvtph2ps_256", ["a"]],
         ["VCVTPS2PH", "x86_vcvtps2ph_256", ["a", "round"]],
         ["VHSUBPS", "x86_avx_hsub_ps_256", ["a", "b"]],
@@ -259,7 +261,11 @@ def generate_gen_cpp(functions, output_file):
 
     output_lines += [
         '#include \"builder.h\"',
-        ''
+        '',
+        'namespace SwrJit',
+        '{',
+        '    using namespace llvm;',
+        '',
     ]
 
     for func in functions:
@@ -277,14 +283,14 @@ def generate_gen_cpp(functions, output_file):
             first_arg = False
 
         output_lines += [
-            '//////////////////////////////////////////////////////////////////////////',
-            '%sBuilder::%s(%s)' % (func['return'], name, func['args_nodefs']),
-            '{',
-            '   return IRB()->%s(%s);' % (func['name'], func_args),
-            '}',
+            '    //////////////////////////////////////////////////////////////////////////',
+            '    %sBuilder::%s(%s)' % (func['return'], name, func['args_nodefs']),
+            '    {',
+            '       return IRB()->%s(%s);' % (func['name'], func_args),
+            '    }',
             '',
         ]
-
+    output_lines.append('}')
     output_file.write('\n'.join(output_lines) + '\n')
 
 """
@@ -326,7 +332,11 @@ def generate_x86_cpp(output_file):
 
     output_lines += [
         '#include \"builder.h\"',
-        ''
+        '',
+        'namespace SwrJit',
+        '{',
+        '    using namespace llvm;',
+        '',
     ]
 
     for inst in intrinsics:
@@ -344,10 +354,10 @@ def generate_x86_cpp(output_file):
             first = False
 
         output_lines += [
-            '//////////////////////////////////////////////////////////////////////////',
-            'Value *Builder::%s(%s)' % (inst[0], args),
-            '{',
-            '    Function *func = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::%s);' % inst[1],
+            '    //////////////////////////////////////////////////////////////////////////',
+            '    Value *Builder::%s(%s)' % (inst[0], args),
+            '    {',
+            '        Function *func = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::%s);' % inst[1],
         ]
         if inst[0] == "VPERMD":
             rev_args = ''
@@ -360,21 +370,22 @@ def generate_x86_cpp(output_file):
 
             output_lines += [
                 '#if (HAVE_LLVM == 0x306) && (LLVM_VERSION_PATCH == 0)',
-                '    return CALL(func, std::initializer_list<Value*>{%s});' % rev_args,
+                '        return CALL(func, std::initializer_list<Value*>{%s});' % rev_args,
                 '#else',
             ]
         output_lines += [
-            '    return CALL(func, std::initializer_list<Value*>{%s});' % pass_args,
+            '        return CALL(func, std::initializer_list<Value*>{%s});' % pass_args,
         ]
         if inst[0] == "VPERMD":
             output_lines += [
                 '#endif',
             ]
         output_lines += [
-            '}',
+            '    }',
             '',
         ]
 
+    output_lines.append('}')
     output_file.write('\n'.join(output_lines) + '\n')
 
 """