================
@@ -0,0 +1,27 @@
+; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown 
--spirv-ext=+SPV_INTEL_function_pointers,+SPV_KHR_untyped_pointers %s -o - | 
FileCheck %s
+; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown 
--spirv-ext=+SPV_INTEL_function_pointers,+SPV_KHR_untyped_pointers %s -o - 
-filetype=obj | spirv-val %}
+
+; With untyped pointers enabled a function pointer must stay typed, since an
+; untyped pointer cannot express the function type. A select between two 
function
+; pointers then has matching typed operands and result.
+
+; CHECK-DAG: %[[#I32:]] = OpTypeInt 32 0
+; CHECK-DAG: %[[#FNTY:]] = OpTypeFunction %[[#I32]] %[[#I32]] %[[#I32]]
+; CHECK-DAG: %[[#FPTY:]] = OpTypePointer CodeSectionINTEL %[[#FNTY]]
+; CHECK: %[[#BAR:]] = OpConstantFunctionPointerINTEL %[[#FPTY]]
+; CHECK: %[[#BAZ:]] = OpConstantFunctionPointerINTEL %[[#FPTY]]
+; CHECK: OpSelect %[[#]] %[[#]] %[[#BAZ]] %[[#BAR]]
----------------
maarquitos14 wrote:

I guess spirv-val would fail if it wasn't the case, feel free to ignore.

https://github.com/llvm/llvm-project/pull/201233
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to