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 3 4; Check that we generate vector conversion from float to narrower int types 5 6%f32vec_t = type <8 x float> 7%i16vec_t = type <8 x i16> 8%i8vec_t = type <8 x i8> 9 10define void @fptoui16(%f32vec_t %a, %i16vec_t *%p) { 11; CHECK-LABEL: fptoui16: 12; CHECK: # %bb.0: 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 18; CHECK-NEXT: retq 19 %b = fptoui %f32vec_t %a to %i16vec_t 20 store %i16vec_t %b, %i16vec_t * %p 21 ret void 22} 23 24define void @fptosi16(%f32vec_t %a, %i16vec_t *%p) { 25; CHECK-LABEL: fptosi16: 26; CHECK: # %bb.0: 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 32; CHECK-NEXT: retq 33 %b = fptosi %f32vec_t %a to %i16vec_t 34 store %i16vec_t %b, %i16vec_t * %p 35 ret void 36} 37 38define void @fptoui8(%f32vec_t %a, %i8vec_t *%p) { 39; CHECK-LABEL: fptoui8: 40; CHECK: # %bb.0: 41; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0 42; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1 43; CHECK-NEXT: vpackusdw %xmm1, %xmm0, %xmm0 44; CHECK-NEXT: vpackuswb %xmm0, %xmm0, %xmm0 45; CHECK-NEXT: vmovq %xmm0, (%rdi) 46; CHECK-NEXT: vzeroupper 47; CHECK-NEXT: retq 48 %b = fptoui %f32vec_t %a to %i8vec_t 49 store %i8vec_t %b, %i8vec_t * %p 50 ret void 51} 52 53define void @fptosi8(%f32vec_t %a, %i8vec_t *%p) { 54; CHECK-LABEL: fptosi8: 55; CHECK: # %bb.0: 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 62; CHECK-NEXT: retq 63 %b = fptosi %f32vec_t %a to %i8vec_t 64 store %i8vec_t %b, %i8vec_t * %p 65 ret void 66} 67