[Mesa-dev] [Bug 102032] nir_op_imod is incorrectly implemented as LLVM's srem

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Aug 3 22:08:37 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=102032

            Bug ID: 102032
           Summary: nir_op_imod is incorrectly implemented as LLVM's srem
           Product: Mesa
           Version: git
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Drivers/Vulkan/radeon
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: programmerjake at gmail.com
        QA Contact: mesa-dev at lists.freedesktop.org

nir_op_imod is incorrectly translated to LLVM's srem instruction in
src/amd/common/ac_nir_to_llvm.c:1567.
If you use the operands -1 and 3, nir_op_imod should return 2, however srem
returns -1.

compare with intel's implementation:
https://github.com/mesa3d/mesa/blob/e69e5c7006da80af62c9ef08dec215b3b4b30946/src/intel/compiler/brw_vec4_nir.cpp#L1352

C++ algorithm:
https://godbolt.org/g/pUeEfi

LLVM srem documentation:
https://llvm.org/docs/LangRef.html#srem-instruction

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170803/bae6f887/attachment.html>


More information about the mesa-dev mailing list