Hello community,

here is the log from the commit of package python-llvmlite for openSUSE:Factory 
checked in at 2018-05-28 08:07:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-llvmlite (Old)
 and      /work/SRC/openSUSE:Factory/.python-llvmlite.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-llvmlite"

Mon May 28 08:07:57 2018 rev:5 rq:610235 version:0.23.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-llvmlite/python-llvmlite.changes  
2018-04-24 15:33:58.744377715 +0200
+++ /work/SRC/openSUSE:Factory/.python-llvmlite.new/python-llvmlite.changes     
2018-05-28 08:08:02.445672881 +0200
@@ -1,0 +2,12 @@
+Thu May 17 10:56:57 UTC 2018 - [email protected]
+
+- Update to 0.23.0:
+  * PR #343: Fix undefined behavior bug due to Twine usage in LLVM
+  * PR #340: This moves llvmlite to use LLVM 6.0.0 as its backend.
+  * PR #339: Add cttz & ctlz
+  * PR #338: Add 3 Bit Manipulation Intrinsics
+  * PR #330: Add support for LLVM fence instruction
+  * PR #326: Enable Intel SVML-enabled auto-vectorization for all the
+             transcendentals
+
+-------------------------------------------------------------------

Old:
----
  llvmlite-0.22.0.tar.gz

New:
----
  llvmlite-0.23.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-llvmlite.spec ++++++
--- /var/tmp/diff_new_pack.2rl0GS/_old  2018-05-28 08:08:02.949654309 +0200
+++ /var/tmp/diff_new_pack.2rl0GS/_new  2018-05-28 08:08:02.953654160 +0200
@@ -17,29 +17,28 @@
 
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
-%bcond_without  tests
-ExcludeArch:    armv7l
 Name:           python-llvmlite
-Version:        0.22.0
+Version:        0.23.0
 Release:        0
 Summary:        Lightweight wrapper around basic LLVM functionality
 License:        BSD-2-Clause
 Group:          Development/Languages/Python
-Url:            http://llvmlite.pydata.org
+URL:            http://llvmlite.pydata.org
 Source:         
https://files.pythonhosted.org/packages/source/l/llvmlite/llvmlite-%{version}.tar.gz
 BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module setuptools}
-BuildRequires:  clang5-devel
+BuildRequires:  clang6-devel
 BuildRequires:  cmake
 BuildRequires:  fdupes
 BuildRequires:  glibc-devel
-BuildRequires:  llvm5-LTO-devel
-BuildRequires:  llvm5-devel
-BuildRequires:  llvm5-gold
+BuildRequires:  llvm6-LTO-devel
+BuildRequires:  llvm6-devel
+BuildRequires:  llvm6-gold
 BuildRequires:  ncurses-devel
-BuildRequires:  python-enum34
 BuildRequires:  python-rpm-macros
+BuildRequires:  python2-enum34
 BuildRequires:  zlib-devel
+ExcludeArch:    armv7l
 %ifpython2
 Requires:       python-enum34
 %endif
@@ -62,7 +61,6 @@
 * A pure Python implementation of the subset of the LLVM IR builder that we
   need for Numba.
 
-
 %prep
 %setup -q -n llvmlite-%{version}
 
@@ -74,19 +72,14 @@
 %python_expand $python setup.py install --prefix=%{_prefix} 
--root=%{buildroot} --install-lib=%{$python_sitearch}
 %python_expand %fdupes %{buildroot}%{$python_sitearch}
 
-%if %{with tests}
 %check
-cp runtests.py examples/
-pushd examples
 %{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch}
-$python runtests.py
+$python runtests.py -v
 }
-popd
-%endif
 
 %files %{python_files}
-%defattr(-,root,root,-)
-%doc README.rst LICENSE
+%license LICENSE
+%doc README.rst
 %{python_sitearch}/llvmlite/
 %{python_sitearch}/llvmlite-%{version}-*.egg-info
 

