1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -instsimplify %s | FileCheck %s 3 4define float @sitofp_floor(i32 %arg) { 5; CHECK-LABEL: @sitofp_floor( 6; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float 7; CHECK-NEXT: ret float [[CVT]] 8; 9 %cvt = sitofp i32 %arg to float 10 %round = call float @llvm.floor.f32(float %cvt) 11 ret float %round 12} 13 14define float @uitofp_floor(i32 %arg) { 15; CHECK-LABEL: @uitofp_floor( 16; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float 17; CHECK-NEXT: ret float [[CVT]] 18; 19 %cvt = uitofp i32 %arg to float 20 %round = call float @llvm.floor.f32(float %cvt) 21 ret float %round 22} 23 24define float @sitofp_trunc(i32 %arg) { 25; CHECK-LABEL: @sitofp_trunc( 26; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float 27; CHECK-NEXT: ret float [[CVT]] 28; 29 %cvt = sitofp i32 %arg to float 30 %round = call float @llvm.trunc.f32(float %cvt) 31 ret float %round 32} 33 34define float @uitofp_trunc(i32 %arg) { 35; CHECK-LABEL: @uitofp_trunc( 36; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float 37; CHECK-NEXT: ret float [[CVT]] 38; 39 %cvt = uitofp i32 %arg to float 40 %round = call float @llvm.trunc.f32(float %cvt) 41 ret float %round 42} 43 44define float @sitofp_ceil(i32 %arg) { 45; CHECK-LABEL: @sitofp_ceil( 46; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float 47; CHECK-NEXT: ret float [[CVT]] 48; 49 %cvt = sitofp i32 %arg to float 50 %round = call float @llvm.ceil.f32(float %cvt) 51 ret float %round 52} 53 54define float @uitofp_ceil(i32 %arg) { 55; CHECK-LABEL: @uitofp_ceil( 56; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float 57; CHECK-NEXT: ret float [[CVT]] 58; 59 %cvt = uitofp i32 %arg to float 60 %round = call float @llvm.ceil.f32(float %cvt) 61 ret float %round 62} 63 64define float @sitofp_round(i32 %arg) { 65; CHECK-LABEL: @sitofp_round( 66; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float 67; CHECK-NEXT: ret float [[CVT]] 68; 69 %cvt = sitofp i32 %arg to float 70 %round = call float @llvm.round.f32(float %cvt) 71 ret float %round 72} 73 74define float @uitofp_round(i32 %arg) { 75; CHECK-LABEL: @uitofp_round( 76; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float 77; CHECK-NEXT: ret float [[CVT]] 78; 79 %cvt = uitofp i32 %arg to float 80 %round = call float @llvm.round.f32(float %cvt) 81 ret float %round 82} 83 84define float @uitofp_roundeven(i32 %arg) { 85; CHECK-LABEL: @uitofp_roundeven( 86; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float 87; CHECK-NEXT: ret float [[CVT]] 88; 89 %cvt = uitofp i32 %arg to float 90 %round = call float @llvm.roundeven.f32(float %cvt) 91 ret float %round 92} 93 94define float @sitofp_nearbyint(i32 %arg) { 95; CHECK-LABEL: @sitofp_nearbyint( 96; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float 97; CHECK-NEXT: ret float [[CVT]] 98; 99 %cvt = sitofp i32 %arg to float 100 %nearbyint = call float @llvm.nearbyint.f32(float %cvt) 101 ret float %nearbyint 102} 103 104define float @uitofp_nearbyint(i32 %arg) { 105; CHECK-LABEL: @uitofp_nearbyint( 106; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float 107; CHECK-NEXT: ret float [[CVT]] 108; 109 %cvt = uitofp i32 %arg to float 110 %nearbyint = call float @llvm.nearbyint.f32(float %cvt) 111 ret float %nearbyint 112} 113 114define float @sitofp_rint(i32 %arg) { 115; CHECK-LABEL: @sitofp_rint( 116; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float 117; CHECK-NEXT: ret float [[CVT]] 118; 119 %cvt = sitofp i32 %arg to float 120 %rint = call float @llvm.rint.f32(float %cvt) 121 ret float %rint 122} 123 124define float @uitofp_rint(i32 %arg) { 125; CHECK-LABEL: @uitofp_rint( 126; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float 127; CHECK-NEXT: ret float [[CVT]] 128; 129 %cvt = uitofp i32 %arg to float 130 %rint = call float @llvm.rint.f32(float %cvt) 131 ret float %rint 132} 133 134declare float @llvm.floor.f32(float) #0 135declare float @llvm.trunc.f32(float) #0 136declare float @llvm.ceil.f32(float) #0 137declare float @llvm.round.f32(float) #0 138declare float @llvm.roundeven.f32(float) #0 139declare float @llvm.nearbyint.f32(float) #0 140declare float @llvm.rint.f32(float) #0 141 142attributes #0 = { nounwind readnone speculatable } 143