brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · 8a66ccd Raw
90 lines · plain
1; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}3 4; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s5; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}6 7; CHECK-DAG: %[[Char:.*]] = OpTypeInt 8 08; CHECK-DAG: %[[Void:.*]] = OpTypeVoid9; CHECK-DAG: %[[PtrChar:.*]] = OpTypePointer Function %[[Char]]10; CHECK-DAG: %[[StructChar:.*]] = OpTypeStruct %[[Char]] %[[Char]]11; CHECK-DAG: %[[NullChar:.*]] = OpConstantNull %[[Char]]12; CHECK-DAG: %[[Int:.*]] = OpTypeInt 32 013; CHECK-DAG: %[[PtrInt:.*]] = OpTypePointer Function %[[Int]]14; CHECK-DAG: %[[StructInt:.*]] = OpTypeStruct %[[Int]] %[[Int]]15; CHECK-DAG: %[[NullInt:.*]] = OpConstantNull %[[Int]]16; CHECK-DAG: %[[Bool:.*]] = OpTypeBool17; CHECK-DAG: %[[V2Bool:.*]] = OpTypeVector %[[Bool]] 218; CHECK-DAG: %[[Long:.*]] = OpTypeInt 64 019; CHECK-DAG: %[[V2Long:.*]] = OpTypeVector %[[Long]] 220; CHECK-DAG: %[[PtrV2Long:.*]] = OpTypePointer Function %[[V2Long]]21; CHECK-DAG: %[[StructV2Long:.*]] = OpTypeStruct %[[V2Long]] %[[V2Long]]22; CHECK-DAG: %[[ZeroV2Long:.*]] = OpConstantNull %[[V2Long]]23 24; CHECK: OpFunction25; CHECK: %[[A:.*]] = OpFunctionParameter %[[Char]]26; CHECK: %[[B:.*]] = OpFunctionParameter %[[Char]]27; CHECK: %[[Ptr:.*]] = OpFunctionParameter %[[PtrChar]]28; CHECK: %[[Struct:.*]] = OpUMulExtended %[[StructChar]] %[[A]] %[[B]]29; CHECK: %[[Val:.*]] = OpCompositeExtract %[[Char]] %[[Struct]] 030; CHECK: %[[Over:.*]] = OpCompositeExtract %[[Char]] %[[Struct]] 131; CHECK: %[[IsOver:.*]] = OpINotEqual %[[Bool]] %[[Over]] %[[NullChar]]32; CHECK: %[[Res:.*]] = OpSelect %[[Char]] %[[IsOver]] %[[NullChar]] %[[Val]]33; CHECK: OpStore %[[Ptr]] %[[Res]] Aligned 134; CHECK: OpReturn35define dso_local spir_func void @umulo_i8(i8 zeroext %a, i8 zeroext %b, ptr nocapture %c) local_unnamed_addr {36entry:37  %umul = tail call { i8, i1 } @llvm.umul.with.overflow.i8(i8 %a, i8 %b)38  %cmp = extractvalue { i8, i1 } %umul, 139  %umul.value = extractvalue { i8, i1 } %umul, 040  %storemerge = select i1 %cmp, i8 0, i8 %umul.value41  store i8 %storemerge, ptr %c, align 142  ret void43}44 45; CHECK: OpFunction46; CHECK: %[[A2:.*]] = OpFunctionParameter %[[Int]]47; CHECK: %[[B2:.*]] = OpFunctionParameter %[[Int]]48; CHECK: %[[Ptr2:.*]] = OpFunctionParameter %[[PtrInt]]49; CHECK: %[[Struct2:.*]] = OpUMulExtended %[[StructInt]] %[[B2]] %[[A2]]50; CHECK: %[[Val2:.*]] = OpCompositeExtract %[[Int]] %[[Struct2]] 051; CHECK: %[[Over2:.*]] = OpCompositeExtract %[[Int]] %[[Struct2]] 152; CHECK: %[[IsOver2:.*]] = OpINotEqual %[[Bool]] %[[Over2]] %[[NullInt]]53; CHECK: %[[Res2:.*]] = OpSelect %[[Int]] %[[IsOver2]] %[[NullInt]] %[[Val2]]54; CHECK: OpStore %[[Ptr2]] %[[Res2]] Aligned 455; CHECK: OpReturn56define dso_local spir_func void @umulo_i32(i32 %a, i32 %b, ptr nocapture %c) local_unnamed_addr {57entry:58  %umul = tail call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %b, i32 %a)59  %umul.val = extractvalue { i32, i1 } %umul, 060  %umul.ov = extractvalue { i32, i1 } %umul, 161  %spec.select = select i1 %umul.ov, i32 0, i32 %umul.val62  store i32 %spec.select, ptr %c, align 463  ret void64}65 66; CHECK: OpFunction67; CHECK: %[[A3:.*]] = OpFunctionParameter %[[V2Long]]68; CHECK: %[[B3:.*]] = OpFunctionParameter %[[V2Long]]69; CHECK: %[[Ptr3:.*]] = OpFunctionParameter %[[PtrV2Long]]70; CHECK: %[[Struct3:.*]] = OpUMulExtended %[[StructV2Long]] %[[A3]] %[[B3]]71; CHECK: %[[Val3:.*]] = OpCompositeExtract %[[V2Long]] %[[Struct3]] 072; CHECK: %[[Over3:.*]] = OpCompositeExtract %[[V2Long]] %[[Struct3]] 173; CHECK: %[[IsOver3:.*]] = OpINotEqual %[[V2Bool]] %[[Over3]] %[[ZeroV2Long]]74; CHECK: %[[Res3:.*]] = OpSelect %[[V2Long]] %[[IsOver3]] %[[ZeroV2Long]] %[[Val3]]75; CHECK: OpStore %[[Ptr3]] %[[Res3]] Aligned 1676; CHECK: OpReturn77define dso_local spir_func void @umulo_v2i64(<2 x i64> %a, <2 x i64> %b, ptr %p) nounwind {78  %umul = call {<2 x i64>, <2 x i1>} @llvm.umul.with.overflow.v2i64(<2 x i64> %a, <2 x i64> %b)79  %umul.val = extractvalue {<2 x i64>, <2 x i1>} %umul, 080  %umul.ov = extractvalue {<2 x i64>, <2 x i1>} %umul, 181  %zero = alloca <2 x i64>, align 1682  %spec.select = select <2 x i1> %umul.ov, <2 x i64> <i64 0, i64 0>, <2 x i64> %umul.val83  store <2 x i64> %spec.select, ptr %p84  ret void85}86 87declare {i8, i1} @llvm.umul.with.overflow.i8(i8, i8)88declare {i32, i1} @llvm.umul.with.overflow.i32(i32, i32)89declare {<2 x i64>, <2 x i1>} @llvm.umul.with.overflow.v2i64(<2 x i64>, <2 x i64>)90