Files
clang-p2996/llvm/test/Frontend/HLSL/empty_cs_entry.ll
Nathan Gauër 6bad175a87 [SPIRV][DX] Share one test between backends (#65975)
One big issue with DirectXShaderCompiler was test coverage: DXIL and
SPIR-V backends had their own tests. When a bug was found in one, the
other wasn't always checked. This lead to unequal support of HLSL for
both backends. We'd like to avoid those issues here, hence the
test-sharing.

By default, all the tests in this folder are marked as requiring
DirectX. But as SPIR-V support grows, each test drop this requirement,
and check the SPIR-V behavior.

I would have preferred to mark new tests as XFAIL for SPIR-V by default,
so we could differentiate real unsupported tests (as SPIR-V has no
equivalent), from newly added tests. But the way LIT is built, I don't
think this is possible.

---------

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-09-21 12:15:55 +02:00

28 lines
1.2 KiB
LLVM

; RUN: %if directx-registered-target %{ opt -S -dxil-metadata-emit < %s | FileCheck %s --check-prefix=DXIL-CHECK %}
; RUN: %if spirv-registered-target %{ llc %s -mtriple=spirv-unknown-unknown -o - | FileCheck %s --check-prefix=SPIRV-CHECK %}
target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
target triple = "dxil-unknown-shadermodel6.7-compute"
;DXIL-CHECK:!dx.entryPoints = !{![[entry:[0-9]+]]}
;DXIL-CHECK:![[entry]] = !{ptr @entry, !"entry", null, null, ![[extra:[0-9]+]]}
;DXIL-CHECK:![[extra]] = !{i32 4, ![[numthreads:[0-9]+]]}
;DXIL-CHECK:![[numthreads]] = !{i32 1, i32 2, i32 1}
;SPIRV-CHECK: OpCapability Shader
;SPIRV-CHECK: OpMemoryModel Logical GLSL450
;SPIRV-CHECK: OpEntryPoint GLCompute [[main:%[0-9]+]] "entry"
;SPIRV-CHECK: OpExecutionMode [[main]] LocalSize 1 2 1
;SPIRV-CHECK: [[void:%[0-9]+]] = OpTypeVoid
;SPIRV-CHECK: [[ftype:%[0-9]+]] = OpTypeFunction [[void]]
;SPIRV-CHECK: [[main]] = OpFunction [[void]] DontInline [[ftype]]
; Function Attrs: noinline nounwind
define void @entry() #0 {
entry:
ret void
}
attributes #0 = { noinline nounwind "hlsl.numthreads"="1,2,1" "hlsl.shader"="compute" }