
A new test added for spirv-friendly builtins for SPV_KHR_bit_instructions unveiled that current mechanism to detect whether SPIRV Backend is in OpenCL environment or Vulkan environment was not good enough. This PR updates how to detect the environment and all the tests accordingly. *UPDATE*: the new approach is having a new member in `SPIRVSubtarget` to represent the environment. It can be either OpenCL, Kernel or Unknown. If the triple is explicit, we can directly set it at the creation of the `SPIRVSubtarget`, otherwise we just leave it unknown until we find other information that can help us set the environment. For now, the only other information we use to set the environment is `hlsl.shader` attribute at `SPIRV::ExecutionModel::ExecutionModel getExecutionModel(const SPIRVSubtarget &STI, const Function &F)`. Going forward we should consider also specific instructions that are Kernel-exclusive or Shader-exclusive. --------- Co-authored-by: marcos.maronas <mmaronas@smtp.igk.intel.com>
16 lines
830 B
LLVM
16 lines
830 B
LLVM
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-OCL
|
|
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
|
|
|
|
; RUN: llc -O0 -mtriple=spirv-unknown-vulkan %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOOCL
|
|
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan %s -o - -filetype=obj | spirv-val %}
|
|
|
|
; CHECK-DAG: OpCapability Linkage
|
|
; CHECK-NOOCL-DAG: OpCapability Shader
|
|
; CHECK-OCL-DAG: OpCapability Addresses
|
|
; CHECK-OCL-DAG: OpCapability Kernel
|
|
; CHECK-OCL: %1 = OpExtInstImport "OpenCL.std"
|
|
; CHECK-NOOCL: OpMemoryModel Logical GLSL450
|
|
; CHECK-OCL: OpMemoryModel Physical64 OpenCL
|
|
; CHECK-NOOCL: OpSource Unknown 0
|
|
; CHECK-OCL: OpSource OpenCL_CPP 100000
|