1; RUN: llc < %s -mtriple=x86_64-apple-darwin -march=x86 -mcpu=corei7-avx | FileCheck %s 2 3 4define <2 x double> @floor_v2f64(<2 x double> %p) 5{ 6 ; CHECK: floor_v2f64 7 ; CHECK: vroundpd 8 %t = call <2 x double> @llvm.floor.v2f64(<2 x double> %p) 9 ret <2 x double> %t 10} 11declare <2 x double> @llvm.floor.v2f64(<2 x double> %p) 12 13define <4 x float> @floor_v4f32(<4 x float> %p) 14{ 15 ; CHECK: floor_v4f32 16 ; CHECK: vroundps 17 %t = call <4 x float> @llvm.floor.v4f32(<4 x float> %p) 18 ret <4 x float> %t 19} 20declare <4 x float> @llvm.floor.v4f32(<4 x float> %p) 21 22define <4 x double> @floor_v4f64(<4 x double> %p) 23{ 24 ; CHECK: floor_v4f64 25 ; CHECK: vroundpd 26 %t = call <4 x double> @llvm.floor.v4f64(<4 x double> %p) 27 ret <4 x double> %t 28} 29declare <4 x double> @llvm.floor.v4f64(<4 x double> %p) 30 31define <8 x float> @floor_v8f32(<8 x float> %p) 32{ 33 ; CHECK: floor_v8f32 34 ; CHECK: vroundps 35 %t = call <8 x float> @llvm.floor.v8f32(<8 x float> %p) 36 ret <8 x float> %t 37} 38declare <8 x float> @llvm.floor.v8f32(<8 x float> %p) 39 40define <2 x double> @ceil_v2f64(<2 x double> %p) 41{ 42 ; CHECK: ceil_v2f64 43 ; CHECK: vroundpd 44 %t = call <2 x double> @llvm.ceil.v2f64(<2 x double> %p) 45 ret <2 x double> %t 46} 47declare <2 x double> @llvm.ceil.v2f64(<2 x double> %p) 48 49define <4 x float> @ceil_v4f32(<4 x float> %p) 50{ 51 ; CHECK: ceil_v4f32 52 ; CHECK: vroundps 53 %t = call <4 x float> @llvm.ceil.v4f32(<4 x float> %p) 54 ret <4 x float> %t 55} 56declare <4 x float> @llvm.ceil.v4f32(<4 x float> %p) 57 58define <4 x double> @ceil_v4f64(<4 x double> %p) 59{ 60 ; CHECK: ceil_v4f64 61 ; CHECK: vroundpd 62 %t = call <4 x double> @llvm.ceil.v4f64(<4 x double> %p) 63 ret <4 x double> %t 64} 65declare <4 x double> @llvm.ceil.v4f64(<4 x double> %p) 66 67define <8 x float> @ceil_v8f32(<8 x float> %p) 68{ 69 ; CHECK: ceil_v8f32 70 ; CHECK: vroundps 71 %t = call <8 x float> @llvm.ceil.v8f32(<8 x float> %p) 72 ret <8 x float> %t 73} 74declare <8 x float> @llvm.ceil.v8f32(<8 x float> %p) 75 76define <2 x double> @trunc_v2f64(<2 x double> %p) 77{ 78 ; CHECK: trunc_v2f64 79 ; CHECK: vroundpd 80 %t = call <2 x double> @llvm.trunc.v2f64(<2 x double> %p) 81 ret <2 x double> %t 82} 83declare <2 x double> @llvm.trunc.v2f64(<2 x double> %p) 84 85define <4 x float> @trunc_v4f32(<4 x float> %p) 86{ 87 ; CHECK: trunc_v4f32 88 ; CHECK: vroundps 89 %t = call <4 x float> @llvm.trunc.v4f32(<4 x float> %p) 90 ret <4 x float> %t 91} 92declare <4 x float> @llvm.trunc.v4f32(<4 x float> %p) 93 94define <4 x double> @trunc_v4f64(<4 x double> %p) 95{ 96 ; CHECK: trunc_v4f64 97 ; CHECK: vroundpd 98 %t = call <4 x double> @llvm.trunc.v4f64(<4 x double> %p) 99 ret <4 x double> %t 100} 101declare <4 x double> @llvm.trunc.v4f64(<4 x double> %p) 102 103define <8 x float> @trunc_v8f32(<8 x float> %p) 104{ 105 ; CHECK: trunc_v8f32 106 ; CHECK: vroundps 107 %t = call <8 x float> @llvm.trunc.v8f32(<8 x float> %p) 108 ret <8 x float> %t 109} 110declare <8 x float> @llvm.trunc.v8f32(<8 x float> %p) 111 112define <2 x double> @rint_v2f64(<2 x double> %p) 113{ 114 ; CHECK: rint_v2f64 115 ; CHECK: vroundpd 116 %t = call <2 x double> @llvm.rint.v2f64(<2 x double> %p) 117 ret <2 x double> %t 118} 119declare <2 x double> @llvm.rint.v2f64(<2 x double> %p) 120 121define <4 x float> @rint_v4f32(<4 x float> %p) 122{ 123 ; CHECK: rint_v4f32 124 ; CHECK: vroundps 125 %t = call <4 x float> @llvm.rint.v4f32(<4 x float> %p) 126 ret <4 x float> %t 127} 128declare <4 x float> @llvm.rint.v4f32(<4 x float> %p) 129 130define <4 x double> @rint_v4f64(<4 x double> %p) 131{ 132 ; CHECK: rint_v4f64 133 ; CHECK: vroundpd 134 %t = call <4 x double> @llvm.rint.v4f64(<4 x double> %p) 135 ret <4 x double> %t 136} 137declare <4 x double> @llvm.rint.v4f64(<4 x double> %p) 138 139define <8 x float> @rint_v8f32(<8 x float> %p) 140{ 141 ; CHECK: rint_v8f32 142 ; CHECK: vroundps 143 %t = call <8 x float> @llvm.rint.v8f32(<8 x float> %p) 144 ret <8 x float> %t 145} 146declare <8 x float> @llvm.rint.v8f32(<8 x float> %p) 147 148define <2 x double> @nearbyint_v2f64(<2 x double> %p) 149{ 150 ; CHECK: nearbyint_v2f64 151 ; CHECK: vroundpd 152 %t = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %p) 153 ret <2 x double> %t 154} 155declare <2 x double> @llvm.nearbyint.v2f64(<2 x double> %p) 156 157define <4 x float> @nearbyint_v4f32(<4 x float> %p) 158{ 159 ; CHECK: nearbyint_v4f32 160 ; CHECK: vroundps 161 %t = call <4 x float> @llvm.nearbyint.v4f32(<4 x float> %p) 162 ret <4 x float> %t 163} 164declare <4 x float> @llvm.nearbyint.v4f32(<4 x float> %p) 165 166define <4 x double> @nearbyint_v4f64(<4 x double> %p) 167{ 168 ; CHECK: nearbyint_v4f64 169 ; CHECK: vroundpd 170 %t = call <4 x double> @llvm.nearbyint.v4f64(<4 x double> %p) 171 ret <4 x double> %t 172} 173declare <4 x double> @llvm.nearbyint.v4f64(<4 x double> %p) 174 175define <8 x float> @nearbyint_v8f32(<8 x float> %p) 176{ 177 ; CHECK: nearbyint_v8f32 178 ; CHECK: vroundps 179 %t = call <8 x float> @llvm.nearbyint.v8f32(<8 x float> %p) 180 ret <8 x float> %t 181} 182declare <8 x float> @llvm.nearbyint.v8f32(<8 x float> %p) 183 184; 185; Constant Folding 186; 187 188define <2 x double> @const_floor_v2f64() { 189 ; CHECK: const_floor_v2f64 190 ; CHECK: movaps {{.*#+}} xmm0 = [-2.000000e+00,2.000000e+00] 191 %t = call <2 x double> @llvm.floor.v2f64(<2 x double> <double -1.5, double 2.5>) 192 ret <2 x double> %t 193} 194 195define <4 x float> @const_floor_v4f32() { 196 ; CHECK: const_floor_v4f32 197 ; CHECK: movaps {{.*#+}} xmm0 = [-4.000000e+00,6.000000e+00,-9.000000e+00,2.000000e+00] 198 %t = call <4 x float> @llvm.floor.v4f32(<4 x float> <float -3.5, float 6.0, float -9.0, float 2.5>) 199 ret <4 x float> %t 200} 201 202define <2 x double> @const_ceil_v2f64() { 203 ; CHECK: const_ceil_v2f64 204 ; CHECK: movaps {{.*#+}} xmm0 = [-1.000000e+00,3.000000e+00] 205 %t = call <2 x double> @llvm.ceil.v2f64(<2 x double> <double -1.5, double 2.5>) 206 ret <2 x double> %t 207} 208 209define <4 x float> @const_ceil_v4f32() { 210 ; CHECK: const_ceil_v4f32 211 ; CHECK: movaps {{.*#+}} xmm0 = [-3.000000e+00,6.000000e+00,-9.000000e+00,3.000000e+00] 212 %t = call <4 x float> @llvm.ceil.v4f32(<4 x float> <float -3.5, float 6.0, float -9.0, float 2.5>) 213 ret <4 x float> %t 214} 215 216define <2 x double> @const_trunc_v2f64() { 217 ; CHECK: const_trunc_v2f64 218 ; CHECK: movaps {{.*#+}} xmm0 = [-1.000000e+00,2.000000e+00] 219 %t = call <2 x double> @llvm.trunc.v2f64(<2 x double> <double -1.5, double 2.5>) 220 ret <2 x double> %t 221} 222 223define <4 x float> @const_trunc_v4f32() { 224 ; CHECK: const_trunc_v4f32 225 ; CHECK: movaps {{.*#+}} xmm0 = [-3.000000e+00,6.000000e+00,-9.000000e+00,2.000000e+00] 226 %t = call <4 x float> @llvm.trunc.v4f32(<4 x float> <float -3.5, float 6.0, float -9.0, float 2.5>) 227 ret <4 x float> %t 228} 229