1; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s 2 3declare float @fabsf(float) 4 5declare float @fminf(float, float) 6declare double @fmin(double, double) 7declare float @llvm.minnum.f32(float, float) 8declare double @llvm.minnum.f64(double, double) 9 10declare float @fmaxf(float, float) 11declare double @fmax(double, double) 12declare float @llvm.maxnum.f32(float, float) 13declare double @llvm.maxnum.f64(double, double) 14 15declare <4 x float> @llvm.minnum.v4f32(<4 x float>, <4 x float>) 16declare <4 x double> @llvm.minnum.v4f64(<4 x double>, <4 x double>) 17declare <4 x float> @llvm.maxnum.v4f32(<4 x float>, <4 x float>) 18declare <4 x double> @llvm.maxnum.v4f64(<4 x double>, <4 x double>) 19 20define void @test1(float %f, float* %fp) { 21entry: 22 br label %loop_body 23 24loop_body: 25 %invar_address.dim.0.01 = phi i64 [ 0, %entry ], [ %1, %loop_body ] 26 %0 = call float @llvm.minnum.f32(float %f, float 1.0) 27 store float %0, float* %fp, align 4 28 %1 = add i64 %invar_address.dim.0.01, 1 29 %2 = icmp eq i64 %1, 2 30 br i1 %2, label %loop_exit, label %loop_body 31 32loop_exit: 33 ret void 34} 35 36; CHECK-LABEL: test1: 37; CHECK-NOT: mtctr 38; CHECK: xsmindp 39; CHECK-NOT: xsmindp 40; CHECK-NOT: mtctr 41; CHECK: blr 42 43define void @test1v(<4 x float> %f, <4 x float>* %fp) { 44entry: 45 br label %loop_body 46 47loop_body: 48 %invar_address.dim.0.01 = phi i64 [ 0, %entry ], [ %1, %loop_body ] 49 %0 = call <4 x float> @llvm.minnum.v4f32(<4 x float> %f, <4 x float> <float 1.0, float 1.0, float 1.0, float 1.0>) 50 store <4 x float> %0, <4 x float>* %fp, align 16 51 %1 = add i64 %invar_address.dim.0.01, 1 52 %2 = icmp eq i64 %1, 4 53 br i1 %2, label %loop_exit, label %loop_body 54 55loop_exit: 56 ret void 57} 58 59; CHECK-LABEL: test1v: 60; CHECK: xvminsp 61; CHECK-NOT: xsmindp 62; CHECK: mtctr 63; CHECK-NOT: xsmindp 64; CHECK: blr 65 66define void @test1a(float %f, float* %fp) { 67entry: 68 br label %loop_body 69 70loop_body: 71 %invar_address.dim.0.01 = phi i64 [ 0, %entry ], [ %1, %loop_body ] 72 %0 = call float @fminf(float %f, float 1.0) readnone 73 store float %0, float* %fp, align 4 74 %1 = add i64 %invar_address.dim.0.01, 1 75 %2 = icmp eq i64 %1, 2 76 br i1 %2, label %loop_exit, label %loop_body 77 78loop_exit: 79 ret void 80} 81 82; CHECK-LABEL: test1a: 83; CHECK-NOT: mtctr 84; CHECK: xsmindp 85; CHECK-NOT: xsmindp 86; CHECK-NOT: mtctr 87; CHECK: blr 88 89define void @test2(float %f, float* %fp) { 90entry: 91 br label %loop_body 92 93loop_body: 94 %invar_address.dim.0.01 = phi i64 [ 0, %entry ], [ %1, %loop_body ] 95 %0 = call float @llvm.maxnum.f32(float %f, float 1.0) 96 store float %0, float* %fp, align 4 97 %1 = add i64 %invar_address.dim.0.01, 1 98 %2 = icmp eq i64 %1, 2 99 br i1 %2, label %loop_exit, label %loop_body 100 101loop_exit: 102 ret void 103} 104 105; CHECK-LABEL: test2: 106; CHECK-NOT: mtctr 107; CHECK: xsmaxdp 108; CHECK-NOT: xsmaxdp 109; CHECK-NOT: mtctr 110; CHECK: blr 111 112define void @test2v(<4 x double> %f, <4 x double>* %fp) { 113entry: 114 br label %loop_body 115 116loop_body: 117 %invar_address.dim.0.01 = phi i64 [ 0, %entry ], [ %1, %loop_body ] 118 %0 = call <4 x double> @llvm.maxnum.v4f64(<4 x double> %f, <4 x double> <double 1.0, double 1.0, double 1.0, double 1.0>) 119 store <4 x double> %0, <4 x double>* %fp, align 16 120 %1 = add i64 %invar_address.dim.0.01, 1 121 %2 = icmp eq i64 %1, 4 122 br i1 %2, label %loop_exit, label %loop_body 123 124loop_exit: 125 ret void 126} 127 128; CHECK-LABEL: test2v: 129; CHECK: xvmaxdp 130; CHECK: xvmaxdp 131; CHECK-NOT: xsmaxdp 132; CHECK: mtctr 133; CHECK-NOT: xsmaxdp 134; CHECK: blr 135 136define void @test2a(float %f, float* %fp) { 137entry: 138 br label %loop_body 139 140loop_body: 141 %invar_address.dim.0.01 = phi i64 [ 0, %entry ], [ %1, %loop_body ] 142 %0 = call float @fmaxf(float %f, float 1.0) readnone 143 store float %0, float* %fp, align 4 144 %1 = add i64 %invar_address.dim.0.01, 1 145 %2 = icmp eq i64 %1, 2 146 br i1 %2, label %loop_exit, label %loop_body 147 148loop_exit: 149 ret void 150} 151 152; CHECK-LABEL: test2a: 153; CHECK-NOT: mtctr 154; CHECK: xsmaxdp 155; CHECK-NOT: xsmaxdp 156; CHECK-NOT: mtctr 157; CHECK: blr 158 159define void @test3(double %f, double* %fp) { 160entry: 161 br label %loop_body 162 163loop_body: 164 %invar_address.dim.0.01 = phi i64 [ 0, %entry ], [ %1, %loop_body ] 165 %0 = call double @llvm.minnum.f64(double %f, double 1.0) 166 store double %0, double* %fp, align 8 167 %1 = add i64 %invar_address.dim.0.01, 1 168 %2 = icmp eq i64 %1, 2 169 br i1 %2, label %loop_exit, label %loop_body 170 171loop_exit: 172 ret void 173} 174 175; CHECK-LABEL: test3: 176; CHECK-NOT: mtctr 177; CHECK: xsmindp 178; CHECK-NOT: xsmindp 179; CHECK-NOT: mtctr 180; CHECK: blr 181 182define void @test3a(double %f, double* %fp) { 183entry: 184 br label %loop_body 185 186loop_body: 187 %invar_address.dim.0.01 = phi i64 [ 0, %entry ], [ %1, %loop_body ] 188 %0 = call double @fmin(double %f, double 1.0) readnone 189 store double %0, double* %fp, align 8 190 %1 = add i64 %invar_address.dim.0.01, 1 191 %2 = icmp eq i64 %1, 2 192 br i1 %2, label %loop_exit, label %loop_body 193 194loop_exit: 195 ret void 196} 197 198; CHECK-LABEL: test3a: 199; CHECK-NOT: mtctr 200; CHECK: xsmindp 201; CHECK-NOT: xsmindp 202; CHECK-NOT: mtctr 203; CHECK: blr 204 205define void @test4(double %f, double* %fp) { 206entry: 207 br label %loop_body 208 209loop_body: 210 %invar_address.dim.0.01 = phi i64 [ 0, %entry ], [ %1, %loop_body ] 211 %0 = call double @llvm.maxnum.f64(double %f, double 1.0) 212 store double %0, double* %fp, align 8 213 %1 = add i64 %invar_address.dim.0.01, 1 214 %2 = icmp eq i64 %1, 2 215 br i1 %2, label %loop_exit, label %loop_body 216 217loop_exit: 218 ret void 219} 220 221; CHECK-LABEL: test4: 222; CHECK-NOT: mtctr 223; CHECK: xsmaxdp 224; CHECK-NOT: xsmaxdp 225; CHECK-NOT: mtctr 226; CHECK: blr 227 228define void @test4a(double %f, double* %fp) { 229entry: 230 br label %loop_body 231 232loop_body: 233 %invar_address.dim.0.01 = phi i64 [ 0, %entry ], [ %1, %loop_body ] 234 %0 = call double @fmax(double %f, double 1.0) readnone 235 store double %0, double* %fp, align 8 236 %1 = add i64 %invar_address.dim.0.01, 1 237 %2 = icmp eq i64 %1, 2 238 br i1 %2, label %loop_exit, label %loop_body 239 240loop_exit: 241 ret void 242} 243 244; CHECK-LABEL: test4a: 245; CHECK-NOT: mtctr 246; CHECK: xsmaxdp 247; CHECK-NOT: xsmaxdp 248; CHECK-NOT: mtctr 249; CHECK: blr 250 251