def test_basicvectorize_generic(self):
        module = Module.new(__name__)
        exe = CExecutor(module)

        tyslist = [
            (C.double, C.double),
            (C.float,  C.float),
            (C.int64,  C.int64),
            (C.int32,  C.int32),
        ]

        tynumslist = []
        for tys in tyslist:
            tynumslist.append(list(map(_llvm_ty_to_dtype, tys)))

        oneone_defs = [OneOne(*tys)(module) for tys in tyslist]

        ufunc = basic_vectorize_from_func(oneone_defs, tynumslist, exe.engine)
        # print(module)
        module.verify()

        asm = module.to_native_assembly()
        from llvm.workaround.avx_support import detect_avx_support
        if not detect_avx_support() and 'vmovsd' in asm:
            print('SKIP! LLVM incorrectly uses AVX on machine without AVX')
            return

        self.check(ufunc, np.double)
        self.check(ufunc, np.float32)
        self.check(ufunc, np.int64)
        self.check(ufunc, np.int32)
Beispiel #2
0
    def test_basicvectorize_generic(self):
        module = Module.new(__name__)
        exe = CExecutor(module)

        tyslist = [
            (C.double, C.double),
            (C.float, C.float),
            (C.int64, C.int64),
            (C.int32, C.int32),
        ]

        tynumslist = []
        for tys in tyslist:
            tynumslist.append(list(map(_llvm_ty_to_dtype, tys)))

        oneone_defs = [OneOne(*tys)(module) for tys in tyslist]

        ufunc = basic_vectorize_from_func(oneone_defs, tynumslist, exe.engine)
        # print(module)
        module.verify()

        asm = module.to_native_assembly()
        from llvm.workaround.avx_support import detect_avx_support
        if not detect_avx_support() and 'vmovsd' in asm:
            print('SKIP! LLVM incorrectly uses AVX on machine without AVX')
            return

        self.check(ufunc, np.double)
        self.check(ufunc, np.float32)
        self.check(ufunc, np.int64)
        self.check(ufunc, np.int32)
Beispiel #3
0
    def template(self, itype, otype):
        module = Module.new(__name__)
        exe = CExecutor(module)

        def_oneone = OneOne(itype, otype)
        oneone = def_oneone(module)

        tyslist = [list(map(_llvm_ty_to_dtype, [itype, otype]))]
        ufunc = basic_vectorize_from_func(oneone, tyslist, exe.engine)

        print(module)
        module.verify()
        asm = module.to_native_assembly()
        print(asm)

        from llvm.workaround.avx_support import detect_avx_support
        if not detect_avx_support() and 'vmovsd' in asm:
            print('SKIP! LLVM incorrectly uses AVX on machine without AVX')
            return

        self.check(ufunc, np.double)
Beispiel #4
0
    def template(self, itype, otype):
        module = Module.new(__name__)
        exe = CExecutor(module)

        def_oneone = OneOne(itype, otype)
        oneone = def_oneone(module)

        tyslist = [[_llvm_ty_to_dtype(itype), _llvm_ty_to_dtype(otype)]]
        ufunc = basic_vectorize_from_func(oneone, tyslist, exe.engine)

        print(module)
        module.verify()

        asm = module.to_native_assembly()
        print(asm)

        from llvm.workaround.avx_support import detect_avx_support
        if not detect_avx_support() and 'vmovsd' in asm:
            print('SKIP! LLVM incorrectly uses AVX on machine without AVX')
            return

        self.check(ufunc, np.double)