++++++ llvmlite-0.22.0.tar.gz -> llvmlite-0.23.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/PKG-INFO new/llvmlite-0.23.0/PKG-INFO
--- old/llvmlite-0.22.0/PKG-INFO        2018-02-19 21:15:34.000000000 +0100
+++ new/llvmlite-0.23.0/PKG-INFO        2018-04-25 04:32:25.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: llvmlite
-Version: 0.22.0
+Version: 0.23.0
 Summary: lightweight wrapper around basic LLVM functionality
 Home-page: http://llvmlite.pydata.org
 Author: Continuum Analytics, Inc.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/README.rst 
new/llvmlite-0.23.0/README.rst
--- old/llvmlite-0.22.0/README.rst      2018-02-07 16:56:44.000000000 +0100
+++ new/llvmlite-0.23.0/README.rst      2018-04-25 04:31:26.000000000 +0200
@@ -62,7 +62,7 @@
 
 llvmlite works with Python 2.7 and Python 3.4 or greater.
 
-As of version 0.21.0, llvmlite requires LLVM 5.0.  It does not support earlier
+As of version 0.23.0, llvmlite requires LLVM 6.0.  It does not support earlier
 or later versions of LLVM.
 
 Historical compatibility table:
@@ -70,7 +70,8 @@
 =================  ========================
 llvmlite versions  compatible LLVM versions
 =================  ========================
-0.21.0 - ...       5.0.x
+0.23.0 - ...       6.0.x
+0.21.0 - 0.22.0    5.0.x
 0.17.0 - 0.20.0    4.0.x
 0.16.0 - 0.17.0    3.9.x
 0.13.0 - 0.15.0    3.8.x
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/ffi/build.py 
new/llvmlite-0.23.0/ffi/build.py
--- old/llvmlite-0.22.0/ffi/build.py    2018-02-07 16:56:44.000000000 +0100
+++ new/llvmlite-0.23.0/ffi/build.py    2018-04-25 04:31:26.000000000 +0200
@@ -95,9 +95,9 @@
 
     out = out.decode('latin1')
     print(out)
