diff options
author | Frederik Harwath <frederik.harwath@amd.com> | 2025-09-03 16:27:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-03 16:27:15 +0200 |
commit | 47793f9a73314a7669f436ee6e0528203c8633e7 (patch) | |
tree | fd97f7461872aa5fe0b75a4a908315af0fd617a4 /llvm/lib/CodeGen/TargetPassConfig.cpp | |
parent | d15998fe64619e1cc0d6285fbd24d5fe5429c9ef (diff) | |
download | llvm-47793f9a73314a7669f436ee6e0528203c8633e7.zip llvm-47793f9a73314a7669f436ee6e0528203c8633e7.tar.gz llvm-47793f9a73314a7669f436ee6e0528203c8633e7.tar.bz2 |
[AMDGPU] Implement IR expansion for frem instruction (#130988)
This patch implements a correctly rounded expansion of the frem
instruction in LLVM IR. This is useful for target architectures for
which such an expansion is too involved to be implement in ISel
Lowering. The expansion is based on the code from the AMD device libs
and has been tested successfully against the OpenCL conformance tests on
amdgpu. The expansion is implemented in the preexisting "expand-fp"
pass. It replaces the expansion of "frem" in ISel for the amdgpu target;
it is enabled for targets which do not directly support "frem" and for
which no matching "fmod" LibCall is available.
---------
Co-authored-by: Matt Arsenault <Matthew.Arsenault@amd.com>
Diffstat (limited to 'llvm/lib/CodeGen/TargetPassConfig.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetPassConfig.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index 7d7c6e7..f83973c 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -1074,7 +1074,7 @@ bool TargetPassConfig::addISelPasses() { PM->add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis())); addPass(createPreISelIntrinsicLoweringPass()); addPass(createExpandLargeDivRemPass()); - addPass(createExpandFpPass()); + addPass(createExpandFpPass(getOptLevel())); addIRPasses(); addCodeGenPrepare(); addPassesToHandleExceptions(); |