| 1 |
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-vulkan %s -o - | FileCheck %s |
| 2 |
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan %s -o - -filetype=obj | spirv-val %} |
| 3 |
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan %s -o - | spirv-as - -o - | spirv-val %} |
| 4 |
|
| 5 |
; CHECK-DAG: [[float_t:%[0-9]+]] = OpTypeFloat 32 |
| 6 |
; CHECK-DAG: [[uint32_t:%[0-9]+]] = OpTypeInt 32 0 |
| 7 |
|
| 8 |
; CHECK-DAG: [[image_t:%[0-9]+]] = OpTypeImage [[float_t]] 2D 2 0 0 1 Unknown |
| 9 |
%type_2d_image = type target("spirv.Image", float, 1, 2, 0, 0, 1, 0) |
| 10 |
|
| 11 |
%literal_true = type target("spirv.Literal", 1) |
| 12 |
%literal_32 = type target("spirv.Literal", 32) |
| 13 |
|
| 14 |
; CHECK-DAG: [[uint32_4:%[0-9]+]] = OpConstant [[uint32_t]] 4 |
| 15 |
%integral_constant_4 = type target("spirv.IntegralConstant", i32, 4) |
| 16 |
|
| 17 |
; CHECK-DAG: OpUnknown(28, 4) [[array_t:%[0-9]+]] [[image_t]] [[uint32_4]] |
| 18 |
%ArrayTex2D = type target("spirv.Type", %type_2d_image, %integral_constant_4, 28, 0, 0) |
| 19 |
|
| 20 |
; CHECK-DAG: OpUnknown(21, 4) [[int_t:%[0-9]+]] 32 1 |
| 21 |
%int_t = type target("spirv.Type", %literal_32, %literal_true, 21, 0, 0) |
| 22 |
|
| 23 |
; CHECK-DAG: [[getTexArray_t:%[0-9]+]] = OpTypeFunction [[array_t]] |
| 24 |
; CHECK-DAG: [[getInt_t:%[0-9]+]] = OpTypeFunction [[int_t]] |
| 25 |
|
| 26 |
; CHECK: [[getTexArray:%[0-9]+]] = OpFunction [[array_t]] None [[getTexArray_t]] |
| 27 |
declare %ArrayTex2D @getTexArray() |
| 28 |
|
| 29 |
; CHECK: [[getInt:%[0-9]+]] = OpFunction [[int_t]] None [[getInt_t]] |
| 30 |
declare %int_t @getInt() |
| 31 |
|
| 32 |
define void @main() #1 { |
| 33 |
entry: |
| 34 |
; CHECK: {{%[0-9]+}} = OpFunctionCall [[array_t]] [[getTexArray]] |
| 35 |
%retTex = call %ArrayTex2D @getTexArray() |
| 36 |
|
| 37 |
; CHECK: {{%[0-9]+}} = OpFunctionCall [[int_t]] [[getInt]] |
| 38 |
%i = call %int_t @getInt() |
| 39 |
|
| 40 |
ret void |
| 41 |
} |