1; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 | FileCheck %s 2 3@varhalf = global half 0.0 4@varfloat = global float 0.0 5@vardouble = global double 0.0 6 7declare float @fabsf(float) readonly 8declare double @fabs(double) readonly 9 10declare float @llvm.sqrt.f32(float %Val) 11declare double @llvm.sqrt.f64(double %Val) 12 13declare float @ceilf(float) readonly 14declare double @ceil(double) readonly 15 16declare float @floorf(float) readonly 17declare double @floor(double) readonly 18 19declare float @truncf(float) readonly 20declare double @trunc(double) readonly 21 22declare float @rintf(float) readonly 23declare double @rint(double) readonly 24 25declare float @nearbyintf(float) readonly 26declare double @nearbyint(double) readonly 27 28define void @simple_float() { 29; CHECK-LABEL: simple_float: 30 %val1 = load volatile float, float* @varfloat 31 32 %valabs = call float @fabsf(float %val1) 33 store volatile float %valabs, float* @varfloat 34; CHECK: fabs {{s[0-9]+}}, {{s[0-9]+}} 35 36 %valneg = fsub float -0.0, %val1 37 store volatile float %valneg, float* @varfloat 38; CHECK: fneg {{s[0-9]+}}, {{s[0-9]+}} 39 40 %valsqrt = call float @llvm.sqrt.f32(float %val1) 41 store volatile float %valsqrt, float* @varfloat 42; CHECK: fsqrt {{s[0-9]+}}, {{s[0-9]+}} 43 44 %valceil = call float @ceilf(float %val1) 45 store volatile float %valceil, float* @varfloat 46; CHECK: frintp {{s[0-9]+}}, {{s[0-9]+}} 47 48 %valfloor = call float @floorf(float %val1) 49 store volatile float %valfloor, float* @varfloat 50; CHECK: frintm {{s[0-9]+}}, {{s[0-9]+}} 51 52 %valtrunc = call float @truncf(float %val1) 53 store volatile float %valtrunc, float* @varfloat 54; CHECK: frintz {{s[0-9]+}}, {{s[0-9]+}} 55 56 %valrint = call float @rintf(float %val1) 57 store volatile float %valrint, float* @varfloat 58; CHECK: frintx {{s[0-9]+}}, {{s[0-9]+}} 59 60 %valnearbyint = call float @nearbyintf(float %val1) 61 store volatile float %valnearbyint, float* @varfloat 62; CHECK: frinti {{s[0-9]+}}, {{s[0-9]+}} 63 64 ret void 65} 66 67define void @simple_double() { 68; CHECK-LABEL: simple_double: 69 %val1 = load volatile double, double* @vardouble 70 71 %valabs = call double @fabs(double %val1) 72 store volatile double %valabs, double* @vardouble 73; CHECK: fabs {{d[0-9]+}}, {{d[0-9]+}} 74 75 %valneg = fsub double -0.0, %val1 76 store volatile double %valneg, double* @vardouble 77; CHECK: fneg {{d[0-9]+}}, {{d[0-9]+}} 78 79 %valsqrt = call double @llvm.sqrt.f64(double %val1) 80 store volatile double %valsqrt, double* @vardouble 81; CHECK: fsqrt {{d[0-9]+}}, {{d[0-9]+}} 82 83 %valceil = call double @ceil(double %val1) 84 store volatile double %valceil, double* @vardouble 85; CHECK: frintp {{d[0-9]+}}, {{d[0-9]+}} 86 87 %valfloor = call double @floor(double %val1) 88 store volatile double %valfloor, double* @vardouble 89; CHECK: frintm {{d[0-9]+}}, {{d[0-9]+}} 90 91 %valtrunc = call double @trunc(double %val1) 92 store volatile double %valtrunc, double* @vardouble 93; CHECK: frintz {{d[0-9]+}}, {{d[0-9]+}} 94 95 %valrint = call double @rint(double %val1) 96 store volatile double %valrint, double* @vardouble 97; CHECK: frintx {{d[0-9]+}}, {{d[0-9]+}} 98 99 %valnearbyint = call double @nearbyint(double %val1) 100 store volatile double %valnearbyint, double* @vardouble 101; CHECK: frinti {{d[0-9]+}}, {{d[0-9]+}} 102 103 ret void 104} 105 106define void @converts() { 107; CHECK-LABEL: converts: 108 109 %val16 = load volatile half, half* @varhalf 110 %val32 = load volatile float, float* @varfloat 111 %val64 = load volatile double, double* @vardouble 112 113 %val16to32 = fpext half %val16 to float 114 store volatile float %val16to32, float* @varfloat 115; CHECK: fcvt {{s[0-9]+}}, {{h[0-9]+}} 116 117 %val16to64 = fpext half %val16 to double 118 store volatile double %val16to64, double* @vardouble 119; CHECK: fcvt {{d[0-9]+}}, {{h[0-9]+}} 120 121 %val32to16 = fptrunc float %val32 to half 122 store volatile half %val32to16, half* @varhalf 123; CHECK: fcvt {{h[0-9]+}}, {{s[0-9]+}} 124 125 %val32to64 = fpext float %val32 to double 126 store volatile double %val32to64, double* @vardouble 127; CHECK: fcvt {{d[0-9]+}}, {{s[0-9]+}} 128 129 %val64to16 = fptrunc double %val64 to half 130 store volatile half %val64to16, half* @varhalf 131; CHECK: fcvt {{h[0-9]+}}, {{d[0-9]+}} 132 133 %val64to32 = fptrunc double %val64 to float 134 store volatile float %val64to32, float* @varfloat 135; CHECK: fcvt {{s[0-9]+}}, {{d[0-9]+}} 136 137 ret void 138} 139