1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
3 ; CHECK-DAG: OpName [[VECTOR_FNEG:%.+]] "vector_fneg"
4 ; CHECK-DAG: OpName [[VECTOR_FADD:%.+]] "vector_fadd"
5 ; CHECK-DAG: OpName [[VECTOR_FSUB:%.+]] "vector_fsub"
6 ; CHECK-DAG: OpName [[VECTOR_FMUL:%.+]] "vector_fmul"
7 ; CHECK-DAG: OpName [[VECTOR_FDIV:%.+]] "vector_fdiv"
8 ; CHECK-DAG: OpName [[VECTOR_FREM:%.+]] "vector_frem"
9 ;; TODO: add test for OpFMod
11 ; CHECK-NOT: DAG-FENCE
13 ; CHECK-DAG: [[FP16:%.+]] = OpTypeFloat 16
14 ; CHECK-DAG: [[VECTOR:%.+]] = OpTypeVector [[FP16]]
15 ; CHECK-DAG: [[VECTOR_FN:%.+]] = OpTypeFunction [[VECTOR]] [[VECTOR]] [[VECTOR]]
17 ; CHECK-NOT: DAG-FENCE
20 ;; Test fneg on vector:
21 define <2 x half> @vector_fneg(<2 x half> %a, <2 x half> %unused) {
22 %c = fneg <2 x half> %a
26 ; CHECK: [[VECTOR_FNEG]] = OpFunction [[VECTOR]] None [[VECTOR_FN]]
27 ; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter [[VECTOR]]
28 ; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter [[VECTOR]]
30 ; CHECK: [[C:%.+]] = OpFNegate [[VECTOR]] [[A]]
31 ; CHECK: OpReturnValue [[C]]
32 ; CHECK-NEXT: OpFunctionEnd
35 ;; Test fadd on vector:
36 define <2 x half> @vector_fadd(<2 x half> %a, <2 x half> %b) {
37 %c = fadd <2 x half> %a, %b
41 ; CHECK: [[VECTOR_FADD]] = OpFunction [[VECTOR]] None [[VECTOR_FN]]
42 ; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter [[VECTOR]]
43 ; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter [[VECTOR]]
45 ; CHECK: [[C:%.+]] = OpFAdd [[VECTOR]] [[A]] [[B]]
46 ; CHECK: OpReturnValue [[C]]
47 ; CHECK-NEXT: OpFunctionEnd
50 ;; Test fsub on vector:
51 define <2 x half> @vector_fsub(<2 x half> %a, <2 x half> %b) {
52 %c = fsub <2 x half> %a, %b
56 ; CHECK: [[VECTOR_FSUB]] = OpFunction [[VECTOR]] None [[VECTOR_FN]]
57 ; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter [[VECTOR]]
58 ; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter [[VECTOR]]
60 ; CHECK: [[C:%.+]] = OpFSub [[VECTOR]] [[A]] [[B]]
61 ; CHECK: OpReturnValue [[C]]
62 ; CHECK-NEXT: OpFunctionEnd
65 ;; Test fmul on vector:
66 define <2 x half> @vector_fmul(<2 x half> %a, <2 x half> %b) {
67 %c = fmul <2 x half> %a, %b
71 ; CHECK: [[VECTOR_FMUL]] = OpFunction [[VECTOR]] None [[VECTOR_FN]]
72 ; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter [[VECTOR]]
73 ; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter [[VECTOR]]
75 ; CHECK: [[C:%.+]] = OpFMul [[VECTOR]] [[A]] [[B]]
76 ; CHECK: OpReturnValue [[C]]
77 ; CHECK-NEXT: OpFunctionEnd
80 ;; Test fdiv on vector:
81 define <2 x half> @vector_fdiv(<2 x half> %a, <2 x half> %b) {
82 %c = fdiv <2 x half> %a, %b
86 ; CHECK: [[VECTOR_FDIV]] = OpFunction [[VECTOR]] None [[VECTOR_FN]]
87 ; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter [[VECTOR]]
88 ; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter [[VECTOR]]
90 ; CHECK: [[C:%.+]] = OpFDiv [[VECTOR]] [[A]] [[B]]
91 ; CHECK: OpReturnValue [[C]]
92 ; CHECK-NEXT: OpFunctionEnd
95 ;; Test frem on vector:
96 define <2 x half> @vector_frem(<2 x half> %a, <2 x half> %b) {
97 %c = frem <2 x half> %a, %b
101 ; CHECK: [[VECTOR_FREM]] = OpFunction [[VECTOR]] None [[VECTOR_FN]]
102 ; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter [[VECTOR]]
103 ; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter [[VECTOR]]
105 ; CHECK: [[C:%.+]] = OpFRem [[VECTOR]] [[A]] [[B]]
106 ; CHECK: OpReturnValue [[C]]
107 ; CHECK-NEXT: OpFunctionEnd