From caa1abcda8a91de15c68003b88ec43dc1d234f8a Mon Sep 17 00:00:00 2001 From: Viktoria Maximova Date: Mon, 4 Nov 2024 12:09:31 +0100 Subject: [PATCH] Test more cases with SPV_KHR_untyped_pointers (#2821) --- test/EnqueueEmptyKernel.ll | 9 +++++-- .../spec-constant-length-array.ll | 18 +++++++++---- test/array-alloca.ll | 7 ++++- test/entry-point-interfaces.ll | 19 ++++++++++--- test/layout.ll | 27 +++++++++++++------ test/link-attribute.ll | 8 +++++- test/llvm-intrinsics/memmove.ll | 18 ++++++++++--- test/llvm-intrinsics/memset-opaque.ll | 17 +++++++++--- test/long-type-struct.ll | 18 ++++++++++--- test/spirv_global_variable_decoration.ll | 12 +++++++-- test/transcoding/CreatePipeFromPipeStorage.ll | 12 ++++++--- test/transcoding/DecorationMaxByteOffset.ll | 13 +++++++-- test/transcoding/builtin_calls.ll | 12 +++++++-- test/transcoding/builtin_vars.ll | 13 ++++++++- test/transcoding/constant-vars.ll | 21 +++++++++++---- .../transcoding/global-constant-expression.ll | 8 ++++-- test/transcoding/kernel_query.ll | 12 +++++++-- .../multiple_user_semantic_nonopaque.ll | 15 +++++++++-- .../multiple_user_semantic_on_struct.ll | 23 +++++++++++----- test/transcoding/ptr_not_equal.ll | 15 ++++++++--- test/transcoding/undef-gv.ll | 9 ++++++- 21 files changed, 243 insertions(+), 63 deletions(-) diff --git a/test/EnqueueEmptyKernel.ll b/test/EnqueueEmptyKernel.ll index dc33c6bfc..bf85cd9fd 100644 --- a/test/EnqueueEmptyKernel.ll +++ b/test/EnqueueEmptyKernel.ll @@ -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" @@ -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 diff --git a/test/SpecConstants/spec-constant-length-array.ll b/test/SpecConstants/spec-constant-length-array.ll index a88b2b8cb..19987112b 100644 --- a/test/SpecConstants/spec-constant-length-array.ll +++ b/test/SpecConstants/spec-constant-length-array.ll @@ -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 [[#]] @@ -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 @@ -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 diff --git a/test/array-alloca.ll b/test/array-alloca.ll index a9b96c8f5..0e0daf335 100644 --- a/test/array-alloca.ll +++ b/test/array-alloca.ll @@ -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" @@ -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]] diff --git a/test/entry-point-interfaces.ll b/test/entry-point-interfaces.ll index a3e225016..2efcae8cc 100644 --- a/test/entry-point-interfaces.ll +++ b/test/entry-point-interfaces.ll @@ -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" diff --git a/test/layout.ll b/test/layout.ll index dc59ed639..3c66b85d5 100644 --- a/test/layout.ll +++ b/test/layout.ll @@ -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 @@ -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 diff --git a/test/link-attribute.ll b/test/link-attribute.ll index d67e77258..5d258096d 100644 --- a/test/link-attribute.ll +++ b/test/link-attribute.ll @@ -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 diff --git a/test/llvm-intrinsics/memmove.ll b/test/llvm-intrinsics/memmove.ll index 41bd04ecb..21472a2e4 100644 --- a/test/llvm-intrinsics/memmove.ll +++ b/test/llvm-intrinsics/memmove.ll @@ -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 @@ -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:]] diff --git a/test/llvm-intrinsics/memset-opaque.ll b/test/llvm-intrinsics/memset-opaque.ll index f9c731372..d650ad454 100644 --- a/test/llvm-intrinsics/memset-opaque.ll +++ b/test/llvm-intrinsics/memset-opaque.ll @@ -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]] @@ -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]] diff --git a/test/long-type-struct.ll b/test/long-type-struct.ll index 90c3a3f7b..47fe4f368 100644 --- a/test/long-type-struct.ll +++ b/test/long-type-struct.ll @@ -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 @@ -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]] diff --git a/test/spirv_global_variable_decoration.ll b/test/spirv_global_variable_decoration.ll index a0212bf52..73efc6bf0 100644 --- a/test/spirv_global_variable_decoration.ll +++ b/test/spirv_global_variable_decoration.ll @@ -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" @@ -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} diff --git a/test/transcoding/CreatePipeFromPipeStorage.ll b/test/transcoding/CreatePipeFromPipeStorage.ll index ea780cf7d..0434795b5 100644 --- a/test/transcoding/CreatePipeFromPipeStorage.ll +++ b/test/transcoding/CreatePipeFromPipeStorage.ll @@ -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) } @@ -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", ptr addrspace(4) %0, i32 0, i32 0 diff --git a/test/transcoding/DecorationMaxByteOffset.ll b/test/transcoding/DecorationMaxByteOffset.ll index e70d96aa5..5d518f74c 100644 --- a/test/transcoding/DecorationMaxByteOffset.ll +++ b/test/transcoding/DecorationMaxByteOffset.ll @@ -1,11 +1,19 @@ ; 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 %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-max-version=1.0 -o - | FileCheck %s --check-prefix=CHECK-SPIRV_1_0 +; 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: 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-max-version=1.0 --spirv-ext=+SPV_KHR_untyped_pointers -o - | FileCheck %s --check-prefix=CHECK-SPIRV_1_0 + + ; CHECK-LLVM: define spir_kernel void @worker(ptr addrspace(3) dereferenceable(12) %ptr) ; CHECK-LLVM: define spir_func void @not_a_kernel(ptr addrspace(3) dereferenceable(123) %ptr2) @@ -14,7 +22,8 @@ ; CHECK-SPIRV-DAG: 4 Decorate [[PTR_ID]] MaxByteOffset 12 ; CHECK-SPIRV-DAG: 4 Decorate [[PTR2_ID]] MaxByteOffset 123 ; CHECK-SPIRV: 4 TypeInt [[CHAR_T:[0-9]+]] 8 0 -; CHECK-SPIRV: 4 TypePointer [[CHAR_PTR_T:[0-9]+]] 4 [[CHAR_T]] +; CHECK-SPIRV-TYPED-PTR: 4 TypePointer [[CHAR_PTR_T:[0-9]+]] 4 [[CHAR_T]] +; CHECK-SPIRV-UNTYPED-PTR: 3 TypeUntypedPointerKHR [[CHAR_PTR_T:[0-9]+]] 4 ; CHECK-SPIRV: 3 FunctionParameter [[CHAR_PTR_T]] [[PTR_ID]] ; CHECK-SPIRV: 3 FunctionParameter [[CHAR_PTR_T]] [[PTR2_ID]] diff --git a/test/transcoding/builtin_calls.ll b/test/transcoding/builtin_calls.ll index 1fac86326..17cec7f34 100644 --- a/test/transcoding/builtin_calls.ll +++ b/test/transcoding/builtin_calls.ll @@ -7,14 +7,22 @@ ; RUN: llvm-spirv -r %t.spv --spirv-target-env=SPV-IR -o %t.out.bc ; RUN: llvm-dis %t.out.bc -o - | FileCheck %s --check-prefix=CHECK-SPV-IR +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o %t.spv +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers -spirv-text %t.bc -o - | FileCheck %s --check-prefix=CHECK-SPIRV +; RUN: spirv-val %t.spv +; RUN: llvm-spirv -r %t.spv -o %t.out.bc +; RUN: llvm-dis %t.out.bc -o - | FileCheck %s --check-prefix=CHECK-OCL-IR +; RUN: llvm-spirv -r %t.spv --spirv-target-env=SPV-IR -o %t.out.bc +; RUN: llvm-dis %t.out.bc -o - | FileCheck %s --check-prefix=CHECK-SPV-IR + 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-unknown-unknown" ; Check that builtin-call based SPV-IR is recognized by the translator. ; CHECK-SPIRV-DAG: Decorate [[Id:[0-9]+]] BuiltIn 28 ; CHECK-SPIRV-DAG: Decorate [[Id:[0-9]+]] BuiltIn 34 -; CHECK-SPIRV: Variable {{[0-9]+}} [[Id:[0-9]+]] -; CHECK-SPIRV: Variable {{[0-9]+}} [[Id:[0-9]+]] +; CHECK-SPIRV: {{(Variable|UntypedVariableKHR)}} {{[0-9]+}} [[Id:[0-9]+]] +; CHECK-SPIRV: {{(Variable|UntypedVariableKHR)}} {{[0-9]+}} [[Id:[0-9]+]] ; Function Attrs: nounwind define spir_kernel void @f() #0 !kernel_arg_addr_space !0 !kernel_arg_access_qual !0 !kernel_arg_type !0 !kernel_arg_base_type !0 !kernel_arg_type_qual !0 { diff --git a/test/transcoding/builtin_vars.ll b/test/transcoding/builtin_vars.ll index 9205b5152..353709892 100644 --- a/test/transcoding/builtin_vars.ll +++ b/test/transcoding/builtin_vars.ll @@ -10,8 +10,19 @@ ; Check that produced builtin-call-based SPV-IR is recognized by the translator ; RUN: llvm-spirv -spirv-text %t.out.bc -o - | FileCheck %s --check-prefix=CHECK-SPIRV +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o %t.spv +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.spv -to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV +; RUN: spirv-val %t.spv +; RUN: llvm-spirv -r %t.spv -o %t.out.bc +; RUN: llvm-dis %t.out.bc -o - | FileCheck %s --check-prefix=CHECK-OCL-IR +; RUN: llvm-spirv -r %t.spv --spirv-target-env=SPV-IR -o %t.out.bc +; RUN: llvm-dis %t.out.bc -o - | FileCheck %s --check-prefix=CHECK-SPV-IR + +; Check that produced builtin-call-based SPV-IR is recognized by the translator +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers -spirv-text %t.out.bc -o - | FileCheck %s --check-prefix=CHECK-SPIRV + ; CHECK-SPIRV: Decorate [[Id:[0-9]+]] BuiltIn 34 -; CHECK-SPIRV: Variable {{[0-9]+}} [[Id:[0-9]+]] +; CHECK-SPIRV: {{(Variable|UntypedVariableKHR)}} {{[0-9]+}} [[Id:[0-9]+]] 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-unknown-unknown" diff --git a/test/transcoding/constant-vars.ll b/test/transcoding/constant-vars.ll index 2d1023932..b09333510 100644 --- a/test/transcoding/constant-vars.ll +++ b/test/transcoding/constant-vars.ll @@ -1,11 +1,18 @@ ; Check that we can handle constant expressions correctly. ; RUN: llvm-as %s -o %t.bc -; RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV +; RUN: llvm-spirv %t.bc -spirv-text -o - | 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 -r %t.spv -o %t.rev.bc ; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -spirv-text -o - | FileCheck %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-UNTYPED-PTR +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o %t.spv +; TODO: enable once spirv tools support untyped access instructions as spec constants arguments. +; R/UN: spirv-val %t.spv +; RUN: llvm-spirv -r %t.spv -o %t.rev.bc +; RUN: llvm-dis %t.rev.bc -o - | 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-unknown-unknown" @@ -14,8 +21,10 @@ target triple = "spir-unknown-unknown" ; CHECK-SPIRV-DAG: 4 TypeInt [[U64:[0-9]+]] 64 0 ; CHECK-SPIRV-DAG: 4 Constant [[U32]] [[I320:[0-9]+]] 0 ; CHECK-SPIRV-DAG: 4 Constant [[U32]] [[I323:[0-9]+]] 3 -; CHECK-SPIRV: 4 TypePointer [[AS2:[0-9]+]] 0 [[U8]] -; CHECK-SPIRV: 4 TypePointer [[AS1:[0-9]+]] 5 [[U8]] +; CHECK-SPIRV-TYPED-PTR: 4 TypePointer [[AS2:[0-9]+]] 0 [[U8]] +; CHECK-SPIRV-TYPED-PTR: 4 TypePointer [[AS1:[0-9]+]] 5 [[U8]] +; CHECK-SPIRV-UNTYPED-PTR: 3 TypeUntypedPointerKHR [[AS2:[0-9]+]] 0 +; CHECK-SPIRV-UNTYPED-PTR: 3 TypeUntypedPointerKHR [[AS1:[0-9]+]] 5 ; CHECK-SPIRV-DAG: 4 TypeStruct [[STRUCTTY:[0-9]+]] ; CHECK-SPIRV-DAG: 4 TypeArray [[ARRAYTY:[0-9]+]] [[AS1]] [[I323]] @@ -27,7 +36,8 @@ target triple = "spir-unknown-unknown" @struct = addrspace(1) global {ptr addrspace(2), ptr addrspace(1)} { ptr addrspace(2) @astr, ptr addrspace(1) @i64arr } -; CHECK-SPIRV: 7 SpecConstantOp [[AS2]] [[ASTRC:[0-9]+]] 70 [[ASTR]] [[I320]] [[I320]] +; CHECK-SPIRV-TYPED-PTR: 7 SpecConstantOp [[AS2]] [[ASTRC:[0-9]+]] 70 [[ASTR]] [[I320]] [[I320]] +; CHECK-SPIRV-UNTYPED-PTR: 8 SpecConstantOp [[AS2]] [[ASTRC:[0-9]+]] 4424 [[#]] [[ASTR]] [[I320]] [[I320]] ; CHECK-SPIRV: 5 SpecConstantOp [[AS1]] [[I64ARRC:[0-9]+]] 124 [[I64ARR]] ; CHECK-SPIRV: 5 ConstantComposite [[STRUCTTY]] [[STRUCT_INIT:[0-9]+]] [[ASTRC]] [[I64ARRC]] ; CHECK-SPIRV: 5 Variable {{[0-9]+}} [[STRUCT:[0-9]+]] 5 [[STRUCT_INIT]] @@ -36,7 +46,8 @@ target triple = "spir-unknown-unknown" ; CHECK-SPIRV: 5 SpecConstantOp [[AS1]] [[I64ARRC2:[0-9]+]] 124 [[I64ARR]] ; CHECK-SPIRV: 5 SpecConstantOp [[AS1]] [[STRUCTC:[0-9]+]] 124 [[STRUCT]] -; CHECK-SPIRV: 7 SpecConstantOp {{[0-9]+}} [[GEP:[0-9]+]] 67 [[I64ARR]] +; CHECK-SPIRV-TYPED-PTR: 7 SpecConstantOp {{[0-9]+}} [[GEP:[0-9]+]] 67 [[I64ARR]] +; CHECK-SPIRV-UNTYPED-PTR: 8 SpecConstantOp {{[0-9]+}} [[GEP:[0-9]+]] 4423 [[#]] [[I64ARR]] ; CHECK-SPIRV: 6 ConstantComposite [[ARRAYTY]] [[ARRAY_INIT:[0-9]+]] [[I64ARRC2]] [[STRUCTC]] [[GEP]] ; CHECK-SPIRV: 5 Variable {{[0-9]+}} [[ARRAY:[0-9]+]] 5 [[ARRAY_INIT]] diff --git a/test/transcoding/global-constant-expression.ll b/test/transcoding/global-constant-expression.ll index 054c6f4cc..a8078c2ff 100644 --- a/test/transcoding/global-constant-expression.ll +++ b/test/transcoding/global-constant-expression.ll @@ -2,11 +2,15 @@ ; RUN: llvm-as < %s | llvm-spirv -o %t.spv ; RUN: llvm-spirv -r %t.spv -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-LLVM +; RUN: llvm-as < %s | llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV +; RUN: llvm-as < %s | llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers -o %t.spv +; RUN: llvm-spirv -r %t.spv -o - | llvm-dis | 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-unknown-unknown" -; CHECK-SPIRV: 7 SpecConstantOp {{[0-9]*}} {{[0-9]*}} 70 -; CHECK-SPIRV: 7 SpecConstantOp {{[0-9]*}} {{[0-9]*}} 70 +; CHECK-SPIRV: SpecConstantOp {{[0-9]*}} {{[0-9]*}} {{70|4424}} +; CHECK-SPIRV: SpecConstantOp {{[0-9]*}} {{[0-9]*}} {{70|4424}} ; CHECK-LLVM: @k_var = addrspace(1) global [2 x ptr addrspace(1)] [ptr addrspace(1) getelementptr inbounds ([2 x i8], ptr addrspace(1) @a_var, i32 0, i64 1), ptr addrspace(1) @a_var], align 4 @a_var = addrspace(1) global [2 x i8] c"\96\96", align 1 diff --git a/test/transcoding/kernel_query.ll b/test/transcoding/kernel_query.ll index 50a90ea3f..9b9a87d90 100644 --- a/test/transcoding/kernel_query.ll +++ b/test/transcoding/kernel_query.ll @@ -17,12 +17,19 @@ ; RUN: llvm-as %s -o %t.bc ; RUN: llvm-spirv %t.bc -spirv-text -o %t.spv.txt -; RUN: FileCheck < %t.spv.txt %s --check-prefix=CHECK-SPIRV +; RUN: FileCheck < %t.spv.txt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-TYPED-PTR ; RUN: llvm-spirv %t.bc -o %t.spv ; RUN: llvm-spirv -r %t.spv -o %t.rev.bc ; RUN: llvm-dis %t.rev.bc ; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -spirv-text -o %t.spv.txt +; RUN: FileCheck < %t.spv.txt %s --check-prefixes=CHECK-SPIRV,CHECK-SPIRV-UNTYPED-PTR +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o %t.spv +; RUN: llvm-spirv -r %t.spv -o %t.rev.bc +; RUN: llvm-dis %t.rev.bc +; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM + source_filename = "kernel_query.cl" 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-unknown-unknown" @@ -57,7 +64,8 @@ target triple = "spir-unknown-unknown" ; CHECK-SPIRV: TypeVoid [[VoidTy:[0-9]+]] ; CHECK-SPIRV: TypeStruct [[NDRangeTy:[0-9]+]] [[Int32Ty]] {{$}} ; CHECK-SPIRV: TypePointer [[NDRangePtrTy:[0-9]+]] 7 [[NDRangeTy]] -; CHECK-SPIRV: TypePointer [[Int8PtrGenTy:[0-9]+]] 8 [[Int8Ty]] +; CHECK-SPIRV-TYPED-PTR: TypePointer [[Int8PtrGenTy:[0-9]+]] 8 [[Int8Ty]] +; CHECK-SPIRV-UNTYPED-PTR: TypeUntypedPointerKHR [[Int8PtrGenTy:[0-9]+]] 8 ; CHECK-SPIRV: TypeFunction [[BlockKerTy:[0-9]+]] [[VoidTy]] [[Int8PtrGenTy]] ; Function Attrs: convergent noinline nounwind optnone diff --git a/test/transcoding/multiple_user_semantic_nonopaque.ll b/test/transcoding/multiple_user_semantic_nonopaque.ll index 0f52f3ef4..ef807d0cc 100644 --- a/test/transcoding/multiple_user_semantic_nonopaque.ll +++ b/test/transcoding/multiple_user_semantic_nonopaque.ll @@ -10,12 +10,23 @@ ; RUN: llvm-as %s -o %t.bc ; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_fpga_memory_accesses,+SPV_INTEL_fpga_memory_attributes -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV +; Check the same with untyped pointers enabled +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o %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 that even when FPGA memory extensions are enabled - yet we have +; UserSemantic decoration be generated +; RUN: llvm-as %s -o %t.bc +; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_fpga_memory_accesses,+SPV_INTEL_fpga_memory_attributes,+SPV_KHR_untyped_pointers -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV + ; CHECK-SPIRV: Decorate [[#Var:]] UserSemantic "var_annotation_a" ; CHECK-SPIRV: Decorate [[#Var]] UserSemantic "var_annotation_b" ; CHECK-SPIRV: Decorate [[#Var2:]] UserSemantic "class_annotation_a" ; CHECK-SPIRV: Decorate [[#Var2]] UserSemantic "class_annotation_b" -; CHECK-SPIRV-DAG: Variable [[#]] [[#Var]] [[#]] -; CHECK-SPIRV-DAG: Variable [[#]] [[#Var2]] [[#]] +; CHECK-SPIRV-DAG: {{(Variable|UntypedVariableKHR)}} [[#]] [[#Var]] [[#]] +; CHECK-SPIRV-DAG: {{(Variable|UntypedVariableKHR)}} [[#]] [[#Var2]] [[#]] ; CHECK-LLVM-DAG: @[[StrA:[0-9_.]+]] = {{.*}}"var_annotation_a\00" ; CHECK-LLVM-DAG: @[[StrB:[0-9_.]+]] = {{.*}}"var_annotation_b\00" diff --git a/test/transcoding/multiple_user_semantic_on_struct.ll b/test/transcoding/multiple_user_semantic_on_struct.ll index dc40d1acd..4d600ccf8 100644 --- a/test/transcoding/multiple_user_semantic_on_struct.ll +++ b/test/transcoding/multiple_user_semantic_on_struct.ll @@ -37,6 +37,17 @@ ; RUN: llvm-as %s -o %t.bc ; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_fpga_memory_accesses,+SPV_INTEL_fpga_memory_attributes -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV +; Check the same with untyped pointers enabled +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o %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 that even when FPGA memory extensions are enabled - yet we have +; UserSemantic decoration be generated +; RUN: llvm-as %s -o %t.bc +; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_fpga_memory_accesses,+SPV_INTEL_fpga_memory_attributes,+SPV_KHR_untyped_pointers -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV + ; CHECK-SPIRV: Decorate [[#GEP1:]] UserSemantic "ClassA" ; CHECK-SPIRV: Decorate [[#GEP2:]] UserSemantic "ClassA" ; CHECK-SPIRV: Decorate [[#GEP3:]] UserSemantic "Dec1" @@ -45,12 +56,12 @@ ; CHECK-SPIRV: Decorate [[#GEP4:]] UserSemantic "ClassAfieldB" ; CHECK-SPIRV: Decorate [[#GEP5:]] UserSemantic "ClassB" ; CHECK-SPIRV: Decorate [[#GEP6:]] UserSemantic "ClassB" -; CHECK-SPIRV: InBoundsPtrAccessChain [[#]] [[#GEP1]] [[#]] -; CHECK-SPIRV: InBoundsPtrAccessChain [[#]] [[#GEP2]] [[#]] -; CHECK-SPIRV: InBoundsPtrAccessChain [[#]] [[#GEP3]] [[#]] -; CHECK-SPIRV: InBoundsPtrAccessChain [[#]] [[#GEP4]] [[#]] -; CHECK-SPIRV: InBoundsPtrAccessChain [[#]] [[#GEP5]] [[#]] -; CHECK-SPIRV: InBoundsPtrAccessChain [[#]] [[#GEP6]] [[#]] +; CHECK-SPIRV: {{(InBoundsPtrAccessChain|UntypedInBoundsPtrAccessChainKHR)}} [[#]] [[#GEP1]] [[#]] +; CHECK-SPIRV: {{(InBoundsPtrAccessChain|UntypedInBoundsPtrAccessChainKHR)}} [[#]] [[#GEP2]] [[#]] +; CHECK-SPIRV: {{(InBoundsPtrAccessChain|UntypedInBoundsPtrAccessChainKHR)}} [[#]] [[#GEP3]] [[#]] +; CHECK-SPIRV: {{(InBoundsPtrAccessChain|UntypedInBoundsPtrAccessChainKHR)}} [[#]] [[#GEP4]] [[#]] +; CHECK-SPIRV: {{(InBoundsPtrAccessChain|UntypedInBoundsPtrAccessChainKHR)}} [[#]] [[#GEP5]] [[#]] +; CHECK-SPIRV: {{(InBoundsPtrAccessChain|UntypedInBoundsPtrAccessChainKHR)}} [[#]] [[#GEP6]] [[#]] 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" diff --git a/test/transcoding/ptr_not_equal.ll b/test/transcoding/ptr_not_equal.ll index ffc0f8cc7..4d794ab62 100644 --- a/test/transcoding/ptr_not_equal.ll +++ b/test/transcoding/ptr_not_equal.ll @@ -12,17 +12,26 @@ ; RUN: llvm-dis %t.rev.bc ; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o %t.spv +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.spv -to-text -o %t.spt +; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV +; RUN: spirv-val %t.spv + +; RUN: llvm-spirv -r %t.spv -o %t.rev.bc +; RUN: llvm-dis %t.rev.bc +; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM + ; CHECK-ERROR: RequiresVersion: Cannot fulfill SPIR-V version restriction: ; CHECK-ERROR-NEXT: SPIR-V version was restricted to at most 1.3 (66304) but a construct from the input requires SPIR-V version 1.4 (66560) or above ; SPIR-V 1.4 ; CHECK-SPIRV: 66560 ; CHECK-SPIRV: TypeFloat [[#TypeFloat:]] 32 -; CHECK-SPIRV: TypePointer [[#TypePointer:]] [[#]] [[#TypeFloat]] +; CHECK-SPIRV: {{(TypePointer|TypeUntypedPointerKHR)}} [[#TypePointer:]] [[#]] ; CHECK-SPIRV: TypeBool [[#TypeBool:]] -; CHECK-SPIRV: Variable [[#TypePointer]] [[#Var1:]] -; CHECK-SPIRV: Variable [[#TypePointer]] [[#Var2:]] +; CHECK-SPIRV: {{(Variable|UntypedVariableKHR)}} [[#TypePointer]] [[#Var1:]] +; CHECK-SPIRV: {{(Variable|UntypedVariableKHR)}} [[#TypePointer]] [[#Var2:]] ; CHECK-SPIRV: PtrEqual [[#TypeBool]] [[#]] [[#Var1]] [[#Var2]] ; CHECK-SPIRV: PtrNotEqual [[#TypeBool]] [[#]] [[#Var1]] [[#Var2]] diff --git a/test/transcoding/undef-gv.ll b/test/transcoding/undef-gv.ll index c88b17fb2..e62378e4f 100644 --- a/test/transcoding/undef-gv.ll +++ b/test/transcoding/undef-gv.ll @@ -6,8 +6,15 @@ ; RUN: llvm-spirv -r %t.spv -o %t.bc ; RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-LLVM +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -spirv-text -o %t.spt +; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV +; RUN: llvm-spirv --spirv-ext=+SPV_KHR_untyped_pointers %t.bc -o %t.spv +; RUN: spirv-val %t.spv +; RUN: llvm-spirv -r %t.spv -o %t.bc +; RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-LLVM + ; CHECK-SPIRV: Decorate [[#Var:]] LinkageAttributes "v" Export -; CHECK-SPIRV: Variable [[#]] [[#Var]] [[#]] {{$}} +; CHECK-SPIRV: {{(Variable|UntypedVariableKHR)}} [[#]] [[#Var]] [[#]] ; CHECK-SPIRV-NOT: OpUndef ; CHECK-LLVM: @v = common addrspace(1) global i32 0, align 4