KhronosGroup / KhronosGroup/SPIRV-LLVM-Translator

Translate OpFRem into fmod in extended instruction set

Open
#1,798 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
LLVM
Stars
625
Forks
279
Avg merge
3d 5h
Merged PRs (30d)
34

Description

The LLVM LangRef states that the frem instruction is the equivalent of the C fmod function. We should follow this and translate frem to the extended instruction set's fmod instruction, which corresponds to OpenCL C's fmod builtin. We currently translate it into OpFRem for which the precision requirements are [not yet clear](KhronosGroup/OpenCL-Docs/issues/859).

[ Regarding translation in the reverse direction: it's not clear whether we should translate calls to the extended instruction set's fmod instruction into calls to the fmod function, or into LLVM's frem instruction - but for now, I would suggest we continue to translate this into calls to the fmod function as we do currently (or otherwise we would need to be sure that frem will always meet precision requirements). ]

Contributor guide

Open the contributing guide

Research direction

No file or test is identified. Locate the translation entry point for LLVM's frem instruction and inspect its current mapping to OpFRem; compare it with the LLVM LangRef and the extended instruction set's fmod semantics. Done means translating frem to fmod while preserving the stated reverse-direction behavior and accounting for the unresolved precision question.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.