[llvm] [SPIRV] Implement translation for llvm.modf.* intrinsics (PR #147556)
Marcos Maronas via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 16 12:12:26 PDT 2025
================
@@ -337,3 +338,61 @@ entry:
}
declare float @llvm.fma.f32(float, float, float)
+
+; CHECK: OpFunction
+; CHECK: %[[#d:]] = OpFunctionParameter %[[#]]
+; CHECK: %[[#fracPtr:]] = OpFunctionParameter %[[#]]
+; CHECK: %[[#integralPtr:]] = OpFunctionParameter %[[#]]
+; CHECK: %[[#varPtr:]] = OpVariable %[[#]] Function
+; CHECK: %[[#frac:]] = OpExtInst %[[#var2]] %[[#extinst_id]] modf %[[#d]] %[[#varPtr]]
+; CHECK: %[[#integral:]] = OpLoad %[[#var2]] %[[#varPtr]]
+; CHECK: OpStore %[[#fracPtr]] %[[#frac]]
+; CHECK: OpStore %[[#integralPtr]] %[[#integral]]
+; CHECK: OpFunctionEnd
+define void @TestModf(double %d, ptr addrspace(1) %frac, ptr addrspace(1) %integral) {
+entry:
+ %4 = tail call { double, double } @llvm.modf.f64(double %d)
+ %5 = extractvalue { double, double } %4, 0
+ %6 = extractvalue { double, double } %4, 1
+ store double %5, ptr addrspace(1) %frac, align 8
+ store double %6, ptr addrspace(1) %integral, align 8
+ ret void
+}
+
+define dso_local void @TestModf2(double noundef %d, ptr noundef %frac, ptr noundef %integral) {
----------------
maarquitos14 wrote:
Absolutely, completely forgot about that. Thanks for catching this!
https://github.com/llvm/llvm-project/pull/147556
More information about the llvm-commits
mailing list