diff options
author | Tim Northover <tnorthover@apple.com> | 2013-06-28 15:29:25 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2013-06-28 15:29:25 +0000 |
commit | 7cbc21529ddd7362688bdce90a451d5451e80240 (patch) | |
tree | bc5c8166897b40a7e7f595e59b36bb329060bd37 /llvm/test/CodeGen/ARM/vcvt.ll | |
parent | 202881d1fe3a580bbdecd0b62d7fd83ae9d1b534 (diff) | |
download | bcm5719-llvm-7cbc21529ddd7362688bdce90a451d5451e80240.tar.gz bcm5719-llvm-7cbc21529ddd7362688bdce90a451d5451e80240.zip |
ARM: ensure fixed-point conversions have sane types
We were generating intrinsics for NEON fixed-point conversions that didn't
exist (e.g. float -> i16). There are two cases to consider:
+ iN is smaller than float. In this case we can do the conversion but need an
extend or truncate as well.
+ iN is larger than float. In this case using the NEON conversion would be
incorrect so we don't perform any combining.
llvm-svn: 185158
Diffstat (limited to 'llvm/test/CodeGen/ARM/vcvt.ll')
-rw-r--r-- | llvm/test/CodeGen/ARM/vcvt.ll | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/vcvt.ll b/llvm/test/CodeGen/ARM/vcvt.ll index c078f493094..9b315b1a486 100644 --- a/llvm/test/CodeGen/ARM/vcvt.ll +++ b/llvm/test/CodeGen/ARM/vcvt.ll @@ -156,3 +156,44 @@ define <4 x i16> @vcvt_f32tof16(<4 x float>* %A) nounwind { declare <4 x float> @llvm.arm.neon.vcvthf2fp(<4 x i16>) nounwind readnone declare <4 x i16> @llvm.arm.neon.vcvtfp2hf(<4 x float>) nounwind readnone + + +define <4 x i16> @fix_float_to_i16(<4 x float> %in) { +; CHECK: fix_float_to_i16: +; CHECK: vcvt.u32.f32 [[TMP:q[0-9]+]], {{q[0-9]+}}, #1 +; CHECK: vmovn.i32 {{d[0-9]+}}, [[TMP]] + + %scale = fmul <4 x float> %in, <float 2.0, float 2.0, float 2.0, float 2.0> + %conv = fptoui <4 x float> %scale to <4 x i16> + ret <4 x i16> %conv +} + +define <2 x i64> @fix_float_to_i64(<2 x float> %in) { +; CHECK: fix_float_to_i64: +; CHECK: bl +; CHECK: bl + + %scale = fmul <2 x float> %in, <float 2.0, float 2.0> + %conv = fptoui <2 x float> %scale to <2 x i64> + ret <2 x i64> %conv +} + +define <4 x i16> @fix_double_to_i16(<4 x double> %in) { +; CHECK: fix_double_to_i16: +; CHECK: vcvt.s32.f64 +; CHECK: vcvt.s32.f64 + + %scale = fmul <4 x double> %in, <double 2.0, double 2.0, double 2.0, double 2.0> + %conv = fptoui <4 x double> %scale to <4 x i16> + ret <4 x i16> %conv +} + +define <2 x i64> @fix_double_to_i64(<2 x double> %in) { +; CHECK: fix_double_to_i64: +; CHECK: bl +; CHECK: bl + %scale = fmul <2 x double> %in, <double 2.0, double 2.0> + %conv = fptoui <2 x double> %scale to <2 x i64> + ret <2 x i64> %conv +} + |