1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
3 ; CHECK-SPIRV-DAG: %[[#int:]] = OpTypeInt 32 0
4 ; CHECK-SPIRV-DAG: %[[#int2:]] = OpTypeVector %[[#int]] 2
5 ; CHECK-SPIRV-DAG: %[[#float:]] = OpTypeFloat 32
6 ; CHECK-SPIRV-DAG: %[[#float2:]] = OpTypeVector %[[#float]] 2
8 ; CHECK-SPIRV: OpFunction
9 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
10 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
11 ; CHECK-SPIRV: %[[#]] = OpSDiv %[[#int2]] %[[#A]] %[[#B]]
12 ; CHECK-SPIRV: OpFunctionEnd
14 ;; kernel void testSDiv(int2 a, int2 b, global int2 *res) {
18 define dso_local spir_kernel void @testSDiv(<2 x i32> noundef %a, <2 x i32> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
20 %div = sdiv <2 x i32> %a, %b
21 store <2 x i32> %div, <2 x i32> addrspace(1)* %res, align 8
25 ; CHECK-SPIRV: OpFunction
26 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
27 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
28 ; CHECK-SPIRV: %[[#]] = OpUDiv %[[#int2]] %[[#A]] %[[#B]]
29 ; CHECK-SPIRV: OpFunctionEnd
31 ;; kernel void testUDiv(uint2 a, uint2 b, global uint2 *res) {
35 define dso_local spir_kernel void @testUDiv(<2 x i32> noundef %a, <2 x i32> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
37 %div = udiv <2 x i32> %a, %b
38 store <2 x i32> %div, <2 x i32> addrspace(1)* %res, align 8
42 ; CHECK-SPIRV: OpFunction
43 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
44 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
45 ; CHECK-SPIRV: %[[#]] = OpFDiv %[[#float2]] %[[#A]] %[[#B]]
46 ; CHECK-SPIRV: OpFunctionEnd
48 ;; kernel void testFDiv(float2 a, float2 b, global float2 *res) {
52 define dso_local spir_kernel void @testFDiv(<2 x float> noundef %a, <2 x float> noundef %b, <2 x float> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
54 %div = fdiv <2 x float> %a, %b
55 store <2 x float> %div, <2 x float> addrspace(1)* %res, align 8
59 ; CHECK-SPIRV: OpFunction
60 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
61 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
62 ; CHECK-SPIRV: %[[#]] = OpSRem %[[#int2]] %[[#A]] %[[#B]]
63 ; CHECK-SPIRV: OpFunctionEnd
65 ;; kernel void testSRem(int2 a, int2 b, global int2 *res) {
69 define dso_local spir_kernel void @testSRem(<2 x i32> noundef %a, <2 x i32> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
71 %rem = srem <2 x i32> %a, %b
72 store <2 x i32> %rem, <2 x i32> addrspace(1)* %res, align 8
76 ; CHECK-SPIRV: OpFunction
77 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
78 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
79 ; CHECK-SPIRV: %[[#]] = OpUMod %[[#int2]] %[[#A]] %[[#B]]
80 ; CHECK-SPIRV: OpFunctionEnd
82 ;; kernel void testUMod(uint2 a, uint2 b, global uint2 *res) {
86 define dso_local spir_kernel void @testUMod(<2 x i32> noundef %a, <2 x i32> noundef %b, <2 x i32> addrspace(1)* nocapture noundef writeonly %res) local_unnamed_addr {
88 %rem = urem <2 x i32> %a, %b
89 store <2 x i32> %rem, <2 x i32> addrspace(1)* %res, align 8