diff options
author | Elena Demikhovsky <elena.demikhovsky@intel.com> | 2013-08-05 12:17:06 +0000 |
---|---|---|
committer | Elena Demikhovsky <elena.demikhovsky@intel.com> | 2013-08-05 12:17:06 +0000 |
commit | cf21d155ed16c6eb9a2c0a5fa2e7f6a19e488476 (patch) | |
tree | f4a46127a1e3cd82788d538113d6e72d55466286 /test | |
parent | 93795574785de252703591e7fcc8f052c762f25e (diff) | |
download | external_llvm-cf21d155ed16c6eb9a2c0a5fa2e7f6a19e488476.zip external_llvm-cf21d155ed16c6eb9a2c0a5fa2e7f6a19e488476.tar.gz external_llvm-cf21d155ed16c6eb9a2c0a5fa2e7f6a19e488476.tar.bz2 |
LLVM Interpreter: This patch implements vector support for cast operations (zext, sext, uitofp, sitofp, trunc, fpext, fptosi, fptrunc, bitcast) and shift operations (shl, ashr, lshr) for integer and floating point data types.
Added tests.
Done by Yuri Veselov (mailto:Yuri.Veselov@intel.com).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187724 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/ExecutionEngine/test-interp-vec-cast.ll | 146 | ||||
-rw-r--r-- | test/ExecutionEngine/test-interp-vec-shift.ll | 32 |
2 files changed, 178 insertions, 0 deletions
diff --git a/test/ExecutionEngine/test-interp-vec-cast.ll b/test/ExecutionEngine/test-interp-vec-cast.ll new file mode 100644 index 0000000..3f9f666 --- /dev/null +++ b/test/ExecutionEngine/test-interp-vec-cast.ll @@ -0,0 +1,146 @@ +; RUN: %lli -force-interpreter=true %s > /dev/null + +define i32 @main() { + zext <2 x i1> <i1 true,i1 true> to <2 x i8> + zext <3 x i1> <i1 true,i1 true,i1 true> to <3 x i8> + zext <2 x i1> <i1 true,i1 true> to <2 x i16> + zext <3 x i1> <i1 true,i1 true,i1 true> to <3 x i16> + zext <2 x i1> <i1 true,i1 true> to <2 x i32> + zext <3 x i1> <i1 true,i1 true,i1 true> to <3 x i32> + zext <2 x i1> <i1 true,i1 true> to <2 x i64> + zext <3 x i1> <i1 true,i1 true,i1 true> to <3 x i64> + zext <3 x i8> <i8 4, i8 4, i8 4> to <3 x i16> + zext <2 x i8> <i8 -4, i8 -4> to <2 x i16> + zext <3 x i8> <i8 4, i8 4, i8 4> to <3 x i32> + zext <2 x i8> <i8 -4, i8 -4> to <2 x i32> + zext <3 x i8> <i8 4, i8 4, i8 4> to <3 x i64> + zext <2 x i8> <i8 -4, i8 -4> to <2 x i64> + zext <3 x i16> <i16 4, i16 4, i16 4> to <3 x i32> + zext <2 x i16> <i16 -4, i16 -4> to <2 x i32> + zext <3 x i16> <i16 4, i16 4, i16 4> to <3 x i64> + zext <2 x i16> <i16 -4, i16 -4> to <2 x i64> + zext <3 x i32> <i32 4, i32 4, i32 4> to <3 x i64> + zext <2 x i32> <i32 -4, i32 -4> to <2 x i64> + + + sext <2 x i1> <i1 true,i1 true> to <2 x i8> + sext <3 x i1> <i1 true,i1 false,i1 true> to <3 x i8> + sext <2 x i1> <i1 true,i1 true> to <2 x i16> + sext <3 x i1> <i1 true,i1 false,i1 true> to <3 x i16> + sext <2 x i1> <i1 true,i1 true> to <2 x i32> + sext <3 x i1> <i1 true,i1 false,i1 true> to <3 x i32> + sext <2 x i1> <i1 true,i1 true> to <2 x i64> + sext <3 x i1> <i1 true,i1 false,i1 true> to <3 x i64> + sext <3 x i8> <i8 -4, i8 0, i8 4> to <3 x i16> + sext <2 x i8> <i8 -4, i8 4> to <2 x i16> + sext <3 x i8> <i8 -4, i8 0, i8 4> to <3 x i32> + sext <2 x i8> <i8 -4, i8 4> to <2 x i32> + sext <3 x i8> <i8 -4, i8 0, i8 4> to <3 x i64> + sext <2 x i8> <i8 -4, i8 4> to <2 x i64> + sext <3 x i16> <i16 -4, i16 0, i16 4> to <3 x i32> + sext <2 x i16> <i16 -4, i16 4> to <2 x i32> + sext <3 x i16> <i16 -4, i16 0, i16 4> to <3 x i64> + sext <2 x i16> <i16 -4, i16 4> to <2 x i64> + sext <3 x i32> <i32 -4, i32 0, i32 4> to <3 x i64> + sext <2 x i32> <i32 -4, i32 4> to <2 x i64> + + + uitofp <3 x i1> <i1 true,i1 false,i1 true> to <3 x float> + uitofp <2 x i1> <i1 true,i1 true> to <2 x double> + uitofp <3 x i8> <i8 -4,i8 0,i8 4> to <3 x float> + uitofp <2 x i8> <i8 -4,i8 4> to <2 x double> + uitofp <3 x i16> <i16 -4,i16 0,i16 4> to <3 x float> + uitofp <2 x i16> <i16 -4,i16 4> to <2 x double> + uitofp <3 x i32> <i32 -4,i32 0,i32 4> to <3 x float> + uitofp <2 x i32> <i32 -4,i32 4> to <2 x double> + uitofp <3 x i64> <i64 -4,i64 0,i64 4> to <3 x float> + uitofp <2 x i64> <i64 -4,i64 4> to <2 x double> + + + sitofp <3 x i1> <i1 true,i1 false,i1 true> to <3 x float> + sitofp <2 x i1> <i1 true,i1 true> to <2 x double> + sitofp <3 x i8> <i8 -4,i8 0,i8 4> to <3 x float> + sitofp <2 x i8> <i8 -4,i8 4> to <2 x double> + sitofp <3 x i16> <i16 -4,i16 0,i16 4> to <3 x float> + sitofp <2 x i16> <i16 -4,i16 4> to <2 x double> + sitofp <3 x i32> <i32 -4,i32 0,i32 4> to <3 x float> + sitofp <2 x i32> <i32 -4,i32 4> to <2 x double> + sitofp <3 x i64> <i64 -4,i64 0,i64 4> to <3 x float> + sitofp <2 x i64> <i64 -4,i64 4> to <2 x double> + + trunc <2 x i16> <i16 -6, i16 6> to <2 x i8> + trunc <3 x i16> <i16 -6, i16 6, i16 0> to <3 x i8> + trunc <2 x i32> <i32 -6, i32 6> to <2 x i8> + trunc <3 x i32> <i32 -6, i32 6, i32 0> to <3 x i8> + trunc <2 x i32> <i32 -6, i32 6> to <2 x i16> + trunc <3 x i32> <i32 -6, i32 6, i32 0> to <3 x i16> + trunc <2 x i64> <i64 -6, i64 6> to <2 x i8> + trunc <3 x i64> <i64 -6, i64 6, i64 0> to <3 x i8> + trunc <2 x i64> <i64 -6, i64 6> to <2 x i16> + trunc <3 x i64> <i64 -6, i64 6, i64 0> to <3 x i16> + trunc <2 x i64> <i64 -6, i64 6> to <2 x i32> + trunc <3 x i64> <i64 -6, i64 6, i64 0> to <3 x i32> + + + fpext <2 x float> < float 0.000000e+00, float 1.0> to <2 x double> + fpext <3 x float> < float 0.000000e+00, float -1.0, float 1.0> to <3 x double> + + fptosi <2 x double> < double 0.000000e+00, double 1.0> to <2 x i8> + fptosi <3 x double> < double 0.000000e+00, double 1.0, double -1.0> to <3 x i8> + fptosi <2 x double> < double 0.000000e+00, double 1.0> to <2 x i16> + fptosi <3 x double> < double 0.000000e+00, double 1.0, double -1.0> to <3 x i16> + fptosi <2 x double> < double 0.000000e+00, double 1.0> to <2 x i32> + fptosi <3 x double> < double 0.000000e+00, double 1.0, double -1.0> to <3 x i32> + fptosi <2 x double> < double 0.000000e+00, double 1.0> to <2 x i64> + fptosi <3 x double> < double 0.000000e+00, double 1.0, double -1.0> to <3 x i64> + + fptoui <2 x double> < double 0.000000e+00, double 1.0> to <2 x i8> + fptoui <3 x double> < double 0.000000e+00, double 1.0, double -1.0> to <3 x i8> + fptoui <2 x double> < double 0.000000e+00, double 1.0> to <2 x i16> + fptoui <3 x double> < double 0.000000e+00, double 1.0, double -1.0> to <3 x i16> + fptoui <2 x double> < double 0.000000e+00, double 1.0> to <2 x i32> + fptoui <3 x double> < double 0.000000e+00, double 1.0, double -1.0> to <3 x i32> + fptoui <2 x double> < double 0.000000e+00, double 1.0> to <2 x i64> + fptoui <3 x double> < double 0.000000e+00, double 1.0, double -1.0> to <3 x i64> + + fptrunc <2 x double> < double 0.000000e+00, double 1.0> to <2 x float> + fptrunc <3 x double> < double 0.000000e+00, double 1.0, double -1.0> to <3 x float> + + bitcast <8 x i8> <i8 0, i8 -1, i8 2, i8 -3, i8 4, i8 -5, i8 6, i8 -7> to <4 x i16> + bitcast <8 x i8> <i8 0, i8 -1, i8 2, i8 -3, i8 4, i8 -5, i8 6, i8 -7> to <2 x i32> + bitcast <8 x i8> <i8 0, i8 -1, i8 2, i8 -3, i8 4, i8 -5, i8 6, i8 -7> to i64 + bitcast <8 x i8> <i8 0, i8 -1, i8 2, i8 -3, i8 4, i8 -5, i8 6, i8 -7> to <2 x float> + bitcast <8 x i8> <i8 0, i8 -1, i8 2, i8 -3, i8 4, i8 -5, i8 6, i8 -7> to double + + bitcast <4 x i16> <i16 0, i16 -1, i16 2, i16 -3> to <8 x i8> + bitcast <4 x i16> <i16 0, i16 -1, i16 2, i16 -3> to <2 x i32> + bitcast <4 x i16> <i16 0, i16 -1, i16 2, i16 -3> to i64 + bitcast <4 x i16> <i16 0, i16 -1, i16 2, i16 -3> to <2 x float> + bitcast <4 x i16> <i16 0, i16 -1, i16 2, i16 -3> to double + + bitcast <2 x i32> <i32 1, i32 -1> to <8 x i8> + bitcast <2 x i32> <i32 1, i32 -1> to <4 x i16> + bitcast <2 x i32> <i32 1, i32 -1> to i64 + bitcast <2 x i32> <i32 1, i32 -1> to <2 x float> + bitcast <2 x i32> <i32 1, i32 -1> to double + + bitcast i64 1 to <8 x i8> + bitcast i64 1 to <4 x i16> + bitcast i64 1 to <2 x i32> + bitcast i64 1 to <2 x float> + bitcast i64 1 to double + + bitcast <2 x float> <float 1.0, float -1.0> to <8 x i8> + bitcast <2 x float> <float 1.0, float -1.0> to <4 x i16> + bitcast <2 x float> <float 1.0, float -1.0> to i64 + bitcast <2 x float> <float 1.0, float -1.0> to <2 x i32> + bitcast <2 x float> <float 1.0, float -1.0> to double + + bitcast double 1.0 to <8 x i8> + bitcast double 1.0 to <4 x i16> + bitcast double 1.0 to <2 x i32> + bitcast double 1.0 to <2 x float> + bitcast double 1.0 to i64 + + ret i32 0 +} diff --git a/test/ExecutionEngine/test-interp-vec-shift.ll b/test/ExecutionEngine/test-interp-vec-shift.ll new file mode 100644 index 0000000..3aa4f4e --- /dev/null +++ b/test/ExecutionEngine/test-interp-vec-shift.ll @@ -0,0 +1,32 @@ +; RUN: %lli -force-interpreter=true %s > /dev/null + +define i32 @main() { + %shamt = add <2 x i8> <i8 0, i8 0>, <i8 1, i8 2> + %shift.upgrd.1 = zext <2 x i8> %shamt to <2 x i32> + %t1.s = shl <2 x i32> <i32 1, i32 2>, %shift.upgrd.1 + %t2.s = shl <2 x i32> <i32 1, i32 2>, <i32 3, i32 4> + %shift.upgrd.2 = zext <2 x i8> %shamt to <2 x i32> + %t1 = shl <2 x i32> <i32 1, i32 2>, %shift.upgrd.2 + %t2 = shl <2 x i32> <i32 1, i32 0>, <i32 5, i32 6> + %t2.s.upgrd.3 = shl <2 x i64> <i64 1, i64 2>, <i64 3, i64 4> + %t2.upgrd.4 = shl <2 x i64> <i64 1, i64 2>, <i64 6, i64 7> + %shift.upgrd.5 = zext <2 x i8> %shamt to <2 x i32> + %tr1.s = ashr <2 x i32> <i32 1, i32 2>, %shift.upgrd.5 + %tr2.s = ashr <2 x i32> <i32 1, i32 2>, <i32 4, i32 5> + %shift.upgrd.6 = zext <2 x i8> %shamt to <2 x i32> + %tr1 = lshr <2 x i32> <i32 1, i32 2>, %shift.upgrd.6 + %tr2 = lshr <2 x i32> <i32 1, i32 2>, <i32 5, i32 6> + %tr1.l = ashr <2 x i64> <i64 1, i64 2>, <i64 4, i64 5> + %shift.upgrd.7 = zext <2 x i8> %shamt to <2 x i64> + %tr2.l = ashr <2 x i64> <i64 1, i64 2>, %shift.upgrd.7 + %tr3.l = shl <2 x i64> <i64 1, i64 2>, <i64 4, i64 5> + %shift.upgrd.8 = zext <2 x i8> %shamt to <2 x i64> + %tr4.l = shl <2 x i64> <i64 1, i64 2>, %shift.upgrd.8 + %tr1.u = lshr <2 x i64> <i64 1, i64 2>, <i64 5, i64 6> + %shift.upgrd.9 = zext <2 x i8> %shamt to <2 x i64> + %tr2.u = lshr <2 x i64> <i64 1, i64 2>, %shift.upgrd.9 + %tr3.u = shl <2 x i64> <i64 1, i64 2>, <i64 5, i64 6> + %shift.upgrd.10 = zext <2 x i8> %shamt to <2 x i64> + %tr4.u = shl <2 x i64> <i64 1, i64 2>, %shift.upgrd.10 + ret i32 0 +} |