[clang] Implement the `fmod` intrinsic (PR #130320)

Kaitlin Peng via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 7 14:29:01 PST 2025


================
@@ -22,56 +22,144 @@
 //
 // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
 // RUN:   spirv-unknown-vulkan-compute %s -fnative-half-type \
-// RUN:   -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
+// RUN:   -emit-llvm -o - | FileCheck %s \
 // RUN:   -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTYPE=half
 
 //
 // ---------- No Native Half support test -----------
 //
 // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
-// RUN:   spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \
+// RUN:   spirv-unknown-vulkan-compute %s -emit-llvm \
 // RUN:   -o - | FileCheck %s \
 // RUN:   -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTYPE=float
 
 
 
+// DXCHECK: define [[FNATTRS]] [[TYPE]] @
+// DXCHECK: %div1.i = fdiv reassoc nnan ninf nsz arcp afn [[TYPE]]
----------------
kmpeng wrote:

@Icohedron Would you recommend running the DirectX tests with -O1 then if we want to check the operands? Currently the dependent instructions are not necessarily receiving the same operands/outputs from the instructions they depend on (e.g. `%fneg.i` depends on `%div1.i`, but `%div1.i` becomes `%7` and then `%7` is passed to `%fneg.i` instead). Running with -O1 solves this, but it also optimizes away the first `fneg` instruction I check for.

https://github.com/llvm/llvm-project/pull/130320


More information about the cfe-commits mailing list