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