From 0a1c1b20e260bb44dc679353bc8e6feb7fce7ab2 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 20 Jan 2017 11:28:07 +0000 Subject: [PATCH] [InstCombine][SSE] Tests showing missed opportunities to handle packss/packus with undef arguments git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292601 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/x86-pack.ll | 76 +++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/test/Transforms/InstCombine/x86-pack.ll b/test/Transforms/InstCombine/x86-pack.ll index 88149b14d62..db546685927 100644 --- a/test/Transforms/InstCombine/x86-pack.ll +++ b/test/Transforms/InstCombine/x86-pack.ll @@ -1,6 +1,82 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instcombine -S | FileCheck %s +; +; UNDEF Elts +; + +define <8 x i16> @undef_packssdw_128() { +; CHECK-LABEL: @undef_packssdw_128( +; CHECK-NEXT: [[TMP1:%.*]] = call <8 x i16> @llvm.x86.sse2.packssdw.128(<4 x i32> undef, <4 x i32> undef) +; CHECK-NEXT: ret <8 x i16> [[TMP1]] +; + %1 = call <8 x i16> @llvm.x86.sse2.packssdw.128(<4 x i32> undef, <4 x i32> undef) + ret <8 x i16> %1 +} + +define <8 x i16> @undef_packusdw_128() { +; CHECK-LABEL: @undef_packusdw_128( +; CHECK-NEXT: [[TMP1:%.*]] = call <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32> undef, <4 x i32> undef) +; CHECK-NEXT: ret <8 x i16> [[TMP1]] +; + %1 = call <8 x i16> @llvm.x86.sse41.packusdw(<4 x i32> undef, <4 x i32> undef) + ret <8 x i16> %1 +} + +define <16 x i8> @undef_packsswb_128() { +; CHECK-LABEL: @undef_packsswb_128( +; CHECK-NEXT: [[TMP1:%.*]] = call <16 x i8> @llvm.x86.sse2.packsswb.128(<8 x i16> undef, <8 x i16> undef) +; CHECK-NEXT: ret <16 x i8> [[TMP1]] +; + %1 = call <16 x i8> @llvm.x86.sse2.packsswb.128(<8 x i16> undef, <8 x i16> undef) + ret <16 x i8> %1 +} + +define <16 x i8> @undef_packuswb_128() { +; CHECK-LABEL: @undef_packuswb_128( +; CHECK-NEXT: [[TMP1:%.*]] = call <16 x i8> @llvm.x86.sse2.packuswb.128(<8 x i16> undef, <8 x i16> undef) +; CHECK-NEXT: ret <16 x i8> [[TMP1]] +; + %1 = call <16 x i8> @llvm.x86.sse2.packuswb.128(<8 x i16> undef, <8 x i16> undef) + ret <16 x i8> %1 +} + +define <16 x i16> @undef_packssdw_256() { +; CHECK-LABEL: @undef_packssdw_256( +; CHECK-NEXT: [[TMP1:%.*]] = call <16 x i16> @llvm.x86.avx2.packssdw(<8 x i32> undef, <8 x i32> undef) +; CHECK-NEXT: ret <16 x i16> [[TMP1]] +; + %1 = call <16 x i16> @llvm.x86.avx2.packssdw(<8 x i32> undef, <8 x i32> undef) + ret <16 x i16> %1 +} + +define <16 x i16> @undef_packusdw_256() { +; CHECK-LABEL: @undef_packusdw_256( +; CHECK-NEXT: [[TMP1:%.*]] = call <16 x i16> @llvm.x86.avx2.packusdw(<8 x i32> undef, <8 x i32> undef) +; CHECK-NEXT: ret <16 x i16> [[TMP1]] +; + %1 = call <16 x i16> @llvm.x86.avx2.packusdw(<8 x i32> undef, <8 x i32> undef) + ret <16 x i16> %1 +} + +define <32 x i8> @undef_packsswb_256() { +; CHECK-LABEL: @undef_packsswb_256( +; CHECK-NEXT: [[TMP1:%.*]] = call <32 x i8> @llvm.x86.avx2.packsswb(<16 x i16> undef, <16 x i16> undef) +; CHECK-NEXT: ret <32 x i8> [[TMP1]] +; + %1 = call <32 x i8> @llvm.x86.avx2.packsswb(<16 x i16> undef, <16 x i16> undef) + ret <32 x i8> %1 +} + +define <32 x i8> @undef_packuswb_256() { +; CHECK-LABEL: @undef_packuswb_256( +; CHECK-NEXT: [[TMP1:%.*]] = call <32 x i8> @llvm.x86.avx2.packuswb(<16 x i16> undef, <16 x i16> undef) +; CHECK-NEXT: ret <32 x i8> [[TMP1]] +; + %1 = call <32 x i8> @llvm.x86.avx2.packuswb(<16 x i16> undef, <16 x i16> undef) + ret <32 x i8> %1 +} + ; ; Demanded Elts ; -- 2.50.1