Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,9 @@ void RequirementHandler::initAvailableCapabilitiesForOpenCL(
void RequirementHandler::initAvailableCapabilitiesForVulkan(
const SPIRVSubtarget &ST) {
addAvailableCaps({Capability::Shader, Capability::Linkage});

// Provided by Vulkan version 1.0.
addAvailableCaps({Capability::Int16, Capability::Int64, Capability::Float64});
}

} // namespace SPIRV
Expand Down
51 changes: 51 additions & 0 deletions llvm/test/CodeGen/SPIRV/basic_float_types.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s

define void @main() {
entry:
; CHECK-DAG: %[[#float:]] = OpTypeFloat 32
; CHECK-DAG: %[[#double:]] = OpTypeFloat 64

; CHECK-DAG: %[[#v2float:]] = OpTypeVector %[[#float]] 2
; CHECK-DAG: %[[#v3float:]] = OpTypeVector %[[#float]] 3
; CHECK-DAG: %[[#v4float:]] = OpTypeVector %[[#float]] 4

; CHECK-DAG: %[[#v2double:]] = OpTypeVector %[[#double]] 2
; CHECK-DAG: %[[#v3double:]] = OpTypeVector %[[#double]] 3
; CHECK-DAG: %[[#v4double:]] = OpTypeVector %[[#double]] 4

; CHECK-DAG: %[[#ptr_Function_float:]] = OpTypePointer Function %[[#float]]
; CHECK-DAG: %[[#ptr_Function_double:]] = OpTypePointer Function %[[#double]]
; CHECK-DAG: %[[#ptr_Function_v2float:]] = OpTypePointer Function %[[#v2float]]
; CHECK-DAG: %[[#ptr_Function_v3float:]] = OpTypePointer Function %[[#v3float]]
; CHECK-DAG: %[[#ptr_Function_v4float:]] = OpTypePointer Function %[[#v4float]]
; CHECK-DAG: %[[#ptr_Function_v2double:]] = OpTypePointer Function %[[#v2double]]
; CHECK-DAG: %[[#ptr_Function_v3double:]] = OpTypePointer Function %[[#v3double]]
; CHECK-DAG: %[[#ptr_Function_v4double:]] = OpTypePointer Function %[[#v4double]]

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_float]] Function
%float_Val = alloca float, align 4

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_double]] Function
%double_Val = alloca double, align 8

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v2float]] Function
%float2_Val = alloca <2 x float>, align 8

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v3float]] Function
%float3_Val = alloca <3 x float>, align 16

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v4float]] Function
%float4_Val = alloca <4 x float>, align 16

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v2double]] Function
%double2_Val = alloca <2 x double>, align 16

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v3double]] Function
%double3_Val = alloca <3 x double>, align 32

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v4double]] Function
%double4_Val = alloca <4 x double>, align 32
ret void
}
73 changes: 73 additions & 0 deletions llvm/test/CodeGen/SPIRV/basic_int_types.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s

define void @main() {
entry:
; CHECK-DAG: %[[#short:]] = OpTypeInt 16 0
; CHECK-DAG: %[[#int:]] = OpTypeInt 32 0
; CHECK-DAG: %[[#long:]] = OpTypeInt 64 0

; CHECK-DAG: %[[#v2short:]] = OpTypeVector %[[#short]] 2
; CHECK-DAG: %[[#v3short:]] = OpTypeVector %[[#short]] 3
; CHECK-DAG: %[[#v4short:]] = OpTypeVector %[[#short]] 4

; CHECK-DAG: %[[#v2int:]] = OpTypeVector %[[#int]] 2
; CHECK-DAG: %[[#v3int:]] = OpTypeVector %[[#int]] 3
; CHECK-DAG: %[[#v4int:]] = OpTypeVector %[[#int]] 4

; CHECK-DAG: %[[#v2long:]] = OpTypeVector %[[#long]] 2
; CHECK-DAG: %[[#v3long:]] = OpTypeVector %[[#long]] 3
; CHECK-DAG: %[[#v4long:]] = OpTypeVector %[[#long]] 4

; CHECK-DAG: %[[#ptr_Function_short:]] = OpTypePointer Function %[[#short]]
; CHECK-DAG: %[[#ptr_Function_int:]] = OpTypePointer Function %[[#int]]
; CHECK-DAG: %[[#ptr_Function_long:]] = OpTypePointer Function %[[#long]]
; CHECK-DAG: %[[#ptr_Function_v2short:]] = OpTypePointer Function %[[#v2short]]
; CHECK-DAG: %[[#ptr_Function_v3short:]] = OpTypePointer Function %[[#v3short]]
; CHECK-DAG: %[[#ptr_Function_v4short:]] = OpTypePointer Function %[[#v4short]]
; CHECK-DAG: %[[#ptr_Function_v2int:]] = OpTypePointer Function %[[#v2int]]
; CHECK-DAG: %[[#ptr_Function_v3int:]] = OpTypePointer Function %[[#v3int]]
; CHECK-DAG: %[[#ptr_Function_v4int:]] = OpTypePointer Function %[[#v4int]]
; CHECK-DAG: %[[#ptr_Function_v2long:]] = OpTypePointer Function %[[#v2long]]
; CHECK-DAG: %[[#ptr_Function_v3long:]] = OpTypePointer Function %[[#v3long]]
; CHECK-DAG: %[[#ptr_Function_v4long:]] = OpTypePointer Function %[[#v4long]]

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_short]] Function
%int16_t_Val = alloca i16, align 2

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_int]] Function
%int_Val = alloca i32, align 4

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_long]] Function
%int64_t_Val = alloca i64, align 8

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v2short]] Function
%int16_t2_Val = alloca <2 x i16>, align 4

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v3short]] Function
%int16_t3_Val = alloca <3 x i16>, align 8

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v4short]] Function
%int16_t4_Val = alloca <4 x i16>, align 8

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v2int]] Function
%int2_Val = alloca <2 x i32>, align 8

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v3int]] Function
%int3_Val = alloca <3 x i32>, align 16

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v4int]] Function
%int4_Val = alloca <4 x i32>, align 16

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v2long]] Function
%int64_t2_Val = alloca <2 x i64>, align 16

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v3long]] Function
%int64_t3_Val = alloca <3 x i64>, align 32

; CHECK: %[[#]] = OpVariable %[[#ptr_Function_v4long]] Function
%int64_t4_Val = alloca <4 x i64>, align 32

ret void
}