From ed5c711a6e1b3d03952c670c5c0c1c3ed6c63ad4 Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes Date: Thu, 2 Sep 2010 22:43:39 +0000 Subject: [PATCH] Move insertps mask decoding to header file git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112896 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/AsmPrinter/X86InstComments.cpp | 28 ------------------- lib/Target/X86/X86ShuffleDecode.h | 24 ++++++++++++++++ 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/lib/Target/X86/AsmPrinter/X86InstComments.cpp b/lib/Target/X86/AsmPrinter/X86InstComments.cpp index 61f50652111..da9d5a3579e 100644 --- a/lib/Target/X86/AsmPrinter/X86InstComments.cpp +++ b/lib/Target/X86/AsmPrinter/X86InstComments.cpp @@ -19,34 +19,6 @@ #include "../X86ShuffleDecode.h" using namespace llvm; -//===----------------------------------------------------------------------===// -// Vector Mask Decoding for non-shuffles -//===----------------------------------------------------------------------===// - -static void DecodeINSERTPSMask(unsigned Imm, - SmallVectorImpl &ShuffleMask) { - // Defaults the copying the dest value. - ShuffleMask.push_back(0); - ShuffleMask.push_back(1); - ShuffleMask.push_back(2); - ShuffleMask.push_back(3); - - // Decode the immediate. - unsigned ZMask = Imm & 15; - unsigned CountD = (Imm >> 4) & 3; - unsigned CountS = (Imm >> 6) & 3; - - // CountS selects which input element to use. - unsigned InVal = 4+CountS; - // CountD specifies which element of destination to update. - ShuffleMask[CountD] = InVal; - // ZMask zaps values, potentially overriding the CountD elt. - if (ZMask & 1) ShuffleMask[0] = SM_SentinelZero; - if (ZMask & 2) ShuffleMask[1] = SM_SentinelZero; - if (ZMask & 4) ShuffleMask[2] = SM_SentinelZero; - if (ZMask & 8) ShuffleMask[3] = SM_SentinelZero; -} - //===----------------------------------------------------------------------===// // Top Level Entrypoint //===----------------------------------------------------------------------===// diff --git a/lib/Target/X86/X86ShuffleDecode.h b/lib/Target/X86/X86ShuffleDecode.h index 818f7ca74b6..df040520bc8 100644 --- a/lib/Target/X86/X86ShuffleDecode.h +++ b/lib/Target/X86/X86ShuffleDecode.h @@ -26,6 +26,30 @@ enum { SM_SentinelZero = ~0U }; +static inline +void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl &ShuffleMask) { + // Defaults the copying the dest value. + ShuffleMask.push_back(0); + ShuffleMask.push_back(1); + ShuffleMask.push_back(2); + ShuffleMask.push_back(3); + + // Decode the immediate. + unsigned ZMask = Imm & 15; + unsigned CountD = (Imm >> 4) & 3; + unsigned CountS = (Imm >> 6) & 3; + + // CountS selects which input element to use. + unsigned InVal = 4+CountS; + // CountD specifies which element of destination to update. + ShuffleMask[CountD] = InVal; + // ZMask zaps values, potentially overriding the CountD elt. + if (ZMask & 1) ShuffleMask[0] = SM_SentinelZero; + if (ZMask & 2) ShuffleMask[1] = SM_SentinelZero; + if (ZMask & 4) ShuffleMask[2] = SM_SentinelZero; + if (ZMask & 8) ShuffleMask[3] = SM_SentinelZero; +} + // <3,1> or <6,7,2,3> static void DecodeMOVHLPSMask(unsigned NElts, SmallVectorImpl &ShuffleMask) {