2015-11-24 05:33:58 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2015-04-04 01:17:50 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx | FileCheck %s
|
2014-03-18 01:06:14 +08:00
|
|
|
|
|
|
|
; Check that we generate vector conversion from float to narrower int types
|
|
|
|
|
|
|
|
%f32vec_t = type <8 x float>
|
|
|
|
%i16vec_t = type <8 x i16>
|
|
|
|
%i8vec_t = type <8 x i8>
|
|
|
|
|
|
|
|
define void @fptoui16(%f32vec_t %a, %i16vec_t *%p) {
|
|
|
|
; CHECK-LABEL: fptoui16:
|
2015-04-04 01:17:50 +08:00
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
|
|
|
|
; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
|
|
|
|
; CHECK-NEXT: vmovdqa {{.*#+}} xmm2 = [0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15]
|
|
|
|
; CHECK-NEXT: vpshufb %xmm2, %xmm1, %xmm1
|
|
|
|
; CHECK-NEXT: vpshufb %xmm2, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
|
|
|
|
; CHECK-NEXT: vmovdqa %xmm0, (%rdi)
|
|
|
|
; CHECK-NEXT: vzeroupper
|
|
|
|
; CHECK-NEXT: retq
|
2014-03-18 01:06:14 +08:00
|
|
|
%b = fptoui %f32vec_t %a to %i16vec_t
|
|
|
|
store %i16vec_t %b, %i16vec_t * %p
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @fptosi16(%f32vec_t %a, %i16vec_t *%p) {
|
|
|
|
; CHECK-LABEL: fptosi16:
|
2015-04-04 01:17:50 +08:00
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
|
|
|
|
; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
|
|
|
|
; CHECK-NEXT: vmovdqa {{.*#+}} xmm2 = [0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15]
|
|
|
|
; CHECK-NEXT: vpshufb %xmm2, %xmm1, %xmm1
|
|
|
|
; CHECK-NEXT: vpshufb %xmm2, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
|
|
|
|
; CHECK-NEXT: vmovdqa %xmm0, (%rdi)
|
|
|
|
; CHECK-NEXT: vzeroupper
|
|
|
|
; CHECK-NEXT: retq
|
2014-03-18 01:06:14 +08:00
|
|
|
%b = fptosi %f32vec_t %a to %i16vec_t
|
|
|
|
store %i16vec_t %b, %i16vec_t * %p
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @fptoui8(%f32vec_t %a, %i8vec_t *%p) {
|
|
|
|
; CHECK-LABEL: fptoui8:
|
2015-04-04 01:17:50 +08:00
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
|
|
|
|
; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
|
|
|
|
; CHECK-NEXT: vmovdqa {{.*#+}} xmm2 = [0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15]
|
|
|
|
; CHECK-NEXT: vpshufb %xmm2, %xmm1, %xmm1
|
|
|
|
; CHECK-NEXT: vpshufb %xmm2, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
|
2017-10-03 20:01:31 +08:00
|
|
|
; CHECK-NEXT: vpackuswb %xmm0, %xmm0, %xmm0
|
2015-04-04 01:17:50 +08:00
|
|
|
; CHECK-NEXT: vmovq %xmm0, (%rdi)
|
|
|
|
; CHECK-NEXT: vzeroupper
|
|
|
|
; CHECK-NEXT: retq
|
2014-03-18 01:06:14 +08:00
|
|
|
%b = fptoui %f32vec_t %a to %i8vec_t
|
|
|
|
store %i8vec_t %b, %i8vec_t * %p
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @fptosi8(%f32vec_t %a, %i8vec_t *%p) {
|
|
|
|
; CHECK-LABEL: fptosi8:
|
2015-04-04 01:17:50 +08:00
|
|
|
; CHECK: # BB#0:
|
|
|
|
; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
|
|
|
|
; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
|
|
|
|
; CHECK-NEXT: vmovdqa {{.*#+}} xmm2 = [0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15]
|
|
|
|
; CHECK-NEXT: vpshufb %xmm2, %xmm1, %xmm1
|
|
|
|
; CHECK-NEXT: vpshufb %xmm2, %xmm0, %xmm0
|
|
|
|
; CHECK-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
|
2017-10-03 20:01:31 +08:00
|
|
|
; CHECK-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
|
2015-04-04 01:17:50 +08:00
|
|
|
; CHECK-NEXT: vmovq %xmm0, (%rdi)
|
|
|
|
; CHECK-NEXT: vzeroupper
|
|
|
|
; CHECK-NEXT: retq
|
2014-03-18 01:06:14 +08:00
|
|
|
%b = fptosi %f32vec_t %a to %i8vec_t
|
|
|
|
store %i8vec_t %b, %i8vec_t * %p
|
|
|
|
ret void
|
|
|
|
}
|