1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
; REQUIRES: spirv-as
; RUN: spirv-as --target-env spv1.0 -o %t.spv %s
; RUN: spirv-val %t.spv
; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s
OpCapability Kernel
OpCapability Addresses
OpCapability Int8
OpCapability GenericPointer
OpCapability Linkage
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpSource OpenCL_CPP 100000
OpName %a "a"
OpName %p "p"
OpName %foo "foo"
OpName %e "e"
OpName %math "math"
OpName %ov "ov"
OpDecorate %foo LinkageAttributes "foo" Export
%uint = OpTypeInt 32 0
%uchar = OpTypeInt 8 0
%_ptr_Generic_uchar = OpTypePointer Generic %uchar
%5 = OpTypeFunction %uint %uint %_ptr_Generic_uchar
%bool = OpTypeBool
%_struct_7 = OpTypeStruct %uint %uint
%uint_1 = OpConstant %uint 1
%uchar_42 = OpConstant %uchar 42
%10 = OpConstantNull %uint
%foo = OpFunction %uint None %5
%a = OpFunctionParameter %uint
%p = OpFunctionParameter %_ptr_Generic_uchar
%19 = OpLabel
OpBranch %20
%20 = OpLabel
%e = OpPhi %uint %a %19 %math %21
%16 = OpIAddCarry %_struct_7 %e %uint_1
%math = OpCompositeExtract %uint %16 0
%17 = OpCompositeExtract %uint %16 1
%ov = OpINotEqual %bool %17 %10
OpBranchConditional %ov %22 %21
%21 = OpLabel
OpStore %p %uchar_42 Aligned 1
OpBranch %20
%22 = OpLabel
OpReturnValue %math
OpFunctionEnd
; CHECK: %[[#Var:]] = alloca %structtype, align 8
; CHECK: call spir_func void @_Z17__spirv_IAddCarryii(%structtype* sret(%structtype) %[[#Var:]]
; CHECK: %[[#Load:]] = load %structtype, %structtype* %[[#Var]], align 4
; CHECK-2: extractvalue %structtype %[[#Load:]]
|