OSDN Git Service

Lower casting operations that involve vector types.
authorMatt Wala <wala@chromium.org>
Wed, 16 Jul 2014 17:21:30 +0000 (10:21 -0700)
committerMatt Wala <wala@chromium.org>
Wed, 16 Jul 2014 17:21:30 +0000 (10:21 -0700)
commit83b8036b4e0fb45bfc0bb7e237279dce57bea42e
treef77928b144bc5c93723e3527c48792699188c760
parente4da26f6de7afd0e0b25a7e5c6c8401b964dfa62
Lower casting operations that involve vector types.

Impacted instructions:

bitcast {v4f32, v4i32, v8i16, v16i8} <-> {v4f32, v4i32, v8i16, v16i8}
bitcast v8i1 <-> i8
bitcast v16i1 <-> i16

(There was already code present to handle trivial bitcasts like v16i1 <-> v16i1.)

[sz]ext v4i1 -> v4i32
[sz]ext v8i1 -> v8i16
[sz]ext v16i1 -> v16i8

trunc v4i32 -> v4i1
trunc v8i16 -> v8i1
trunc v16i8 -> v16i1

[su]itofp v4i32 -> v4f32
fpto[su]i v4f32 -> v4i32

Where there is a relatively simple lowering to x86 instructions, it has been used. Otherwise a helper call is used.

Some lowerings require a materialization of a integer vector with 1s in each entry. Since there is no support for vector constant pools, the constant is materialized purely through register operations.

BUG=none
R=jvoung@chromium.org, stichnot@chromium.org

Review URL: https://codereview.chromium.org/383303003
src/IceInstX8632.cpp
src/IceInstX8632.def
src/IceInstX8632.h
src/IceTargetLoweringX8632.cpp
src/IceTargetLoweringX8632.h
tests_lit/llvm2ice_tests/vector-bitcast.ll [new file with mode: 0644]
tests_lit/llvm2ice_tests/vector-cast.ll [new file with mode: 0644]