llvm-6502/test/CodeGen/X86/vec_cast2.ll
Chandler Carruth cdbdfa28d1 [x86,SDAG] Introduce any- and sign-extend-vector-inreg nodes analogous
to the zero-extend-vector-inreg node introduced previously for the same
purpose: manage the type legalization of widened extend operations,
especially to support the experimental widening mode for x86.

I'm adding both because sign-extend is expanded in terms of any-extend
with shifts to propagate the sign bit. This removes the last
fundamental scalarization from vec_cast2.ll (a test case that hit many
really bad edge cases for widening legalization), although the trunc
tests in that file still appear scalarized because the the shuffle
legalization is scalarizing. Funny thing, I've been working on that.

Some initial experiments with this and SSE2 scenarios is showing
moderately good behavior already for sign extension. Still some work to
do on the shuffle combining on X86 before we're generating optimal
sequences, but avoiding scalarization is a huge step forward.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212714 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-10 12:32:32 +00:00

77 lines
2.0 KiB
LLVM

; RUN: llc < %s -mtriple=i386-apple-darwin10 -mcpu=corei7-avx -mattr=+avx | FileCheck %s
; RUN: llc < %s -mtriple=i386-apple-darwin10 -mcpu=corei7-avx -mattr=+avx -x86-experimental-vector-widening-legalization | FileCheck %s --check-prefix=CHECK-WIDE
;CHECK-LABEL: foo1_8:
;CHECK: vcvtdq2ps
;CHECK: ret
;
;CHECK-WIDE-LABEL: foo1_8:
;CHECK-WIDE: vpmovzxbd %xmm0, %xmm1
;CHECK-WIDE-NEXT: vpslld $24, %xmm1, %xmm1
;CHECK-WIDE-NEXT: vpsrad $24, %xmm1, %xmm1
;CHECK-WIDE-NEXT: vpshufb {{.*}}, %xmm0, %xmm0
;CHECK-WIDE-NEXT: vpslld $24, %xmm0, %xmm0
;CHECK-WIDE-NEXT: vpsrad $24, %xmm0, %xmm0
;CHECK-WIDE-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
;CHECK-WIDE-NEXT: vcvtdq2ps %ymm0, %ymm0
;CHECK-WIDE-NEXT: ret
define <8 x float> @foo1_8(<8 x i8> %src) {
%res = sitofp <8 x i8> %src to <8 x float>
ret <8 x float> %res
}
;CHECK-LABEL: foo1_4:
;CHECK: vcvtdq2ps
;CHECK: ret
;
;CHECK-WIDE-LABEL: foo1_4:
;CHECK-WIDE: vpmovzxbd %xmm0, %xmm0
;CHECK-WIDE-NEXT: vpslld $24, %xmm0, %xmm0
;CHECK-WIDE-NEXT: vpsrad $24, %xmm0, %xmm0
;CHECK-WIDE-NEXT: vcvtdq2ps %xmm0, %xmm0
;CHECK-WIDE-NEXT: ret
define <4 x float> @foo1_4(<4 x i8> %src) {
%res = sitofp <4 x i8> %src to <4 x float>
ret <4 x float> %res
}
;CHECK-LABEL: foo2_8:
;CHECK: vcvtdq2ps
;CHECK: ret
;
;CHECK-WIDE-LABEL: foo2_8:
;CHECK-WIDE: vcvtdq2ps %ymm{{.*}}, %ymm{{.*}}
;CHECK-WIDE: ret
define <8 x float> @foo2_8(<8 x i8> %src) {
%res = uitofp <8 x i8> %src to <8 x float>
ret <8 x float> %res
}
;CHECK-LABEL: foo2_4:
;CHECK: vcvtdq2ps
;CHECK: ret
;
;CHECK-WIDE-LABEL: foo2_4:
;CHECK-WIDE: vcvtdq2ps %xmm{{.*}}, %xmm{{.*}}
;CHECK-WIDE: ret
define <4 x float> @foo2_4(<4 x i8> %src) {
%res = uitofp <4 x i8> %src to <4 x float>
ret <4 x float> %res
}
;CHECK-LABEL: foo3_8:
;CHECK: vcvttps2dq
;CHECK: ret
define <8 x i8> @foo3_8(<8 x float> %src) {
%res = fptosi <8 x float> %src to <8 x i8>
ret <8 x i8> %res
}
;CHECK-LABEL: foo3_4:
;CHECK: vcvttps2dq
;CHECK: ret
define <4 x i8> @foo3_4(<4 x float> %src) {
%res = fptosi <4 x float> %src to <4 x i8>
ret <4 x i8> %res
}