~ubuntu-branches/ubuntu/wily/clamav/wily-proposed

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/lib/Target/X86/X86ShuffleDecode.h

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Sebastian Andrzej Siewior, Andreas Cadhalpun, Scott Kitterman, Javier Fernández-Sanguino
  • Date: 2015-01-28 00:25:13 UTC
  • mfrom: (0.48.14 sid)
  • Revision ID: package-import@ubuntu.com-20150128002513-lil2oi74cooy4lzr
Tags: 0.98.6+dfsg-1
[ Sebastian Andrzej Siewior ]
* update "fix-ssize_t-size_t-off_t-printf-modifier", include of misc.h was
  missing but was pulled in via the systemd patch.
* Don't leak return codes from libmspack to clamav API. (Closes: #774686).

[ Andreas Cadhalpun ]
* Add patch to avoid emitting incremental progress messages when not
  outputting to a terminal. (Closes: #767350)
* Update lintian-overrides for unused-file-paragraph-in-dep5-copyright.
* clamav-base.postinst: always chown /var/log/clamav and /var/lib/clamav
  to clamav:clamav, not only on fresh installations. (Closes: #775400)
* Adapt the clamav-daemon and clamav-freshclam logrotate scripts,
  so that they correctly work under systemd.
* Move the PidFile variable from the clamd/freshclam configuration files
  to the init scripts. This makes the init scripts more robust against
  misconfiguration and avoids error messages with systemd. (Closes: #767353)
* debian/copyright: drop files from Files-Excluded only present in github
  tarballs
* Drop Workaround-a-bug-in-libc-on-Hurd.patch, because hurd got fixed.
  (see #752237)
* debian/rules: Remove useless --with-system-tommath --without-included-ltdl
  configure options.

[ Scott Kitterman ]
* Stop stripping llvm when repacking the tarball as the system llvm on some
  releases is too old to use
* New upstream bugfix release
  - Library shared object revisions.
  - Includes a patch from Sebastian Andrzej Siewior making ClamAV pid files
    compatible with systemd.
  - Fix a heap out of bounds condition with crafted Yoda's crypter files.
    This issue was discovered by Felix Groebert of the Google Security Team.
  - Fix a heap out of bounds condition with crafted mew packer files. This
    issue was discovered by Felix Groebert of the Google Security Team.
  - Fix a heap out of bounds condition with crafted upx packer files. This
    issue was discovered by Kevin Szkudlapski of Quarkslab.
  - Fix a heap out of bounds condition with crafted upack packer files. This
    issue was discovered by Sebastian Andrzej Siewior. CVE-2014-9328.
  - Compensate a crash due to incorrect compiler optimization when handling
    crafted petite packer files. This issue was discovered by Sebastian
    Andrzej Siewior.
* Update lintian override for embedded zlib to match new so version

[ Javier Fernández-Sanguino ]
* Updated Spanish Debconf template translation (Closes: #773563)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===-- X86ShuffleDecode.h - X86 shuffle decode logic ---------------------===//
 
2
//
 
3
//                     The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is distributed under the University of Illinois Open Source
 
6
// License. See LICENSE.TXT for details.
 
7
//
 
8
//===----------------------------------------------------------------------===//
 
9
//
 
10
// Define several functions to decode x86 specific shuffle semantics into a
 
11
// generic vector mask.
 
12
//
 
13
//===----------------------------------------------------------------------===//
 
14
 
 
15
#ifndef X86_SHUFFLE_DECODE_H
 
16
#define X86_SHUFFLE_DECODE_H
 
17
 
 
18
#include "llvm/ADT/SmallVector.h"
 
19
using namespace llvm;
 
20
 
 
21
//===----------------------------------------------------------------------===//
 
22
//  Vector Mask Decoding
 
23
//===----------------------------------------------------------------------===//
 
24
 
 
25
enum {
 
26
  SM_SentinelZero = ~0U
 
27
};
 
28
 
 
29
static inline
 
30
void DecodeINSERTPSMask(unsigned Imm, SmallVectorImpl<unsigned> &ShuffleMask) {
 
31
  // Defaults the copying the dest value.
 
32
  ShuffleMask.push_back(0);
 
33
  ShuffleMask.push_back(1);
 
34
  ShuffleMask.push_back(2);
 
35
  ShuffleMask.push_back(3);
 
36
 
 
37
  // Decode the immediate.
 
38
  unsigned ZMask = Imm & 15;
 
39
  unsigned CountD = (Imm >> 4) & 3;
 
40
  unsigned CountS = (Imm >> 6) & 3;
 
41
 
 
42
  // CountS selects which input element to use.
 
43
  unsigned InVal = 4+CountS;
 
44
  // CountD specifies which element of destination to update.
 
45
  ShuffleMask[CountD] = InVal;
 
46
  // ZMask zaps values, potentially overriding the CountD elt.
 
47
  if (ZMask & 1) ShuffleMask[0] = SM_SentinelZero;
 
48
  if (ZMask & 2) ShuffleMask[1] = SM_SentinelZero;
 
49
  if (ZMask & 4) ShuffleMask[2] = SM_SentinelZero;
 
50
  if (ZMask & 8) ShuffleMask[3] = SM_SentinelZero;
 
51
}
 
52
 
 
53
// <3,1> or <6,7,2,3>
 
54
static void DecodeMOVHLPSMask(unsigned NElts,
 
55
                              SmallVectorImpl<unsigned> &ShuffleMask) {
 
56
  for (unsigned i = NElts/2; i != NElts; ++i)
 
57
    ShuffleMask.push_back(NElts+i);
 
58
 
 
59
  for (unsigned i = NElts/2; i != NElts; ++i)
 
60
    ShuffleMask.push_back(i);
 
61
}
 
62
 
 
63
// <0,2> or <0,1,4,5>
 
64
static void DecodeMOVLHPSMask(unsigned NElts,
 
65
                              SmallVectorImpl<unsigned> &ShuffleMask) {
 
66
  for (unsigned i = 0; i != NElts/2; ++i)
 
67
    ShuffleMask.push_back(i);
 
68
 
 
69
  for (unsigned i = 0; i != NElts/2; ++i)
 
70
    ShuffleMask.push_back(NElts+i);
 
71
}
 
72
 
 
73
static void DecodePSHUFMask(unsigned NElts, unsigned Imm,
 
74
                            SmallVectorImpl<unsigned> &ShuffleMask) {
 
75
  for (unsigned i = 0; i != NElts; ++i) {
 
76
    ShuffleMask.push_back(Imm % NElts);
 
77
    Imm /= NElts;
 
78
  }
 
79
}
 
80
 
 
81
static void DecodePSHUFHWMask(unsigned Imm,
 
82
                              SmallVectorImpl<unsigned> &ShuffleMask) {
 
83
  ShuffleMask.push_back(0);
 
84
  ShuffleMask.push_back(1);
 
85
  ShuffleMask.push_back(2);
 
86
  ShuffleMask.push_back(3);
 
87
  for (unsigned i = 0; i != 4; ++i) {
 
88
    ShuffleMask.push_back(4+(Imm & 3));
 
89
    Imm >>= 2;
 
90
  }
 
91
}
 
92
 
 
93
static void DecodePSHUFLWMask(unsigned Imm,
 
94
                              SmallVectorImpl<unsigned> &ShuffleMask) {
 
95
  for (unsigned i = 0; i != 4; ++i) {
 
96
    ShuffleMask.push_back((Imm & 3));
 
97
    Imm >>= 2;
 
98
  }
 
99
  ShuffleMask.push_back(4);
 
100
  ShuffleMask.push_back(5);
 
101
  ShuffleMask.push_back(6);
 
102
  ShuffleMask.push_back(7);
 
103
}
 
104
 
 
105
static void DecodePUNPCKLMask(unsigned NElts,
 
106
                              SmallVectorImpl<unsigned> &ShuffleMask) {
 
107
  for (unsigned i = 0; i != NElts/2; ++i) {
 
108
    ShuffleMask.push_back(i);
 
109
    ShuffleMask.push_back(i+NElts);
 
110
  }
 
111
}
 
112
 
 
113
static void DecodePUNPCKHMask(unsigned NElts,
 
114
                              SmallVectorImpl<unsigned> &ShuffleMask) {
 
115
  for (unsigned i = 0; i != NElts/2; ++i) {
 
116
    ShuffleMask.push_back(i+NElts/2);
 
117
    ShuffleMask.push_back(i+NElts+NElts/2);
 
118
  }
 
119
}
 
120
 
 
121
static void DecodeSHUFPSMask(unsigned NElts, unsigned Imm,
 
122
                             SmallVectorImpl<unsigned> &ShuffleMask) {
 
123
  // Part that reads from dest.
 
124
  for (unsigned i = 0; i != NElts/2; ++i) {
 
125
    ShuffleMask.push_back(Imm % NElts);
 
126
    Imm /= NElts;
 
127
  }
 
128
  // Part that reads from src.
 
129
  for (unsigned i = 0; i != NElts/2; ++i) {
 
130
    ShuffleMask.push_back(Imm % NElts + NElts);
 
131
    Imm /= NElts;
 
132
  }
 
133
}
 
134
 
 
135
static void DecodeUNPCKHPMask(unsigned NElts,
 
136
                              SmallVectorImpl<unsigned> &ShuffleMask) {
 
137
  for (unsigned i = 0; i != NElts/2; ++i) {
 
138
    ShuffleMask.push_back(i+NElts/2);        // Reads from dest
 
139
    ShuffleMask.push_back(i+NElts+NElts/2);  // Reads from src
 
140
  }
 
141
}
 
142
 
 
143
 
 
144
/// DecodeUNPCKLPMask - This decodes the shuffle masks for unpcklps/unpcklpd
 
145
/// etc.  NElts indicates the number of elements in the vector allowing it to
 
146
/// handle different datatypes and vector widths.
 
147
static void DecodeUNPCKLPMask(unsigned NElts,
 
148
                              SmallVectorImpl<unsigned> &ShuffleMask) {
 
149
  for (unsigned i = 0; i != NElts/2; ++i) {
 
150
    ShuffleMask.push_back(i);        // Reads from dest
 
151
    ShuffleMask.push_back(i+NElts);  // Reads from src
 
152
  }
 
153
}
 
154
 
 
155
#endif