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@lists.freedesktop.org
          Reporter: programmerj...@gmail.com
        QA Contact: mesa-dev@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.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to