1; RUN: opt -S -licm < %s | FileCheck %s 2; RUN: opt -aa-pipeline=basic-aa -passes='require<aa>,require<targetir>,require<scalar-evolution>,require<opt-remark-emit>,loop(licm)' -S %s | FileCheck %s 3; RUN: opt -S -licm -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s 4 5target datalayout = "E-m:e-p:32:32-i8:8:8-i16:16:16-i64:32:32-f64:32:32-v64:32:32-v128:32:32-a0:0:32-n32" 6 7; This test verifies that ceil, floor, nearbyint, trunc, rint, round, 8; copysign, minnum, maxnum, minimum, maximum, and fabs intrinsics are 9; considered safe to speculate. 10 11; CHECK-LABEL: @test 12; CHECK: call float @llvm.ceil.f32 13; CHECK: call float @llvm.floor.f32 14; CHECK: call float @llvm.nearbyint.f32 15; CHECK: call float @llvm.rint.f32 16; CHECK: call float @llvm.round.f32 17; CHECK: call float @llvm.trunc.f32 18; CHECK: call float @llvm.fabs.f32 19; CHECK: call float @llvm.copysign.f32 20; CHECK: call float @llvm.minnum.f32 21; CHECK: call float @llvm.maxnum.f32 22; CHECK: call float @llvm.powi.f32 23; CHECK: call float @llvm.roundeven.f32 24; CHECK: for.body: 25 26define void @test(float %arg1, float %arg2) { 27entry: 28 br label %for.head 29 30for.head: 31 %IND = phi i32 [ 0, %entry ], [ %IND.new, %for.body ] 32 %CMP = icmp slt i32 %IND, 10 33 br i1 %CMP, label %for.body, label %exit 34 35for.body: 36 %tmp.1 = call float @llvm.ceil.f32(float %arg1) 37 %tmp.2 = call float @llvm.floor.f32(float %tmp.1) 38 %tmp.3 = call float @llvm.nearbyint.f32(float %tmp.2) 39 %tmp.4 = call float @llvm.rint.f32(float %tmp.3) 40 %tmp.5 = call float @llvm.round.f32(float %tmp.4) 41 %tmp.6 = call float @llvm.trunc.f32(float %tmp.5) 42 %tmp.7 = call float @llvm.fabs.f32(float %tmp.6) 43 %tmp.8 = call float @llvm.copysign.f32(float %tmp.7, float %arg2) 44 %tmp.9 = call float @llvm.minnum.f32(float %tmp.8, float %arg2) 45 %tmp.10 = call float @llvm.maxnum.f32(float %tmp.9, float %arg2) 46 %tmp.11 = call float @llvm.minimum.f32(float %tmp.10, float %arg2) 47 %tmp.12 = call float @llvm.maximum.f32(float %tmp.11, float %arg2) 48 %tmp.13 = call float @llvm.powi.f32(float %tmp.12, i32 4) 49 %tmp.14 = call float @llvm.roundeven.f32(float %tmp.13) 50 call void @consume(float %tmp.14) 51 %IND.new = add i32 %IND, 1 52 br label %for.head 53 54exit: 55 ret void 56} 57 58declare void @consume(float) 59 60declare float @llvm.ceil.f32(float) 61declare float @llvm.floor.f32(float) 62declare float @llvm.nearbyint.f32(float) 63declare float @llvm.rint.f32(float) 64declare float @llvm.round.f32(float) 65declare float @llvm.trunc.f32(float) 66declare float @llvm.fabs.f32(float) 67declare float @llvm.copysign.f32(float, float) 68declare float @llvm.minnum.f32(float, float) 69declare float @llvm.maxnum.f32(float, float) 70declare float @llvm.minimum.f32(float, float) 71declare float @llvm.maximum.f32(float, float) 72declare float @llvm.powi.f32(float, i32) 73declare float @llvm.roundeven.f32(float) 74