[llvm] [SPIRV] Add FloatControl2 capability (PR #144371)
Nathan Gauër via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 16 08:56:41 PDT 2025
================
@@ -0,0 +1,28 @@
+; RUN: llc -O0 -mtriple=spirv1.6-vulkan1.3-compute %s -o - | FileCheck %s --check-prefix=CHECK-NOEXT
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv1.6-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %}
+
+; RUN: llc -O0 -mtriple=spirv1.6-vulkan1.3-compute -spirv-ext=+SPV_KHR_float_controls2 %s -o - | FileCheck %s --check-prefix=CHECK-EXT
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv1.6-vulkan1.3-compute %s -o - -filetype=obj | spirv-val %}
+
+; CHECK-NOEXT-NOT: OpDecorate FPFastMathMode
+
+; CHECK-EXT: OpCapability FloatControls2
+; CHECK-EXT: OpExtension "SPV_KHR_float_controls2"
+; CHECK-EXT: OpDecorate {{%[0-9]+}} FPFastMathMode NotNaN|NotInf|NSZ|AllowRecip|Fast
+
+ at .str = private unnamed_addr constant [3 x i8] c"In\00", align 1
+ at .str.2 = private unnamed_addr constant [4 x i8] c"Out\00", align 1
+
+define void @main() local_unnamed_addr #0 {
+ %1 = tail call target("spirv.Image", float, 5, 2, 0, 0, 2, 0) @llvm.spv.resource.handlefrombinding.tspirv.Image_f32_5_2_0_0_2_0t(i32 0, i32 0, i32 1, i32 0, i1 false, ptr nonnull @.str)
+ %2 = tail call target("spirv.Image", float, 5, 2, 0, 0, 2, 0) @llvm.spv.resource.handlefrombinding.tspirv.Image_f32_5_2_0_0_2_0t(i32 0, i32 1, i32 1, i32 0, i1 false, ptr nonnull @.str.2)
+ %3 = tail call i32 @llvm.spv.thread.id.in.group(i32 0)
+ %4 = tail call noundef align 4 dereferenceable(4) ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.Image_f32_5_2_0_0_2_0t(target("spirv.Image", float, 5, 2, 0, 0, 2, 0) %1, i32 %3)
+ %5 = load float, ptr addrspace(11) %4, align 4
----------------
Keenuts wrote:
Do you need this to test float codegen?
I'd like to avoid adding unrelated codegen bits, because if we change the way we handle RWBuffers, then this unrelated test will have to be rewritten.
https://github.com/llvm/llvm-project/pull/144371
More information about the llvm-commits
mailing list