-    if not out.startswith('5.0.'):
+    if not out.startswith('6.0.'):
         msg = (
-            "Building llvmlite requires LLVM 5.0.x. Be sure to "
+            "Building llvmlite requires LLVM 6.0.x. Be sure to "
             "set LLVM_CONFIG to the right executable path.\n"
             "Read the documentation at http://llvmlite.pydata.org/ for more "
             "information about building llvmlite.\n"
@@ -110,6 +110,8 @@
     os.environ['LLVM_LIBS'] = ' '.join(libs.split())
 
     cxxflags = run_llvm_config(llvm_config, ["--cxxflags"])
+    # on OSX cxxflags has null bytes at the end of the string, remove them
+    cxxflags = cxxflags.replace('\0', '')
     cxxflags = cxxflags.split() + ['-fno-rtti', '-g']
     os.environ['LLVM_CXXFLAGS'] = ' '.join(cxxflags)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/ffi/linker.cpp 
new/llvmlite-0.23.0/ffi/linker.cpp
--- old/llvmlite-0.22.0/ffi/linker.cpp  2017-03-02 22:50:47.000000000 +0100
+++ new/llvmlite-0.23.0/ffi/linker.cpp  2018-04-25 04:31:26.000000000 +0200
@@ -15,41 +15,42 @@
     using namespace llvm;
     std::string errorstring;
     llvm::raw_string_ostream errstream(errorstring);
+    Module *D = unwrap(Dest);
+    LLVMContext &Ctx = D->getContext();
 
-    /* Can't use a closure as that's not compatible with passing a
-     * function pointer.  Instead, the required environment is passed
-     * as a `void *` context pointer.
-     */
-    auto diagnose = [] (const DiagnosticInfo &DI, void *c) {
-        auto errstream = reinterpret_cast<llvm::raw_string_ostream *>(c);
-
-        switch (DI.getSeverity()) {
-        case DS_Error:
-        case DS_Warning:
-        case DS_Remark:
-        case DS_Note:
-            // Do something different for each of those?
-            break;
+    // This exists at the change to LLVM 6.x
+    // Link error diagnostics end up with a call to abort()
+    // install this handler to instead extract the reason for failure
+    // and report it.
+    class ReportNotAbortDiagnosticHandler: public DiagnosticHandler {
+    public:
+        ReportNotAbortDiagnosticHandler(llvm::raw_string_ostream &s):
+        raw_stream(s) {}
+
+        bool handleDiagnostics(const DiagnosticInfo &DI) override 
+        {
+            llvm::DiagnosticPrinterRawOStream DP(raw_stream);
+            DI.print(DP);
+            return true;
         }
-        llvm::DiagnosticPrinterRawOStream DP(*errstream);
-        DI.print(DP);
+
+    private:
+        llvm::raw_string_ostream& raw_stream;
     };
 
-    Module *D = unwrap(Dest);
-    LLVMContext &Ctx = D->getContext();
+    // save current handler as "old"
+    auto OldDiagnosticHandler = Ctx.getDiagnosticHandler();
 
-    /* Save the current diagnostic handler and set our own */
-    LLVMContext::DiagnosticHandlerTy OldDiagnosticHandler =
-      Ctx.getDiagnosticHandler();
-    void *OldDiagnosticContext = Ctx.getDiagnosticContext();
-    Ctx.setDiagnosticHandler((LLVMContext::DiagnosticHandlerTy) diagnose,
-                             &errstream, true);
+    // set the handler to a new one
+    
Ctx.setDiagnosticHandler(llvm::make_unique<ReportNotAbortDiagnosticHandler>(errstream));
 
+    // link
     bool failed = LLVMLinkModules2(Dest, Src);
 
-    /* Restore the original diagnostic handler */
-    Ctx.setDiagnosticHandler(OldDiagnosticHandler, OldDiagnosticContext, true);
+    // put old handler back
+    Ctx.setDiagnosticHandler(std::move(OldDiagnosticHandler));
 
+    // if linking failed extract the reason for the failure
     if (failed) {
         errstream.flush();
         *Err = LLVMPY_CreateString(errorstring.c_str());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/ffi/passmanagers.cpp 
new/llvmlite-0.23.0/ffi/passmanagers.cpp
--- old/llvmlite-0.22.0/ffi/passmanagers.cpp    2017-03-02 22:50:47.000000000 
+0100
+++ new/llvmlite-0.23.0/ffi/passmanagers.cpp    2018-04-25 04:31:26.000000000 
+0200
@@ -15,45 +15,6 @@
 
 using namespace llvm;
 
-
-/* Helpers to override the diagnostic handler when running
- * optimizations.
- * The default diagnostic handler prints some remarks unconditionally,
- * see http://lists.llvm.org/pipermail/llvm-dev/2016-July/102252.html
- */
-typedef std::tuple<LLVMContext::DiagnosticHandlerTy, void *> diag_handler_t;
-
-static diag_handler_t
-SetOptimizationDiagnosticHandler(LLVMContext &Ctx)
-{
-    auto diagnose = [] (const DiagnosticInfo &DI, void *c) {
-        // If an error, print the message and bail out (as the default
-        // handler does).
-        DiagnosticSeverity DS = DI.getSeverity();
-        if (DS == DS_Error) {
-            raw_ostream &out = errs();
-            DiagnosticPrinterRawOStream DP(out);
-            out << "LLVM error: ";
-            DI.print(DP);
-            out << "\n";
-            exit(1);
-        }
-    };
-    /* Save the current diagnostic handler and set our own */
-    diag_handler_t OldHandler(Ctx.getDiagnosticHandler(),
-                              Ctx.getDiagnosticContext());
-    Ctx.setDiagnosticHandler((LLVMContext::DiagnosticHandlerTy) diagnose,
-                             nullptr);
-    return OldHandler;
-}
-
-static void
-UnsetOptimizationDiagnosticHandler(LLVMContext &Ctx, diag_handler_t OldHandler)
-{
-    Ctx.setDiagnosticHandler(std::get<0>(OldHandler), std::get<1>(OldHandler));
-}
-
-
 /*
  * Exposed API
  */
@@ -82,28 +43,14 @@
 LLVMPY_RunPassManager(LLVMPassManagerRef PM,
                       LLVMModuleRef M)
 {
-    /* Save the current diagnostic handler and set our own */
-    LLVMContext &Ctx = unwrap(M)->getContext();
-    auto OldHandler = SetOptimizationDiagnosticHandler(Ctx);
-
-    int r = LLVMRunPassManager(PM, M);
-
-    UnsetOptimizationDiagnosticHandler(Ctx, OldHandler);
-    return r;
+    return LLVMRunPassManager(PM, M);
 }
 
 API_EXPORT(int)
 LLVMPY_RunFunctionPassManager(LLVMPassManagerRef PM,
                               LLVMValueRef F)
 {
-    /* Save the current diagnostic handler and set our own */
-    LLVMContext &Ctx = unwrap(F)->getContext();
-    auto OldHandler = SetOptimizationDiagnosticHandler(Ctx);
-
-    int r = LLVMRunFunctionPassManager(PM, F);
-
-    UnsetOptimizationDiagnosticHandler(Ctx, OldHandler);
-    return r;
+    return LLVMRunFunctionPassManager(PM, F);
 }
 
 API_EXPORT(int)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/ffi/targets.cpp 
new/llvmlite-0.23.0/ffi/targets.cpp
--- old/llvmlite-0.22.0/ffi/targets.cpp 2017-10-19 22:28:29.000000000 +0200
+++ new/llvmlite-0.23.0/ffi/targets.cpp 2018-04-25 04:31:26.000000000 +0200
@@ -194,9 +194,7 @@
 
     CodeModel::Model cm;
     std::string cms(CodeModel);
-    if (cms == "jitdefault")
-        cm = CodeModel::JITDefault;
-    else if (cms == "small")
+    if (cms == "small")
         cm = CodeModel::Small;
     else if (cms == "kernel")
         cm = CodeModel::Kernel;
@@ -204,8 +202,16 @@
         cm = CodeModel::Medium;
     else if (cms == "large")
         cm = CodeModel::Large;
-    else
-        cm = CodeModel::Default;
+    else if (cms == "default") // As per LLVM 5, needed for AOT
+        cm = CodeModel::Small;
+    else { // catches "jitdefault" and not set, as per LLVM 5, needed for MCJIT
+        // fall through, use model based on bitness
+        int bits = sizeof(void *);
+        if (bits == 4)
+            cm = CodeModel::Small;
+        else
+            cm = CodeModel::Large;
+    }
 
     Optional<Reloc::Model> rm;
     std::string rms(RelocModel);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/ffi/transforms.cpp 
new/llvmlite-0.23.0/ffi/transforms.cpp
--- old/llvmlite-0.22.0/ffi/transforms.cpp      2017-03-02 22:50:47.000000000 
+0100
+++ new/llvmlite-0.23.0/ffi/transforms.cpp      2018-04-25 04:31:26.000000000 
+0200
@@ -66,20 +66,6 @@
 }
 
 API_EXPORT(int)
-LLVMPY_PassManagerBuilderGetDisableUnitAtATime(LLVMPassManagerBuilderRef PMB)
-{
-    llvm::PassManagerBuilder *pmb = llvm::unwrap(PMB);
-    return pmb->DisableUnitAtATime;
-}
-
-API_EXPORT(void)
-LLVMPY_PassManagerBuilderSetDisableUnitAtATime(LLVMPassManagerBuilderRef PMB,
-                                            int Value)
-{
-    LLVMPassManagerBuilderSetDisableUnitAtATime(PMB, Value);
-}
-
-API_EXPORT(int)
 LLVMPY_PassManagerBuilderGetDisableUnrollLoops(LLVMPassManagerBuilderRef PMB)
 {
     llvm::PassManagerBuilder *pmb = llvm::unwrap(PMB);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/llvmlite/_version.py 
new/llvmlite-0.23.0/llvmlite/_version.py
--- old/llvmlite-0.22.0/llvmlite/_version.py    2018-02-19 21:15:34.000000000 
+0100
+++ new/llvmlite-0.23.0/llvmlite/_version.py    2018-04-25 04:32:25.000000000 
+0200
@@ -4,8 +4,8 @@
 # unpacked source archive. Distribution tarballs contain a pre-generated copy
 # of this file.
 
-version_version = '0.22.0'
-version_full = '46b4b5e288f3a175332ad68d8c3745c63fbb5701'
+version_version = '0.23.0'
+version_full = 'a924507857937369bdeb795a0f2d0a85ee27a0c1'
 def get_versions(default={}, verbose=False):
     return {'version': version_version, 'full': version_full}
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/llvmlite/binding/targets.py 
new/llvmlite-0.23.0/llvmlite/binding/targets.py
--- old/llvmlite-0.22.0/llvmlite/binding/targets.py     2017-03-02 
22:50:47.000000000 +0100
+++ new/llvmlite-0.23.0/llvmlite/binding/targets.py     2018-04-25 
04:31:26.000000000 +0200
@@ -152,8 +152,8 @@
 
 
 RELOC = frozenset(['default', 'static', 'pic', 'dynamicnopic'])
-CODEMODEL = frozenset(['default', 'jitdefault', 'small', 'kernel',
-                       'medium', 'large'])
+CODEMODEL = frozenset(['default', 'jitdefault', 'small', 'kernel', 'medium',
+                       'large'])
 
 
 class Target(ffi.ObjectRef):
@@ -206,6 +206,10 @@
                               jitdebug=False, printmc=False):
         """
         Create a new TargetMachine for this target and the given options.
+
+        Specifying codemodel='default' will result in the use of the "small"
+        code model. Specifying codemodel='jitdefault' will result in the code
+        model being picked based on platform bitness (32="small", 64="large").
         """
         assert 0 <= opt <= 3
         assert reloc in RELOC
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/llvmlite/binding/transforms.py 
new/llvmlite-0.23.0/llvmlite/binding/transforms.py
--- old/llvmlite-0.22.0/llvmlite/binding/transforms.py  2017-03-02 
22:50:47.000000000 +0100
+++ new/llvmlite-0.23.0/llvmlite/binding/transforms.py  2018-04-25 
04:31:26.000000000 +0200
@@ -51,14 +51,6 @@
         ffi.lib.LLVMPY_PassManagerBuilderUseInlinerWithThreshold(self, 
threshold)
 
     @property
-    def disable_unit_at_a_time(self):
-        return ffi.lib.LLVMPY_PassManagerBuilderGetDisableUnitAtATime(self)
-
-    @disable_unit_at_a_time.setter
-    def disable_unit_at_a_time(self, disable=True):
-        ffi.lib.LLVMPY_PassManagerBuilderSetDisableUnitAtATime(self, disable)
-
-    @property
     def disable_unroll_loops(self):
         """
         If true, disable loop unrolling.
@@ -145,15 +137,13 @@
 
 # Boolean PassManagerBuilder properties
 
-for _func in (ffi.lib.LLVMPY_PassManagerBuilderSetDisableUnitAtATime,
-              ffi.lib.LLVMPY_PassManagerBuilderSetDisableUnrollLoops,
+for _func in (ffi.lib.LLVMPY_PassManagerBuilderSetDisableUnrollLoops,
               ffi.lib.LLVMPY_PassManagerBuilderSetLoopVectorize,
               ffi.lib.LLVMPY_PassManagerBuilderSetSLPVectorize,
               ):
     _func.argtypes = [ffi.LLVMPassManagerBuilderRef, c_bool]
 
-for _func in (ffi.lib.LLVMPY_PassManagerBuilderGetDisableUnitAtATime,
-              ffi.lib.LLVMPY_PassManagerBuilderGetDisableUnrollLoops,
+for _func in (ffi.lib.LLVMPY_PassManagerBuilderGetDisableUnrollLoops,
               ffi.lib.LLVMPY_PassManagerBuilderGetLoopVectorize,
               ffi.lib.LLVMPY_PassManagerBuilderGetSLPVectorize,
               ):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/llvmlite/ir/builder.py 
new/llvmlite-0.23.0/llvmlite/ir/builder.py
--- old/llvmlite-0.22.0/llvmlite/ir/builder.py  2017-11-27 17:41:44.000000000 
+0100
+++ new/llvmlite-0.23.0/llvmlite/ir/builder.py  2018-04-25 04:31:26.000000000 
+0200
@@ -69,6 +69,36 @@
     return wrap
 
 
+def _uniop_intrinsic(opname):
+    def wrap(fn):
+        @functools.wraps(fn)
+        def wrapped(self, operand, name=''):
+            if not isinstance(operand.type, types.IntType):
+                raise TypeError("expected an integer type, got %s" % 
operand.type)
+            fn = self.module.declare_intrinsic(opname, [operand.type])
+            return self.call(fn, [operand], name)
+
+        return wrapped
+
+    return wrap
+
+
+def _uniop_intrinsic_with_flag(opname):
+    def wrap(fn):
+        @functools.wraps(fn)
+        def wrapped(self, operand, flag, name=''):
+            if not isinstance(operand.type, types.IntType):
+                raise TypeError("expected an integer type, got %s" % 
operand.type)
+            if flag.type != types.IntType(1):
+                raise TypeError("expected an i1 type, got %s" % flag.type)
+            fn = self.module.declare_intrinsic(opname, [operand.type, 
flag.type])
+            return self.call(fn, [operand, flag], name)
+
+        return wrapped
+
+    return wrap
+
+
 def _castop(opname, cls=instructions.CastInstr):
     def wrap(fn):
         @functools.wraps(fn)
@@ -841,3 +871,42 @@
         """
         fn = self.module.declare_intrinsic("llvm.assume")
         return self.call(fn, [cond])
+
+    def fence(self, ordering, targetscope=None, name=''):
+        """
+        Add a memory barrier, preventing certain reorderings of load and/or 
store accesses with
+        respect to other processors and devices.
+        """
+        inst = instructions.Fence(self.block, ordering, targetscope, name=name)
+        self._insert(inst)
+        return inst
+
+    @_uniop_intrinsic("llvm.bswap")
+    def bswap(self, cond):
+        """
+        Used to byte swap integer values with an even number of bytes 
(positive multiple of 16 bits)
+        """
+
+    @_uniop_intrinsic("llvm.bitreverse")
+    def bitreverse(self, cond):
+        """
+        Reverse the bitpattern of an integer value; for example 0b10110110 
becomes 0b01101101.
+        """
+
+    @_uniop_intrinsic("llvm.ctpop")
+    def ctpop(self, cond):
+        """
+        Counts the number of bits set in a value.
+        """
+
+    @_uniop_intrinsic_with_flag("llvm.ctlz")
+    def ctlz(self, cond, flag):
+        """
+        Counts the number of leading zeros in a variable.
+        """
+
+    @_uniop_intrinsic_with_flag("llvm.cttz")
+    def cttz(self, cond, flag):
+        """
+        Counts the number of trailing zeros in a variable.
+        """
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/llvmlite/ir/instructions.py 
new/llvmlite-0.23.0/llvmlite/ir/instructions.py
--- old/llvmlite-0.22.0/llvmlite/ir/instructions.py     2017-11-27 
17:41:44.000000000 +0100
+++ new/llvmlite-0.23.0/llvmlite/ir/instructions.py     2018-04-25 
04:31:26.000000000 +0200
@@ -676,3 +676,34 @@
                               clauses=''.join(["\n      {0}".format(clause)
                                                for clause in self.clauses]),
                               ))
+
+class Fence(Instruction):
+    """
+    The `fence` instruction.
+
+    As of LLVM 5.0.1:
+
+    fence [syncscope("<target-scope>")] <ordering>  ; yields void
+    """
+
+    VALID_FENCE_ORDERINGS = {"acquire", "release", "acq_rel", "seq_cst"}
+
+    def __init__(self, parent, ordering, targetscope=None, name=''):
+        super(Fence, self).__init__(parent, types.VoidType(), "fence", (), 
name=name)
+        if ordering not in self.VALID_FENCE_ORDERINGS:
+            raise ValueError("Invalid fence ordering \"{0}\"! Should be one of 
{1}."
+                             .format(ordering, ", 
".join(self.VALID_FENCE_ORDERINGS)))
+        self.ordering = ordering
+        self.targetscope = targetscope
+
+    def descr(self, buf):
+        if self.targetscope is None:
+            syncscope = ""
+        else:
+            syncscope = 'syncscope("{0}") '.format(self.targetscope)
+
+        fmt = "fence {syncscope}{ordering}\n"
+        buf.append(fmt.format(syncscope=syncscope,
+                              ordering=self.ordering,
+                              ))
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/llvmlite/ir/module.py 
new/llvmlite-0.23.0/llvmlite/ir/module.py
--- old/llvmlite-0.22.0/llvmlite/ir/module.py   2017-10-19 22:28:29.000000000 
+0200
+++ new/llvmlite-0.23.0/llvmlite/ir/module.py   2018-04-25 04:31:26.000000000 
+0200
@@ -155,7 +155,11 @@
             raise NotImplementedError("unknown intrinsic %r with %d types"
                                       % (intrinsic, len(tys)))
 
-        name = '.'.join([intrinsic] + [t.intrinsic_name for t in tys])
+        if intrinsic in {'llvm.cttz', 'llvm.ctlz'}:
+            suffixes = [tys[0].intrinsic_name]
+        else:
+            suffixes = [t.intrinsic_name for t in tys]
+        name = '.'.join([intrinsic] + suffixes)
         if name in self.globals:
             return self.globals[name]
 
@@ -172,10 +176,16 @@
                 fnty = types.FunctionType(tys[0], tys*2)
             else:
                 fnty = types.FunctionType(tys[0], tys)
-        elif len(tys) == 2 and intrinsic == 'llvm.memset':
-            tys = [tys[0], types.IntType(8), tys[1],
-                   types.IntType(32), types.IntType(1)]
-            fnty = types.FunctionType(types.VoidType(), tys)
+        elif len(tys) == 2:
+            if intrinsic == 'llvm.memset':
+                tys = [tys[0], types.IntType(8), tys[1],
+                       types.IntType(32), types.IntType(1)]
+                fnty = types.FunctionType(types.VoidType(), tys)
+            elif intrinsic in {'llvm.cttz', 'llvm.ctlz'}:
+                tys = [tys[0], types.IntType(1)]
+                fnty = types.FunctionType(tys[0], tys)
+            else:
+                _error()
         elif len(tys) == 3 and intrinsic in ('llvm.memcpy', 'llvm.memmove'):
             tys = tys + [types.IntType(32), types.IntType(1)]
             fnty = types.FunctionType(types.VoidType(), tys)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/llvmlite/tests/test_binding.py 
new/llvmlite-0.23.0/llvmlite/tests/test_binding.py
--- old/llvmlite-0.22.0/llvmlite/tests/test_binding.py  2018-02-07 
23:09:48.000000000 +0100
+++ new/llvmlite-0.23.0/llvmlite/tests/test_binding.py  2018-04-25 
04:31:26.000000000 +0200
@@ -326,7 +326,7 @@
 
     def test_version(self):
         major, minor, patch = llvm.llvm_version_info
-        self.assertEqual((major, minor), (5, 0))
+        self.assertEqual((major, minor), (6, 0))
         self.assertIn(patch, range(10))
 
     def test_check_jit_execution(self):
@@ -913,13 +913,6 @@
         for i in (25, 80, 350):
             pmb.inlining_threshold = i
 
-    def test_disable_unit_at_a_time(self):
-        pmb = self.pmb()
-        self.assertIsInstance(pmb.disable_unit_at_a_time, bool)
-        for b in (True, False):
-            pmb.disable_unit_at_a_time = b
-            self.assertEqual(pmb.disable_unit_at_a_time, b)
-
     def test_disable_unroll_loops(self):
         pmb = self.pmb()
         self.assertIsInstance(pmb.disable_unroll_loops, bool)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/llvmlite-0.22.0/llvmlite/tests/test_ir.py 
new/llvmlite-0.23.0/llvmlite/tests/test_ir.py
--- old/llvmlite-0.22.0/llvmlite/tests/test_ir.py       2018-02-07 
16:56:44.000000000 +0100
+++ new/llvmlite-0.23.0/llvmlite/tests/test_ir.py       2018-04-25 
04:31:26.000000000 +0200
@@ -19,6 +19,7 @@
 
 int1 = ir.IntType(1)
 int8 = ir.IntType(8)
+int16 = ir.IntType(16)
 int32 = ir.IntType(32)
 int64 = ir.IntType(64)
 flt = ir.FloatType()
@@ -1164,6 +1165,130 @@
                 call void @"llvm.assume"(i1 %"c")
             """)
 
+    def test_bitreverse(self):
+        block = self.block(name='my_block')
+        builder = ir.IRBuilder(block)
+        a = ir.Constant(int64, 5)
+        c = builder.bitreverse(a, name='c')
+        builder.ret(c)
+        self.check_block(block, """\
+            my_block:
+                %"c" = call i64 @"llvm.bitreverse.i64"(i64 5)
+                ret i64 %"c"
+            """)
+
+    def test_bitreverse_wrongtype(self):
+        block = self.block(name='my_block')
+        builder = ir.IRBuilder(block)
+        a = ir.Constant(flt, 5)
+
+        with self.assertRaises(TypeError) as raises:
+            builder.bitreverse(a, name='c')
+        self.assertIn(
+            "expected an integer type, got float",
+            str(raises.exception))
+
+    def test_fence(self):
+        block = self.block(name='my_block')
+        builder = ir.IRBuilder(block)
+        with self.assertRaises(ValueError) as raises:
+            builder.fence("monotonic", None)
+        self.assertIn(
+            "Invalid fence ordering \"monotonic\"!",
+            str(raises.exception))
+        with self.assertRaises(ValueError) as raises:
+            builder.fence(None, "monotonic")
+        self.assertIn(
+            "Invalid fence ordering \"None\"!",
+            str(raises.exception))
+        builder.fence("acquire", None)
+        builder.fence("release", "singlethread")
+        builder.fence("acq_rel", "singlethread")
+        builder.fence("seq_cst")
+        builder.ret_void()
+        self.check_block(block, """\
+            my_block:
+                fence acquire
+                fence syncscope("singlethread") release
+                fence syncscope("singlethread") acq_rel
+                fence seq_cst
+                ret void
+            """)
+
+    def test_bswap(self):
+        block = self.block(name='my_block')
+        builder = ir.IRBuilder(block)
+        a = ir.Constant(int32, 5)
+        c = builder.bswap(a, name='c')
+        builder.ret(c)
+        self.check_block(block, """\
+            my_block:
+                %"c" = call i32 @"llvm.bswap.i32"(i32 5)
+                ret i32 %"c"
+            """)
+
+    def test_ctpop(self):
+        block = self.block(name='my_block')
+        builder = ir.IRBuilder(block)
+        a = ir.Constant(int16, 5)
+        c = builder.ctpop(a, name='c')
+        builder.ret(c)
+        self.check_block(block, """\
+            my_block:
+                %"c" = call i16 @"llvm.ctpop.i16"(i16 5)
+                ret i16 %"c"
+            """)
+
+    def test_ctlz(self):
+        block = self.block(name='my_block')
+        builder = ir.IRBuilder(block)
+        a = ir.Constant(int16, 5)
+        b = ir.Constant(int1, 1)
+        c = builder.ctlz(a, b, name='c')
+        builder.ret(c)
+        self.check_block(block, """\
+            my_block:
+                %"c" = call i16 @"llvm.ctlz.i16"(i16 5, i1 1)
+                ret i16 %"c"
+            """)
+
+    def test_cttz(self):
+        block = self.block(name='my_block')
+        builder = ir.IRBuilder(block)
+        a = ir.Constant(int64, 5)
+        b = ir.Constant(int1, 1)
+        c = builder.cttz(a, b, name='c')
+        builder.ret(c)
+        self.check_block(block, """\
+            my_block:
+                %"c" = call i64 @"llvm.cttz.i64"(i64 5, i1 1)
+                ret i64 %"c"
+            """)
+
+    def test_cttz_wrongflag(self):
+        block = self.block(name='my_block')
+        builder = ir.IRBuilder(block)
+        a = ir.Constant(int64, 5)
+        b = ir.Constant(int32, 3)
+
+        with self.assertRaises(TypeError) as raises:
+            builder.cttz(a, b, name='c')
+        self.assertIn(
+            "expected an i1 type, got i32",
+            str(raises.exception))
+
+    def test_cttz_wrongtype(self):
+        block = self.block(name='my_block')
+        builder = ir.IRBuilder(block)
+        a = ir.Constant(flt, 5)
+        b = ir.Constant(int1, 1)
+
+        with self.assertRaises(TypeError) as raises:
+            builder.cttz(a, b, name='c')
+        self.assertIn(
+            "expected an integer type, got float",
+            str(raises.exception))
+
 
 class TestBuilderMisc(TestBase):
     """


Reply via email to