brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · 67c3380 Raw
93 lines · plain
1; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}3 4; CHECK-SPIRV-DAG: %[[#int:]] = OpTypeInt 32 05; CHECK-SPIRV-DAG: %[[#int2:]] = OpTypeVector %[[#int]] 26; CHECK-SPIRV-DAG: %[[#float:]] = OpTypeFloat 327; CHECK-SPIRV-DAG: %[[#float2:]] = OpTypeVector %[[#float]] 28 9; CHECK-SPIRV:      OpFunction10; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]11; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]12; CHECK-SPIRV:      %[[#]] = OpSDiv %[[#int2]] %[[#A]] %[[#B]]13; CHECK-SPIRV:      OpFunctionEnd14 15;; kernel void testSDiv(int2 a, int2 b, global int2 *res) {16;;   res[0] = a / b;17;; }18 19define 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 {20entry:21  %div = sdiv <2 x i32> %a, %b22  store <2 x i32> %div, <2 x i32> addrspace(1)* %res, align 823  ret void24}25 26; CHECK-SPIRV:      OpFunction27; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]28; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]29; CHECK-SPIRV:      %[[#]] = OpUDiv %[[#int2]] %[[#A]] %[[#B]]30; CHECK-SPIRV:      OpFunctionEnd31 32;; kernel void testUDiv(uint2 a, uint2 b, global uint2 *res) {33;;   res[0] = a / b;34;; }35 36define 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 {37entry:38  %div = udiv <2 x i32> %a, %b39  store <2 x i32> %div, <2 x i32> addrspace(1)* %res, align 840  ret void41}42 43; CHECK-SPIRV:      OpFunction44; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]45; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]46; CHECK-SPIRV:      %[[#]] = OpFDiv %[[#float2]] %[[#A]] %[[#B]]47; CHECK-SPIRV:      OpFunctionEnd48 49;; kernel void testFDiv(float2 a, float2 b, global float2 *res) {50;;   res[0] = a / b;51;; }52 53define 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 {54entry:55  %div = fdiv <2 x float> %a, %b56  store <2 x float> %div, <2 x float> addrspace(1)* %res, align 857  ret void58}59 60; CHECK-SPIRV:      OpFunction61; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]62; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]63; CHECK-SPIRV:      %[[#]] = OpSRem %[[#int2]] %[[#A]] %[[#B]]64; CHECK-SPIRV:      OpFunctionEnd65 66;; kernel void testSRem(int2 a, int2 b, global int2 *res) {67;;   res[0] = a % b;68;; }69 70define 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 {71entry:72  %rem = srem <2 x i32> %a, %b73  store <2 x i32> %rem, <2 x i32> addrspace(1)* %res, align 874  ret void75}76 77; CHECK-SPIRV:      OpFunction78; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]79; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]80; CHECK-SPIRV:      %[[#]] = OpUMod %[[#int2]] %[[#A]] %[[#B]]81; CHECK-SPIRV:      OpFunctionEnd82 83;; kernel void testUMod(uint2 a, uint2 b, global uint2 *res) {84;;   res[0] = a % b;85;; }86 87define 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 {88entry:89  %rem = urem <2 x i32> %a, %b90  store <2 x i32> %rem, <2 x i32> addrspace(1)* %res, align 891  ret void92}93