1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
3 ; CHECK-DAG: OpName [[VECTOR_SHL:%.+]] "vector_shl"
4 ; CHECK-DAG: OpName [[VECTOR_LSHR:%.+]] "vector_lshr"
5 ; CHECK-DAG: OpName [[VECTOR_ASHR:%.+]] "vector_ashr"
6 ; CHECK-DAG: OpName [[VECTOR_AND:%.+]] "vector_and"
7 ; CHECK-DAG: OpName [[VECTOR_OR:%.+]] "vector_or"
8 ; CHECK-DAG: OpName [[VECTOR_XOR:%.+]] "vector_xor"
10 ; CHECK-NOT: DAG-FENCE
12 ; CHECK-DAG: [[I16:%.+]] = OpTypeInt 16
13 ; CHECK-DAG: [[VECTOR:%.+]] = OpTypeVector [[I16]]
14 ; CHECK-DAG: [[VECTOR_FN:%.+]] = OpTypeFunction [[VECTOR]] [[VECTOR]] [[VECTOR]]
16 ; CHECK-NOT: DAG-FENCE
19 ;; Test shl on vector:
20 define <2 x i16> @vector_shl(<2 x i16> %a, <2 x i16> %b) {
21 %c = shl <2 x i16> %a, %b
25 ; CHECK: [[VECTOR_SHL]] = OpFunction [[VECTOR]] None [[VECTOR_FN]]
26 ; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter [[VECTOR]]
27 ; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter [[VECTOR]]
29 ; CHECK: [[C:%.+]] = OpShiftLeftLogical [[VECTOR]] [[A]] [[B]]
30 ; CHECK: OpReturnValue [[C]]
31 ; CHECK-NEXT: OpFunctionEnd
34 ;; Test lshr on vector:
35 define <2 x i16> @vector_lshr(<2 x i16> %a, <2 x i16> %b) {
36 %c = lshr <2 x i16> %a, %b
40 ; CHECK: [[VECTOR_LSHR]] = OpFunction [[VECTOR]] None [[VECTOR_FN]]
41 ; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter [[VECTOR]]
42 ; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter [[VECTOR]]
44 ; CHECK: [[C:%.+]] = OpShiftRightLogical [[VECTOR]] [[A]] [[B]]
45 ; CHECK: OpReturnValue [[C]]
46 ; CHECK-NEXT: OpFunctionEnd
49 ;; Test ashr on vector:
50 define <2 x i16> @vector_ashr(<2 x i16> %a, <2 x i16> %b) {
51 %c = ashr <2 x i16> %a, %b
55 ; CHECK: [[VECTOR_ASHR]] = OpFunction [[VECTOR]] None [[VECTOR_FN]]
56 ; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter [[VECTOR]]
57 ; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter [[VECTOR]]
59 ; CHECK: [[C:%.+]] = OpShiftRightArithmetic [[VECTOR]] [[A]] [[B]]
60 ; CHECK: OpReturnValue [[C]]
61 ; CHECK-NEXT: OpFunctionEnd
64 ;; Test and on vector:
65 define <2 x i16> @vector_and(<2 x i16> %a, <2 x i16> %b) {
66 %c = and <2 x i16> %a, %b
70 ; CHECK: [[VECTOR_AND]] = OpFunction [[VECTOR]] None [[VECTOR_FN]]
71 ; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter [[VECTOR]]
72 ; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter [[VECTOR]]
74 ; CHECK: [[C:%.+]] = OpBitwiseAnd [[VECTOR]] [[A]] [[B]]
75 ; CHECK: OpReturnValue [[C]]
76 ; CHECK-NEXT: OpFunctionEnd
80 define <2 x i16> @vector_or(<2 x i16> %a, <2 x i16> %b) {
81 %c = or <2 x i16> %a, %b
85 ; CHECK: [[VECTOR_OR]] = OpFunction [[VECTOR]] None [[VECTOR_FN]]
86 ; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter [[VECTOR]]
87 ; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter [[VECTOR]]
89 ; CHECK: [[C:%.+]] = OpBitwiseOr [[VECTOR]] [[A]] [[B]]
90 ; CHECK: OpReturnValue [[C]]
91 ; CHECK-NEXT: OpFunctionEnd
94 ;; Test xor on vector:
95 define <2 x i16> @vector_xor(<2 x i16> %a, <2 x i16> %b) {
96 %c = xor <2 x i16> %a, %b
100 ; CHECK: [[VECTOR_XOR]] = OpFunction [[VECTOR]] None [[VECTOR_FN]]
101 ; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter [[VECTOR]]
102 ; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter [[VECTOR]]
104 ; CHECK: [[C:%.+]] = OpBitwiseXor [[VECTOR]] [[A]] [[B]]
105 ; CHECK: OpReturnValue [[C]]
106 ; CHECK-NEXT: OpFunctionEnd