[llvm] [SPIRV] Added Support for the constrained conversion intrinsics (PR #157437)

Subash B via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 00:25:43 PDT 2025


================
@@ -0,0 +1,230 @@
+; RUN: llc -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
+
+define float @sitofp_f32_i32(i32 %in) {
+; CHECK-DAG: OpName %[[#]] "conv"
+; CHECK-DAG: OpConvertSToF %[[#]] %[[#]]
+; CHECK-DAG: OpDecorate %[[#]] FPRoundingMode RTE
+; CHECK-DAG: OpReturnValue %[[#]]
+entry:
+    %conv = tail call float @llvm.experimental.constrained.sitofp.f32.i32(i32 %in, metadata !"round.tonearest", metadata !"fpexcept.strict")
+    ret float %conv
+}
+
+define float @sitofp_f32_i16(i16 %in) {
+; CHECK-DAG: OpName %[[#]] "conv1"
----------------
SubashBoopathi wrote:

@arsenm I tried running utils/update_llc_test_checks.py on constrained-convert.ll. Instead of regenerating the CHECK: directives, it only inserted the autogenerated note at the top and the file end marker, while removing the existing checks in between. Could you clarify the correct way to use the script here? 

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


More information about the llvm-commits mailing list