1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx | FileCheck %s
4 ; Check that we generate vector conversion from float to narrower int types
6 %f32vec_t = type <8 x float>
7 %i16vec_t = type <8 x i16>
8 %i8vec_t = type <8 x i8>
10 define void @fptoui16(%f32vec_t %a, %i16vec_t *%p) {
11 ; CHECK-LABEL: fptoui16:
13 ; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
14 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
15 ; CHECK-NEXT: vpackusdw %xmm1, %xmm0, %xmm0
16 ; CHECK-NEXT: vmovdqa %xmm0, (%rdi)
17 ; CHECK-NEXT: vzeroupper
19 %b = fptoui %f32vec_t %a to %i16vec_t
20 store %i16vec_t %b, %i16vec_t * %p
24 define void @fptosi16(%f32vec_t %a, %i16vec_t *%p) {
25 ; CHECK-LABEL: fptosi16:
27 ; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
28 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
29 ; CHECK-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
30 ; CHECK-NEXT: vmovdqa %xmm0, (%rdi)
31 ; CHECK-NEXT: vzeroupper
33 %b = fptosi %f32vec_t %a to %i16vec_t
34 store %i16vec_t %b, %i16vec_t * %p
38 define void @fptoui8(%f32vec_t %a, %i8vec_t *%p) {
39 ; CHECK-LABEL: fptoui8:
41 ; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
42 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
43 ; CHECK-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
44 ; CHECK-NEXT: vpackuswb %xmm0, %xmm0, %xmm0
45 ; CHECK-NEXT: vmovq %xmm0, (%rdi)
46 ; CHECK-NEXT: vzeroupper
48 %b = fptoui %f32vec_t %a to %i8vec_t
49 store %i8vec_t %b, %i8vec_t * %p
53 define void @fptosi8(%f32vec_t %a, %i8vec_t *%p) {
54 ; CHECK-LABEL: fptosi8:
56 ; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
57 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
58 ; CHECK-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
59 ; CHECK-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
60 ; CHECK-NEXT: vmovq %xmm0, (%rdi)
61 ; CHECK-NEXT: vzeroupper
63 %b = fptosi %f32vec_t %a to %i8vec_t
64 store %i8vec_t %b, %i8vec_t * %p