From 5b69b5e20a5eefc9d0d89e438e30308cb2eaec68 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 12 Dec 2018 05:55:59 +0000 Subject: [PATCH] [X86] Add a few more fptosi test cases to demonstrate -x86-experimental-vector-widening legalization not combining vpacksswb+vpmovdw. We are able to combine vpackuswb+vpmovdw, but we didn't have packsswb+vpmovdw at the time that combine was added. llvm-svn: 348909 --- llvm/test/CodeGen/X86/avx512-cvt-widen.ll | 39 +++++++++++++++++++++++ llvm/test/CodeGen/X86/avx512-cvt.ll | 38 ++++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/llvm/test/CodeGen/X86/avx512-cvt-widen.ll b/llvm/test/CodeGen/X86/avx512-cvt-widen.ll index d6f7c00c585c..af4b73fc79d9 100644 --- a/llvm/test/CodeGen/X86/avx512-cvt-widen.ll +++ b/llvm/test/CodeGen/X86/avx512-cvt-widen.ll @@ -625,6 +625,45 @@ define <8 x i32> @f64to8si(<8 x double> %a) { ret <8 x i32> %b } +define <8 x i16> @f64to8ss(<8 x double> %f) { +; NOVL-LABEL: f64to8ss: +; NOVL: # %bb.0: +; NOVL-NEXT: vcvttpd2dq %zmm0, %ymm0 +; NOVL-NEXT: vpmovdw %zmm0, %ymm0 +; NOVL-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0 +; NOVL-NEXT: vzeroupper +; NOVL-NEXT: retq +; +; VL-LABEL: f64to8ss: +; VL: # %bb.0: +; VL-NEXT: vcvttpd2dq %zmm0, %ymm0 +; VL-NEXT: vpmovdw %ymm0, %xmm0 +; VL-NEXT: vzeroupper +; VL-NEXT: retq + %res = fptosi <8 x double> %f to <8 x i16> + ret <8 x i16> %res +} + +define <8 x i8> @f64to8sc(<8 x double> %f) { +; NOVL-LABEL: f64to8sc: +; NOVL: # %bb.0: +; NOVL-NEXT: vcvttpd2dq %zmm0, %ymm0 +; NOVL-NEXT: vpmovdw %zmm0, %ymm0 +; NOVL-NEXT: vpacksswb %xmm0, %xmm0, %xmm0 +; NOVL-NEXT: vzeroupper +; NOVL-NEXT: retq +; +; VL-LABEL: f64to8sc: +; VL: # %bb.0: +; VL-NEXT: vcvttpd2dq %zmm0, %ymm0 +; VL-NEXT: vpmovdw %ymm0, %xmm0 +; VL-NEXT: vpacksswb %xmm0, %xmm0, %xmm0 +; VL-NEXT: vzeroupper +; VL-NEXT: retq + %res = fptosi <8 x double> %f to <8 x i8> + ret <8 x i8> %res +} + define <4 x i32> @f64to4si(<4 x double> %a) { ; ALL-LABEL: f64to4si: ; ALL: # %bb.0: diff --git a/llvm/test/CodeGen/X86/avx512-cvt.ll b/llvm/test/CodeGen/X86/avx512-cvt.ll index 1d984f2f8ac1..264b1ea841fd 100644 --- a/llvm/test/CodeGen/X86/avx512-cvt.ll +++ b/llvm/test/CodeGen/X86/avx512-cvt.ll @@ -626,6 +626,44 @@ define <8 x i32> @f64to8si(<8 x double> %a) { ret <8 x i32> %b } +define <8 x i16> @f64to8ss(<8 x double> %f) { +; NOVL-LABEL: f64to8ss: +; NOVL: # %bb.0: +; NOVL-NEXT: vcvttpd2dq %zmm0, %ymm0 +; NOVL-NEXT: vpmovdw %zmm0, %ymm0 +; NOVL-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0 +; NOVL-NEXT: vzeroupper +; NOVL-NEXT: retq +; +; VL-LABEL: f64to8ss: +; VL: # %bb.0: +; VL-NEXT: vcvttpd2dq %zmm0, %ymm0 +; VL-NEXT: vpmovdw %ymm0, %xmm0 +; VL-NEXT: vzeroupper +; VL-NEXT: retq + %res = fptosi <8 x double> %f to <8 x i16> + ret <8 x i16> %res +} + +define <8 x i8> @f64to8sc(<8 x double> %f) { +; NOVL-LABEL: f64to8sc: +; NOVL: # %bb.0: +; NOVL-NEXT: vcvttpd2dq %zmm0, %ymm0 +; NOVL-NEXT: vpmovdw %zmm0, %ymm0 +; NOVL-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0 +; NOVL-NEXT: vzeroupper +; NOVL-NEXT: retq +; +; VL-LABEL: f64to8sc: +; VL: # %bb.0: +; VL-NEXT: vcvttpd2dq %zmm0, %ymm0 +; VL-NEXT: vpmovdw %ymm0, %xmm0 +; VL-NEXT: vzeroupper +; VL-NEXT: retq + %res = fptosi <8 x double> %f to <8 x i8> + ret <8 x i8> %res +} + define <4 x i32> @f64to4si(<4 x double> %a) { ; ALL-LABEL: f64to4si: ; ALL: # %bb.0: