Skip to content

Commit

Permalink
Test more cases with SPV_KHR_untyped_pointers (#2821)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmaksimo authored Nov 4, 2024
1 parent 8e65158 commit caa1abc
Show file tree
Hide file tree
Showing 21 changed files with 243 additions and 63 deletions.
9 changes: 7 additions & 2 deletions test/EnqueueEmptyKernel.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
;; ^(){});
;; }
; RUN: llvm-as < %s > %t.bc
; RUN: llvm-spirv %t.bc -o - -spirv-text | FileCheck %s --check-prefix=CHECK-SPIRV
; RUN: llvm-spirv %t.bc -o - -spirv-text | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-TYPED-PTR
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: spirv-val %t.spv

; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o - -spirv-text | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-UNTYPED-PTR
; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o %t.spv
; RUN: spirv-val %t.spv

target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
target triple = "spir64-unknown-unknown"

Expand All @@ -29,7 +33,8 @@ target triple = "spir64-unknown-unknown"
; CHECK-SPIRV: Name [[Block:[0-9]+]] "__block_literal_global"
; CHECK-SPIRV: TypeInt [[Int8:[0-9]+]] 8
; CHECK-SPIRV: TypeVoid [[Void:[0-9]+]]
; CHECK-SPIRV: TypePointer [[Int8PtrGen:[0-9]+]] 8 [[Int8]]
; CHECK-SPIRV-TYPED-PTR: TypePointer [[Int8PtrGen:[0-9]+]] 8 [[Int8]]
; CHECK-SPIRV-UNTYPED-PTR: TypeUntypedPointerKHR [[Int8PtrGen:[0-9]+]] 8
; CHECK-SPIRV: Variable {{[0-9]+}} [[Block:[0-9]+]]

; Function Attrs: convergent nounwind
Expand Down
18 changes: 13 additions & 5 deletions test/SpecConstants/spec-constant-length-array.ll
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv -spirv-text -o - %t.bc | FileCheck %s --check-prefix CHECK-SPV
; RUN: llvm-spirv -spirv-text -o - %t.bc | FileCheck %s --check-prefixes=CHECK-SPV,CHECK-SPV-TYPED-PTR
; RUN: llvm-spirv -o %t.spv %t.bc
; RUN: spirv-val %t.spv
; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s --check-prefix CHECK-LLVM

; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers -spirv-text -o - %t.bc | FileCheck %s --check-prefixes=CHECK-SPV,CHECK-SPV-UNTYPED-PTR
; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers -o %t.spv %t.bc
; RUN: spirv-val %t.spv
; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s --check-prefix CHECK-LLVM

