[clang] [llvm] Implements isnan() HLSL intrinsic for DXIL and SPIR-V targets. (PR #157733)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 12 07:15:13 PDT 2025


farzonl wrote:

you need a `llvm/test/CodeGen/DirectX/isnan.ll`
You can use [llvm/test/CodeGen/DirectX/isinf.ll](https://github.com/llvm/llvm-project/blob/8036edb21dbedf79687613caef3d40aa5a50ddf2/llvm/test/CodeGen/DirectX/isinf.ll) as a reference.

The one difference I would do is:
```
; RUN: opt -S -dxil-intrinsic-expansion -scalarizer -dxil-op-lower -mtriple=dxil-pc-shadermodel6.9-library %s | FileCheck %s --check-prefixes=CHECK,SM69CHECK
; RUN: opt -S -dxil-intrinsic-expansion -mtriple=dxil-pc-shadermodel6.8-library %s | FileCheck %s --check-prefixes=CHECK,SMOLDCHECK
```

We are already testing  fp16 scalarization of the emulated codegen via `llvm/test/CodeGen/DirectX/is_fpclass.ll` we don't need to do it as part of this test. As such we don't need DXIL lowering for the SM 6.8 case either we just need to know that for fp32 the intrinsic is preserved and for fp16 it gets emulated. the DXIL lowering can be limited to the SM 6.9 case.


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


More information about the llvm-commits mailing list