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

Deric C. via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 11 18:10:18 PDT 2025


================
@@ -22,56 +22,128 @@
 //
 // 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]] %{{.*}}, %{{.*}}
----------------
Icohedron wrote:

Very well, then. I will approve the PR. I will leave this comment however:

> I think this our fundamental disagreement. You seem to want to use a concept in FileCheck for checking values as a comment and I think thats a misuse of the feature that hurts clarity.

I don't think it is a misuse of the feature. If it was, then wouldn't someone have implemented a check for unused variables within FileCheck itself and warn of such appearances?

Unused FileCheck variables are also a common occurrence. Perhaps the most obvious are checks for the entry block label made by the `update_cc_test_checks.py` script. Can see that in autogenerated checks for tests such as [length.hlsl](https://github.com/llvm/llvm-project/blob/9415b7d97fc38d0b8f3de63f7ba6ff6a5072158e/clang/test/CodeGenHLSL/builtins/length.hlsl#L16).

You also approved a PR (#128979) with a handwritten test that includes several unused FileCheck variables ([or.hlsl](https://github.com/llvm/llvm-project/blob/9415b7d97fc38d0b8f3de63f7ba6ff6a5072158e/clang/test/CodeGenHLSL/builtins/or.hlsl#L18))

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


More information about the cfe-commits mailing list