; CHECK-SPV-DAG: Decorate [[#I64_CONST:]] SpecId [[#]]
; CHECK-SPV-DAG: Decorate [[#I32_CONST:]] SpecId [[#]]
; CHECK-SPV-DAG: Decorate [[#I8_CONST:]] SpecId [[#]]
Expand All @@ -20,10 +25,11 @@
; CHECK-SPV-DAG: SpecConstant [[#I8_TY]] [[#LENGTH_2:]]

; CHECK-SPV-DAG: TypeFloat [[#FLOAT_TY:]] 32
; CHECK-SPV-DAG: TypePointer [[#FLOAT_PTR_TY:]] [[#FUNCTION_SC:]] [[#FLOAT_TY]]
; CHECK-SPV-TYPED-PTR-DAG: TypePointer [[#FLOAT_PTR_TY:]] [[#FUNCTION_SC:]] [[#FLOAT_TY]]
; CHECK-SPV-UNTYPED-PTR-DAG: TypeUntypedPointerKHR [[#PTR_TY:]] [[#FUNCTION_SC:]]
; CHECK-SPV-DAG: TypeArray [[#ARR_TY_0:]] [[#FLOAT_TY]] [[#LENGTH_0]]
; CHECK-SPV-DAG: TypePointer [[#ARR_PTR_TY_0:]] [[#FUNCTION_SC]] [[#ARR_TY_0]]
; CHECK-SPV-DAG: TypePointer [[#I8_PTR_TY:]] [[#FUNCTION_SC]] [[#I8_TY]]
; CHECK-SPV-TYPED-PTR-DAG: TypePointer [[#I8_PTR_TY:]] [[#FUNCTION_SC]] [[#I8_TY]]
; CHECK-SPV-DAG: TypeArray [[#ARR_TY_1:]] [[#I8_TY]] [[#LENGTH_1]]
; CHECK-SPV-DAG: TypePointer [[#ARR_PTR_TY_1:]] [[#FUNCTION_SC]] [[#ARR_TY_1]]
; CHECK-SPV-DAG: TypeFloat [[#DOUBLE_TY:]] 64
Expand Down Expand Up @@ -51,12 +57,14 @@ define spir_kernel void @test() {
; CHECK-LLVM: %[[ALLOCA1:.*]] = alloca [2 x i8], align 2
; CHECK-LLVM: %[[ALLOCA2:.*]] = alloca [4 x %struct_type], align 16

; CHECK-SPV: Bitcast [[#FLOAT_PTR_TY]] [[#]] [[#SCLA_0]]
; CHECK-SPV-TYPED-PTR: Bitcast [[#FLOAT_PTR_TY]] [[#]] [[#SCLA_0]]
; CHECK-SPV-UNTYPED-PTR: Bitcast [[#PTR_TY]] [[#]] [[#SCLA_0]]

; CHECK-LLVM: %[[VAR0:.*]] = bitcast ptr %[[ALLOCA0]] to ptr
%scla0 = alloca float, i64 %length0, align 4

; CHECK-SPV: Bitcast [[#I8_PTR_TY]] [[#]] [[#SCLA_1]]
; CHECK-SPV-TYPED-PTR: Bitcast [[#I8_PTR_TY]] [[#]] [[#SCLA_1]]
; CHECK-SPV-UNTYPED-PTR: Bitcast [[#PTR_TY]] [[#]] [[#SCLA_1]]

; CHECK-LLVM: %[[VAR1:.*]] = bitcast ptr %[[ALLOCA1]] to ptr
%scla1 = alloca i8, i32 %length1, align 2
Expand Down
7 changes: 6 additions & 1 deletion test/array-alloca.ll
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
; Roundtrip test.
; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM

; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+SPV_KHR_untyped_pointers
; RUN: spirv-val %t.spv
; RUN: llvm-spirv %t.bc -spirv-text --spirv-ext=+SPV_KHR_untyped_pointers -o - | FileCheck %s --check-prefix=CHECK-SPIRV
; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o - | FileCheck %s --check-prefix=CHECK-LLVM

target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir64-unknown-unknown"

Expand All @@ -21,7 +26,7 @@ target triple = "spir64-unknown-unknown"
; CHECK-SPIRV: Constant [[#I64]] [[#SIZE:]] 4 0
; CHECK-SPIRV: TypeVoid [[#VOID:]]
; CHECK-SPIRV: TypeFunction [[#FUNCTY:]] [[#VOID]]
; CHECK-SPIRV: TypePointer [[#PTRTY:]] [[#FUNCSTORAGE:]] [[#I32]]
; CHECK-SPIRV: {{(TypePointer|TypeUntypedPointerKHR)}} [[#PTRTY:]] [[#FUNCSTORAGE:]]
; CHECK-SPIRV: TypeArray [[#ARRTY:]] [[#I32]] [[#SIZE]]
; CHECK-SPIRV: TypePointer [[#ARRPTRTY:]] [[#FUNCSTORAGE]] [[#ARRTY]]

Expand Down
19 changes: 15 additions & 4 deletions test/entry-point-interfaces.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: spirv-val --target-env spv1.4 %t.spv
; RUN: llvm-spirv -to-text %t.spv -o %t.from.spv.spt
; RUN: FileCheck < %t.from.spv.spt %s --check-prefix=CHECK-SPIRV
; RUN: FileCheck < %t.from.spv.spt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-TYPED-PTR

; RUN: llvm-spirv -spirv-text %t.bc -o %t.from.bc.spt
; RUN: FileCheck < %t.from.bc.spt %s --check-prefix=CHECK-SPIRV
; RUN: FileCheck < %t.from.bc.spt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-TYPED-PTR

; Check the same with untyped pointers enabled
; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o %t.spv
; RUN: spirv-val --target-env spv1.4 %t.spv
; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers -to-text %t.spv -o %t.from.spv.spt
; RUN: FileCheck < %t.from.spv.spt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-UNTYPED-PTR

; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers -spirv-text %t.bc -o %t.from.bc.spt
; RUN: FileCheck < %t.from.bc.spt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-UNTYPED-PTR

; CHECK-SPIRV: 7 EntryPoint 6 [[#]] "test" [[#Interface1:]] [[#Interface2:]]
; CHECK-SPIRV: TypeInt [[#TypeInt:]] 32 0
; CHECK-SPIRV: Constant [[#TypeInt]] [[#Constant1:]] 1
; CHECK-SPIRV: Constant [[#TypeInt]] [[#Constant2:]] 3
; CHECK-SPIRV: Variable [[#]] [[#Interface1]] 0 [[#Constant1]]
; CHECK-SPIRV: Variable [[#]] [[#Interface2]] 0 [[#Constant2]]
; CHECK-SPIRV-TYPED-PTR: Variable [[#]] [[#Interface1]] 0 [[#Constant1]]
; CHECK-SPIRV-TYPED-PTR: Variable [[#]] [[#Interface2]] 0 [[#Constant2]]
; CHECK-SPIRV-UNTYPED-PTR: UntypedVariableKHR [[#]] [[#Interface1]] 0 [[#TypeInt]] [[#Constant1]]
; CHECK-SPIRV-UNTYPED-PTR: UntypedVariableKHR [[#]] [[#Interface2]] 0 [[#TypeInt]] [[#Constant2]]

; ModuleID = 'source.cpp'
source_filename = "source.cpp"
Expand Down
27 changes: 19 additions & 8 deletions test/layout.ll
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -spirv-text -o %t
; RUN: FileCheck < %t %s
; RUN: FileCheck < %t %s --check-prefixes=CHECK,CHECK-TYPED-PTR
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: spirv-val %t.spv

; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -spirv-text -o %t
; RUN: FileCheck < %t %s --check-prefixes=CHECK,CHECK-UNTYPED-PTR
; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o %t.spv
; TODO: enable back once we support untyped ptr access chaing instructions as spec constant operand
; R/UN: spirv-val %t.spv

; CHECK: 119734787 {{[0-9]*}} {{[0-9]*}} {{[0-9]*}} 0
; CHECK-NEXT: {{[0-9]*}} Capability
; CHECK: {{[0-9]*}} ExtInstImport
Expand Down Expand Up @@ -48,23 +54,28 @@
; CHECK: {{[0-9]*}} Constant [[TypeInt32]] [[Int32Two:[0-9]+]] 2
; CHECK: {{[0-9]*}} TypeArray [[TypeArrayInt32:[0-9]+]] [[TypeInt32]] [[Int32Two]]
; CHECK: {{[0-9]*}} TypePointer [[TypePtr5ArrayInt32:[0-9]+]] 5 [[TypeArrayInt32]]
; CHECK: {{[0-9]*}} TypePointer [[TypePtr5Int32:[0-9]+]] 5 [[TypeInt32]]
; CHECK: {{[0-9]*}} TypePointer [[TypePtr5Ptr5Int32:[0-9]+]] 5 [[TypePtr5Int32]]
; CHECK-TYPED-PTR: {{[0-9]*}} TypePointer [[TypePtr5Int32:[0-9]+]] 5 [[TypeInt32]]
; CHECK-TYPED-PTR: {{[0-9]*}} TypePointer [[TypePtr5Ptr5Int32:[0-9]+]] 5 [[TypePtr5Int32]]
; CHECK-UNTYPED-PTR: {{[0-9]*}} TypeUntypedPointerKHR [[Ptr:[0-9]+]] 5
; CHECK: {{[0-9]*}} TypeFloat [[TypeFloat:[0-9]+]]
; CHECK: {{[0-9]*}} TypeArray [[TypeArrayFloat:[0-9]+]] [[TypeFloat]] [[Int32Two]]
; CHECK: {{[0-9]*}} TypePointer [[TypePtr8ArrayFloat:[0-9]+]] 0 [[TypeArrayFloat]]
; CHECK: {{[0-9]*}} TypeVector [[TypeVectorInt32:[0-9]+]] [[TypeInt32]] 3
; CHECK: {{[0-9]*}} TypePointer [[TypePtr8VectorInt32:[0-9]+]] 0 [[TypeVectorInt32]]
; CHECK: {{[0-9]*}} TypePointer [[TypePtr0Int8:[0-9]+]] 8 [[TypeInt8]]
; CHECK-TYPED-PTR: {{[0-9]*}} TypePointer [[TypePtr0Int8:[0-9]+]] 8 [[TypeInt8]]
; CHECK-UNTYPED-PTR: {{[0-9]*}} TypeUntypedPointerKHR [[TypePtr0Int8:[0-9]+]] 8
; CHECK: {{[0-9]*}} TypeStruct [[BID:[0-9]+]] {{[0-9]+}} [[TypePtr0Int8]]
; CHECK: {{[0-9]*}} TypeStruct [[CID:[0-9]+]] {{[0-9]+}} [[BID]]
; CHECK: {{[0-9]*}} TypeStruct [[AID:[0-9]+]] {{[0-9]+}} [[CID]]
; CHECK: {{[0-9]*}} TypeVoid [[Void:[0-9]+]]
; CHECK: {{[0-9]*}} TypePointer [[TypePtr5Int8:[0-9]+]] 5 [[TypeInt8]]
; CHECK: {{[0-9]*}} TypeFunction [[TypeBar1:[0-9]+]] [[Void]] [[TypePtr5Int8]]
; CHECK-TYPED-PTR: {{[0-9]*}} TypePointer [[TypePtr5Int8:[0-9]+]] 5 [[TypeInt8]]
; CHECK-TYPED-PTR: {{[0-9]*}} TypeFunction [[TypeBar1:[0-9]+]] [[Void]] [[TypePtr5Int8]]
; CHECK-UNTYPED-PTR: {{[0-9]*}} TypeFunction [[TypeBar1:[0-9]+]] [[Void]] [[Ptr]]
; CHECK: {{[0-9]*}} Variable [[TypePtr5ArrayInt32]] [[Var:[0-9]+]]
; CHECK: {{[0-9]*}} SpecConstantOp [[TypePtr5Int32]] [[SConstOp:[0-9]+]] 70 [[Var]]
; CHECK: {{[0-9]*}} Variable {{[0-9]+}} {{[0-9]+}} 5 [[SConstOp]]
; CHECK-TYPED-PTR: {{[0-9]*}} SpecConstantOp [[TypePtr5Int32]] [[SConstOp:[0-9]+]] 70 [[Var]]
; CHECK-UNTYPED-PTR: {{[0-9]*}} SpecConstantOp [[Ptr]] [[SConstOp:[0-9]+]] 4424 [[TypeArrayInt32]] [[Var]]
; CHECK-TYPED-PTR: {{[0-9]*}} Variable {{[0-9]+}} {{[0-9]+}} 5 [[SConstOp]]
; CHECK-UNTYPED-PTR: {{[0-9]*}} UntypedVariableKHR {{[0-9]+}} {{[0-9]+}} 5 [[Ptr]] [[SConstOp]]

; CHECK-NOT: {{[0-9]*}} Capability
; CHECK-NOT: {{[0-9]*}} ExtInstImport
Expand Down
8 changes: 7 additions & 1 deletion test/link-attribute.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
; RUN: FileCheck < %t %s
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: spirv-val %t.spv

; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -spirv-text -o %t
; RUN: FileCheck < %t %s
; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o %t.spv
; RUN: spirv-val %t.spv

target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir64-unknown-unknown"


; CHECK: 8 Decorate [[ID:[0-9]*]] LinkageAttributes "imageSampler" Export
; CHECK: 5 Variable {{[0-9]*}} [[ID]] 0 {{[0-9]*}}
; CHECK: {{Variable|UntypedVariableKHR}} {{[0-9]*}} [[ID]] 0 {{[0-9]*}}

@imageSampler = addrspace(2) constant i32 36, align 4

Expand Down
18 changes: 14 additions & 4 deletions test/llvm-intrinsics/memmove.ll
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt
; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV
; RUN: FileCheck < %t.txt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-TYPED-PTR
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: spirv-val %t.spv
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM

; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt --spirv-ext=+SPV_KHR_untyped_pointers
; RUN: FileCheck < %t.txt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-UNTYPED-PTR
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+SPV_KHR_untyped_pointers
; RUN: spirv-val %t.spv
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM

; CHECK-SPIRV-NOT: llvm.memmove

; CHECK-SPIRV-DAG: TypeInt [[#TYPEINT:]] 32
Expand All @@ -14,9 +21,12 @@
; CHECK-SPIRV-DAG: Constant [[#TYPEINT]] [[#C68:]] 68
; CHECK-SPIRV-DAG: Constant [[#TYPEINT]] [[#C72:]] 72
; CHECK-SPIRV-DAG: Constant [[#TYPEINT]] [[#C32:]] 32
; CHECK-SPIRV-DAG: TypePointer [[#I8GLOBAL_PTR:]] 5 [[#I8]]
; CHECK-SPIRV-DAG: TypePointer [[#I8PRIVATE_PTR:]] 7 [[#I8]]
; CHECK-SPIRV-DAG: TypePointer [[#I8GENERIC_PTR:]] 8 [[#I8]]
; CHECK-SPIRV-TYPED-PTR-DAG: TypePointer [[#I8GLOBAL_PTR:]] 5 [[#I8]]
; CHECK-SPIRV-TYPED-PTR-DAG: TypePointer [[#I8PRIVATE_PTR:]] 7 [[#I8]]
; CHECK-SPIRV-TYPED-PTR-DAG: TypePointer [[#I8GENERIC_PTR:]] 8 [[#I8]]
; CHECK-SPIRV-UNTYPED-PTR-DAG: TypeUntypedPointerKHR [[#I8GLOBAL_PTR:]] 5
; CHECK-SPIRV-UNTYPED-PTR-DAG: TypeUntypedPointerKHR [[#I8PRIVATE_PTR:]] 7
; CHECK-SPIRV-UNTYPED-PTR-DAG: TypeUntypedPointerKHR [[#I8GENERIC_PTR:]] 8

; CHECK-SPIRV-LABEL: [[#]] Function [[#]]
; CHECK-SPIRV: FunctionParameter [[#I8GLOBAL_PTR]] [[#ARG_IN:]]
Expand Down
17 changes: 13 additions & 4 deletions test/llvm-intrinsics/memset-opaque.ll
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -spirv-text -o %t.spt
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
; RUN: FileCheck < %t.spt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-TYPED-PTR
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: spirv-val %t.spv
; RUN: llvm-spirv -r %t.spv -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-LLVM-OPAQUE

; RUN: llvm-spirv %t.bc -spirv-text -o %t.spt --spirv-ext=+SPV_KHR_untyped_pointers
; RUN: FileCheck < %t.spt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-UNTYPED-PTR
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+SPV_KHR_untyped_pointers
; RUN: spirv-val %t.spv
; RUN: llvm-spirv -r %t.spv -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-LLVM-OPAQUE

; CHECK-SPIRV: Decorate [[#NonConstMemset:]] LinkageAttributes "spirv.llvm_memset_p3_i32"
; CHECK-SPIRV: TypeInt [[Int8:[0-9]+]] 8 0
; CHECK-SPIRV: Constant {{[0-9]+}} [[Lenmemset21:[0-9]+]] 4
; CHECK-SPIRV: Constant {{[0-9]+}} [[Lenmemset0:[0-9]+]] 12
; CHECK-SPIRV: Constant {{[0-9]+}} [[Const21:[0-9]+]] 21
; CHECK-SPIRV: TypeArray [[Int8x4:[0-9]+]] [[Int8]] [[Lenmemset21]]
; CHECK-SPIRV: TypePointer [[Int8Ptr:[0-9]+]] 8 [[Int8]]
; CHECK-SPIRV-TYPED-PTR: TypePointer [[Int8Ptr:[0-9]+]] 8 [[Int8]]
; CHECK-SPIRV-UNTYPED-PTR: TypeUntypedPointerKHR [[Int8Ptr:[0-9]+]] 8
; CHECK-SPIRV: TypeArray [[Int8x12:[0-9]+]] [[Int8]] [[Lenmemset0]]
; CHECK-SPIRV: TypePointer [[Int8PtrConst:[0-9]+]] 0 [[Int8]]
; CHECK-SPIRV-TYPED-PTR: TypePointer [[Int8PtrConst:[0-9]+]] 0 [[Int8]]
; CHECK-SPIRV-UNTYPED-PTR: TypeUntypedPointerKHR [[Int8PtrConst:[0-9]+]] 0

; CHECK-SPIRV: ConstantNull [[Int8x12]] [[Init:[0-9]+]]
; CHECK-SPIRV: Variable {{[0-9]+}} [[Val:[0-9]+]] 0 [[Init]]
Expand Down Expand Up @@ -43,7 +51,8 @@
; CHECK-SPIRV: Label [[#WhileBody]]
; CHECK-SPIRV: Phi [[#]] [[#Offset:]] [[#Zero]] [[#Entry]] [[#OffsetInc:]] [[#WhileBody]]
; CHECK-SPIRV: Bitcast [[#]] [[#DestU8:]] [[#Dest]]
; CHECK-SPIRV: InBoundsPtrAccessChain [[#]] [[#Ptr:]] [[#DestU8]] [[#Offset]]
; CHECK-SPIRV-TYPED-PTR: InBoundsPtrAccessChain [[#]] [[#Ptr:]] [[#DestU8]] [[#Offset]]
; CHECK-SPIRV-UNTYPED-PTR: UntypedInBoundsPtrAccessChainKHR [[#]] [[#Ptr:]] [[Int8]] [[#DestU8]] [[#Offset]]
; CHECK-SPIRV: Store [[#Ptr]] [[#Value]] 2 1
; CHECK-SPIRV: IAdd [[#]] [[#OffsetInc]] [[#Offset]] [[#One:]]
; CHECK-SPIRV: ULessThan [[#]] [[#NotEnd:]] [[#OffsetInc]] [[#Len]]
Expand Down
18 changes: 15 additions & 3 deletions test/long-type-struct.ll
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_long_constant_composite %t.bc -o %t.spv
; RUN: llvm-spirv %t.spv --to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
; RUN: llvm-spirv %t.spv --to-text -o - | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-TYPED-PTR
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_long_constant_composite -spirv-text %t.rev.bc -o %t2.spt
; RUN: FileCheck --input-file=%t2.spt %s --check-prefix=CHECK-SPIRV
; RUN: FileCheck --input-file=%t2.spt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-TYPED-PTR
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
; TODO: run validator once it supports the extension
; RUNx: spirv-val %t.spv

; RUN: not llvm-spirv %t.bc -o %t.spv 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR

; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_long_constant_composite,+SPV_KHR_untyped_pointers %t.bc -o %t.spv
; RUN: llvm-spirv %t.spv --to-text -o - | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-UNTYPED-PTR
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-spirv --spirv-ext=+SPV_INTEL_long_constant_composite,+SPV_KHR_untyped_pointers -spirv-text %t.rev.bc -o %t2.spt
; RUN: FileCheck --input-file=%t2.spt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-UNTYPED-PTR
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
; TODO: run validator once it supports the extension
; RUNx: spirv-val %t.spv
Expand All @@ -13,7 +24,8 @@
; CHECK-SPIRV: Capability LongCompositesINTEL
; CHECK-SPIRV: Extension "SPV_INTEL_long_constant_composite"
; CHECK-SPIRV: TypeInt [[TInt:[0-9]+]] 8
; CHECK-SPIRV: TypePointer [[TIntPtr:[0-9]+]] 8 [[TInt]]
; CHECK-SPIRV-TYPED-PTR: TypePointer [[TIntPtr:[0-9]+]] 8 [[TInt]]
; CHECK-SPIRV-UNTYPED-PTR: TypeUntypedPointerKHR [[TIntPtr:[0-9]+]] 8
; CHECK-SPIRV: TypeArray [[TArr:[0-9]+]]
; CHECK-SPIRV: 65535 TypeStruct [[TStruct:[0-9]+]] [[TIntPtr]] [[TIntPtr]] [[TArr]] [[TInt]] [[TInt]] [[TInt]]
; CHECK-SPIRV-NEXT: 10 TypeStructContinuedINTEL [[TInt]] [[TInt]] [[TInt]]
Expand Down
12 changes: 10 additions & 2 deletions test/spirv_global_variable_decoration.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM

; RUN: llvm-spirv %t.bc -spirv-text --spirv-ext=+SPV_KHR_untyped_pointers -o - | FileCheck %s --check-prefix=CHECK-SPIRV
; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_KHR_untyped_pointers -o %t.spv
; RUN: spirv-val %t.spv
; RUN: llvm-spirv -r %t.spv --spirv-target-env=SPV-IR -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-SPV-IR
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM

target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir"

Expand All @@ -15,8 +23,8 @@ target triple = "spir"
; CHECK-SPIRV: Decorate [[PId1:[0-9]+]] Constant
; CHECK-SPIRV: Decorate [[PId2:[0-9]+]] Constant
; CHECK-SPIRV: Decorate [[PId2]] Binding 1
; CHECK-SPIRV: Variable {{[0-9]+}} [[PId1]]
; CHECK-SPIRV: Variable {{[0-9]+}} [[PId2]]
; CHECK-SPIRV: {{(Variable|UntypedVariableKHR)}} {{[0-9]+}} [[PId1]]
; CHECK-SPIRV: {{(Variable|UntypedVariableKHR)}} {{[0-9]+}} [[PId2]]

!1 = !{i32 22}
!2 = !{!1}
Expand Down
12 changes: 9 additions & 3 deletions test/transcoding/CreatePipeFromPipeStorage.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt
; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV
; RUN: FileCheck < %t.txt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-TYPED-PTR
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: llvm-spirv -r --spirv-target-env=SPV-IR %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-SPV-IR

; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+SPV_KHR_untyped_pointers
; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt --spirv-ext=+SPV_KHR_untyped_pointers
; RUN: FileCheck < %t.txt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-UNTYPED-PTR
; RUN: llvm-spirv -r --spirv-target-env=SPV-IR %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-SPV-IR


; CHECK-SPV-IR: %"[[CL_PIPE_STORAGE_NAME:[^"]+]]" = type { ptr addrspace(1) }
; CHECK-SPV-IR: %"[[CL_READ_PIPE_NAME:[^"]+read>]]" = type { target("spirv.Pipe", 0) }
Expand Down Expand Up @@ -61,8 +67,8 @@ entry:
; CHECK-SPV-IR: %[[ID1:[0-9]+]] = getelementptr %"[[CL_PIPE_STORAGE_NAME]]", ptr addrspace(4) %[[ID0]], i32 0, i32 0

; CHECK-SPIRV: PtrCastToGeneric {{[0-9]+}} [[SPIRV0:[0-9]+]] [[PIPE_STORAGE_ID]]
; CHECK-SPIRV: PtrAccessChain {{[0-9]+}} [[SPIRV1:[0-9]+]] [[SPIRV0]] [[CONSTANT_ZERO_ID]] [[CONSTANT_ZERO_ID]]

; CHECK-SPIRV-TYPED-PTR: PtrAccessChain {{[0-9]+}} [[SPIRV1:[0-9]+]] [[SPIRV0]] [[CONSTANT_ZERO_ID]] [[CONSTANT_ZERO_ID]]
; CHECK-SPIRV-UNTYPED-PTR: UntypedPtrAccessChainKHR {{[0-9]+}} [[SPIRV1:[0-9]+]] [[#]] [[SPIRV0]] [[CONSTANT_ZERO_ID]] [[CONSTANT_ZERO_ID]]
%0 = addrspacecast ptr addrspace(1) @mygpipe to ptr addrspace(4)
%1 = getelementptr %"class.cl::pipe_storage<int __attribute__((ext_vector_type(4))), 1>", ptr addrspace(4) %0, i32 0, i32 0

Expand Down
Loading

0 comments on commit caa1abc

Please sign in to comment.