1 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
3 ; CHECK-DAG: OpName [[FOOBAR:%.+]] "foobar"
4 ; CHECK-DAG: OpName [[PRODUCER:%.+]] "producer"
5 ; CHECK-DAG: OpName [[CONSUMER:%.+]] "consumer"
10 %ty2 = type {%ty1, i64}
12 ; CHECK-DAG: [[I16:%.+]] = OpTypeInt 16
13 ; CHECK-DAG: [[I32:%.+]] = OpTypeInt 32
14 ; CHECK-DAG: [[I64:%.+]] = OpTypeInt 64
15 ; CHECK-DAG: [[TY1:%.+]] = OpTypeStruct [[I16]] [[I32]]
16 ; CHECK-DAG: [[TY2:%.+]] = OpTypeStruct [[TY1]] [[I64]]
17 ; CHECK-DAG: [[UNDEF_I16:%.+]] = OpUndef [[I16]]
18 ; CHECK-DAG: [[UNDEF_I64:%.+]] = OpUndef [[I64]]
19 ; CHECK-DAG: [[UNDEF_TY2:%.+]] = OpUndef [[TY2]]
20 ; CHECK-DAG: [[CST_42:%.+]] = OpConstant [[I32]] 42
22 ; CHECK-NOT: DAG-FENCE
24 define i32 @foobar() {
25 %agg = call %ty2 @producer(i16 undef, i32 42, i64 undef)
26 %ret = call i32 @consumer(%ty2 %agg)
30 ; CHECK: [[FOOBAR]] = OpFunction
31 ; CHECK: [[AGG:%.+]] = OpFunctionCall [[TY2]] [[PRODUCER]] [[UNDEF_I16]] [[CST_42]] [[UNDEF_I64]]
32 ; CHECK: [[RET:%.+]] = OpFunctionCall [[I32]] [[CONSUMER]] [[AGG]]
33 ; CHECK: OpReturnValue [[RET]]
34 ; CHECK: OpFunctionEnd
37 define %ty2 @producer(i16 %a, i32 %b, i64 %c) {
38 %agg1 = insertvalue %ty2 undef, i16 %a, 0, 0
39 %agg2 = insertvalue %ty2 %agg1, i32 %b, 0, 1
40 %agg3 = insertvalue %ty2 %agg2, i64 %c, 1
44 ; CHECK: [[PRODUCER]] = OpFunction
45 ; CHECK: [[A:%.+]] = OpFunctionParameter [[I16]]
46 ; CHECK: [[B:%.+]] = OpFunctionParameter [[I32]]
47 ; CHECK: [[C:%.+]] = OpFunctionParameter [[I64]]
48 ; CHECK: [[AGG1:%.+]] = OpCompositeInsert [[TY2]] [[A]] [[UNDEF_TY2]] 0 0
49 ; CHECK: [[AGG2:%.+]] = OpCompositeInsert [[TY2]] [[B]] [[AGG1]] 0 1
50 ; CHECK: [[AGG3:%.+]] = OpCompositeInsert [[TY2]] [[C]] [[AGG2]] 1
51 ; CHECK: OpReturnValue [[AGG3]]
52 ; CHECK: OpFunctionEnd
55 define i32 @consumer(%ty2 %agg) {
56 %ret = extractvalue %ty2 %agg, 0, 1
60 ; CHECK: [[CONSUMER]] = OpFunction
61 ; CHECK: [[AGG:%.+]] = OpFunctionParameter [[TY2]]
62 ; CHECK: [[RET:%.+]] = OpCompositeExtract [[I32]] [[AGG]] 0 1
63 ; CHECK: OpReturnValue [[RET]]
64 ; CHECK: OpFunctionEnd