Debian Codegraph @

hmmer/src/impl_sse/impl_sse.h

raw symbols SCIP
1 /* SSE optimized implementation of various MSV, Viterbi, and Forward
2 * routines: structures, declarations, and macros.
3 *
4 * SRE, Sun Nov 25 11:23:02 2007
5 */
6 #ifndef P7_IMPL_SSE_INCLUDED
7 #define P7_IMPL_SSE_INCLUDED
8
9 #include <p7_config.h>
10
11 #include "esl_alphabet.h"
12 #include "esl_random.h"
13
14 #include <xmmintrin.h> /* SSE */
15 #include <emmintrin.h> /* SSE2 */
16 #ifdef __SSE3__
17 #include <pmmintrin.h> /* DENORMAL_MODE */
18 #endif
19 #include "hmmer.h"
20
21 /* In calculating Q, the number of vectors we need in a row, we have
22 * to make sure there's at least 2, or a striped implementation fails.
23 */
24 #define p7O_NQB(M) ( ESL_MAX(2, ((((M)-1) / 16) + 1))) /* 16 uchars */
25 #define p7O_NQW(M) ( ESL_MAX(2, ((((M)-1) / 8) + 1))) /* 8 words */
26 #define p7O_NQF(M) ( ESL_MAX(2, ((((M)-1) / 4) + 1))) /* 4 floats */
27
28 #define p7O_EXTRA_SB 17 /* see ssvfilter.c for explanation */
29
30
31 /*****************************************************************
32 * 1. P7_OPROFILE: an optimized score profile
33 *****************************************************************/
34 /* The OPROFILE is striped [Farrar07] and interleaved, as is the DP matrix.
35 * For example, the layout of a profile for an M=14 model (xref J2/46):
36 *
37 * rsc[x] : striped blocks of M emissions, starting with q=0
38 * 1 11 1 1
39 * 1593 2604 371x 482x
40 *
41 * tsc: grouped in order of accession in DP for 7 transition scores;
42 * starting at q=0 for all but the three transitions to M, which
43 * are rotated by -1 and rightshifted. DD's follow separately,
44 * starting at q=0.
45 *
46 * { 1 1 1 1 1 1 1 }
47 * { 1593 x482 x482 x482 1593 1593 1593 }
48 * { [tBMk] [tMM] [tIM] [tDM] [tMD] [tMI] [tII] }
49 *
50 * { 11 1 1 1 11 11 11 }
51 * { 2604 1593 1593 1593 2604 2604 2604 }
52 * { [tBMk] [tMM] [tIM] [tDM] [tMD] [tMI] [tII] }
53 *
54 * { 1 11 11 11 1 1 1 }
55 * { 371x 2604 2604 2604 371x 371x 371x }
56 * { [tBMk] [tMM] [tIM] [tDM] [tMD] [tMI] [tII] }
57 *
58 * { 1 1 1 1 1 1 1 }
59 * { 482x 371x 371x 371x 482x 482x 482x }
60 * { [tBMk] [tMM] [tIM] [tDM] [tMD] [tMI] [tII] }
61 *
62 * { 1 11 1 1 }
63 * { 1593 2604 371x 482x }
64 * { [TDD] [TDD] [TDD] [TDD] }
65 *
66 */
67
68 #define p7O_NXSTATES 4 /* special states stored: ENJC */
69 #define p7O_NXTRANS 2 /* special states all have 2 transitions: move, loop */
70 #define p7O_NTRANS 8 /* 7 core transitions + BMk entry */
71 enum p7o_xstates_e { p7O_E = 0, p7O_N = 1, p7O_J = 2, p7O_C = 3 };
72 enum p7o_xtransitions_e { p7O_MOVE = 0, p7O_LOOP = 1 };
73 enum p7o_tsc_e { p7O_BM = 0, p7O_MM = 1, p7O_IM = 2, p7O_DM = 3, p7O_MD = 4, p7O_MI = 5, p7O_II = 6, p7O_DD = 7 };
74
75 typedef struct p7_oprofile_s {
76 /* MSVFilter uses scaled, biased uchars: 16x unsigned byte vectors */
77 __m128i **rbv; /* match scores [x][q]: rm, rm[0] are allocated */
78 __m128i **sbv; /* match scores for ssvfilter */
79 uint8_t tbm_b; /* constant B->Mk cost: scaled log 2/M(M+1) */
80 uint8_t tec_b; /* constant E->C cost: scaled log 0.5 */
81 uint8_t tjb_b; /* constant NCJ move cost: scaled log 3/(L+3) */
82 float scale_b; /* typically 3 / log2: scores scale to 1/3 bits */
83 uint8_t base_b; /* typically +190: offset of uchar scores */
84 uint8_t bias_b; /* positive bias to emission scores, make them >=0 */
85
86 /* ViterbiFilter uses scaled swords: 8x signed 16-bit integer vectors */
87 __m128i **rwv; /* [x][q]: rw, rw[0] are allocated [Kp][Q8] */
88 __m128i *twv; /* transition score blocks [8*Q8] */
89 int16_t xw[p7O_NXSTATES][p7O_NXTRANS]; /* NECJ state transition costs */
90 float scale_w; /* score units: typically 500 / log(2), 1/500 bits */
91 int16_t base_w; /* offset of sword scores: typically +12000 */
92 int16_t ddbound_w; /* threshold precalculated for lazy DD evaluation */
93 float ncj_roundoff; /* missing precision on NN,CC,JJ after rounding */
94
95 /* Forward, Backward use IEEE754 single-precision floats: 4x vectors */
96 __m128 **rfv; /* [x][q]: rf, rf[0] are allocated [Kp][Q4] */
97 __m128 *tfv; /* transition probability blocks [8*Q4] */
98 float xf[p7O_NXSTATES][p7O_NXTRANS]; /* NECJ transition costs */
99
100 /* Our actual vector mallocs, before we align the memory */
101 __m128i *rbv_mem;
102 __m128i *sbv_mem;
103 __m128i *rwv_mem;
104 __m128i *twv_mem;
105 __m128 *tfv_mem;
106 __m128 *rfv_mem;
107
108 /* Disk offset information for hmmpfam's fast model retrieval */
109 off_t offs[p7_NOFFSETS]; /* p7_{MFP}OFFSET, or -1 */
110
111 /* Disk offset bookkeeping for h3f: */
112 off_t roff; /* record offset (start of record); -1 if none */
113 off_t eoff; /* offset to last byte of record; -1 if unknown */
114
115 /* Information, annotation copied from parent profile: */
116 char *name; /* unique name of model */
117 char *acc; /* unique accession of model, or NULL */
118 char *desc; /* brief (1-line) description of model, or NULL */
119 char *rf; /* reference line 1..M; *ref=0: unused */
120 char *mm; /* modelmask line 1..M; *ref=0: unused */
121 char *cs; /* consensus structure line 1..M, *cs=0: unused */
122 char *consensus; /* consensus residues for ali display, 1..M */
123 float evparam[p7_NEVPARAM]; /* parameters for determining E-values, or UNSET */
124 float cutoff[p7_NCUTOFFS]; /* per-seq/per-dom bit cutoffs, or UNSET */
125 float compo[p7_MAXABET]; /* per-model HMM filter composition, or UNSET */
126 const ESL_ALPHABET *abc; /* copy of ptr to alphabet information */
127
128 /* Information about current configuration, size, allocation */
129 int L; /* current configured target seq length */
130 int M; /* model length */
131 int max_length; /* upper bound on emitted sequence length */
132 int allocM; /* maximum model length currently allocated for */
133 int allocQ4; /* p7_NQF(allocM): alloc size for tf, rf */
134 int allocQ8; /* p7_NQW(allocM): alloc size for tw, rw */
135 int allocQ16; /* p7_NQB(allocM): alloc size for rb */
136 int mode; /* currently must be p7_LOCAL */
137 float nj; /* expected # of J's: 0 or 1, uni vs. multihit */
138
139 int clone; /* this optimized profile structure is just a copy */
140 /* of another profile structre. all pointers of */
141 /* this structure should not be freed. */
142 } P7_OPROFILE;
143
144 typedef struct {
145 int count; /* number of <P7_OPROFILE> objects in the block */
146 int listSize; /* maximum number elements in the list */
147 P7_OPROFILE **list; /* array of <P7_OPROFILE> objects */
148 } P7_OM_BLOCK;
149
150 /* retrieve match odds ratio [k][x]
151 * this gets used in p7_alidisplay.c, when we're deciding if a residue is conserved or not */
152 static inline float
153 p7_oprofile_FGetEmission(const P7_OPROFILE *om, int k, int x)
154 {
155 union { __m128 v; float p[4]; } u;
156 int Q = p7O_NQF(om->M);
157 int q = ((k-1) % Q);
158 int r = (k-1)/Q;
159 u.v = om->rfv[x][q];
160 return u.p[r];
161 }
162
163 /*****************************************************************
164 * 2. P7_OMX: a one-row dynamic programming matrix
165 *****************************************************************/
166
167 enum p7x_scells_e { p7X_M = 0, p7X_D = 1, p7X_I = 2 };
168 #define p7X_NSCELLS 3
169
170 /* Besides ENJBC states, we may also store a rescaling factor on each row */
171 enum p7x_xcells_e { p7X_E = 0, p7X_N = 1, p7X_J = 2, p7X_B = 3, p7X_C = 4, p7X_SCALE = 5 };
172 #define p7X_NXCELLS 6
173
174 /*
175 *
176 * dpf[][]
177 * to access M(i,k) for i=0,1..L; k=1..M: dpf[i][(k-1)/4 + p7X_M].element[(k-1)%4]
178 *
179 * xmx[] arrays for individual special states:
180 * xmx[ENJBC] = [0 1 2 3][4 5 6 7]..[L-2 L-1 L x] XRQ >= (L/4)+1
181 * to access B[i] for example, for i=0..L: xmx[B][i/4].x[i%4] (quad i/4; element i%4).
182 */
183 typedef struct p7_omx_s {
184 int M; /* current actual model dimension */
185 int L; /* current actual sequence dimension */
186
187 /* The main dynamic programming matrix for M,D,I states */
188 __m128 **dpf; /* striped DP matrix for [0,1..L][0..Q-1][MDI], float vectors */
189 __m128i **dpw; /* striped DP matrix for [0,1..L][0..Q-1][MDI], sword vectors */
190 __m128i **dpb; /* striped DP matrix for [0,1..L][0..Q-1] uchar vectors */
191 void *dp_mem; /* DP memory shared by <dpb>, <dpw>, <dpf> */
192 int allocR; /* current allocated # rows in dp{uf}. allocR >= validR >= L+1 */
193 int validR; /* current # of rows actually pointing at DP memory */
194 int allocQ4; /* current set row width in <dpf> quads: allocQ4*4 >= M */
195 int allocQ8; /* current set row width in <dpw> octets: allocQ8*8 >= M */
196 int allocQ16; /* current set row width in <dpb> 16-mers: allocQ16*16 >= M */
197 int64_t ncells; /* current allocation size of <dp_mem>, in accessible cells */
198
199 /* The X states (for full,parser; or NULL, for scorer) */
200 float *xmx; /* logically [0.1..L][ENJBCS]; indexed [i*p7X_NXCELLS+s] */
201 void *x_mem; /* X memory before 16-byte alignment */
202 int allocXR; /* # of rows allocated in each xmx[] array; allocXR >= L+1 */
203 float totscale; /* log of the product of all scale factors (0.0 if unscaled) */
204 int has_own_scales; /* TRUE to use own scale factors; FALSE if scales provided */
205
206 /* Parsers,scorers only hold a row at a time, so to get them to dump full matrix, it
207 * must be done during a DP calculation, after each row is calculated
208 */
209 int debugging; /* TRUE if we're in debugging mode */
210 FILE *dfp; /* output stream for diagnostics */
211 } P7_OMX;
212
213 /* ?MXo(q) access macros work for either uchar or float, so long as you
214 * init your "dp" to point to the appropriate array.
215 */
216 #define MMXo(q) (dp[(q) * p7X_NSCELLS + p7X_M])
217 #define DMXo(q) (dp[(q) * p7X_NSCELLS + p7X_D])
218 #define IMXo(q) (dp[(q) * p7X_NSCELLS + p7X_I])
219 #define XMXo(i,s) (xmx[(i) * p7X_NXCELLS + s])
220
221 /* and this version works with a ptr to the approp DP row. */
222 #define MMO(dp,q) ((dp)[(q) * p7X_NSCELLS + p7X_M])
223 #define DMO(dp,q) ((dp)[(q) * p7X_NSCELLS + p7X_D])
224 #define IMO(dp,q) ((dp)[(q) * p7X_NSCELLS + p7X_I])
225
226 static inline float
227 p7_omx_FGetMDI(const P7_OMX *ox, int s, int i, int k)
228 {
229 union { __m128 v; float p[4]; } u;
230 int Q = p7O_NQF(ox->M);
231 int q = p7X_NSCELLS * ((k-1) % Q) + s;
232 int r = (k-1)/Q;
233 u.v = ox->dpf[i][q];
234 return u.p[r];
235 }
236
237 static inline void
238 p7_omx_FSetMDI(const P7_OMX *ox, int s, int i, int k, float val)
239 {
240 union { __m128 v; float p[4]; } u;
241 int Q = p7O_NQF(ox->M);
242 int q = p7X_NSCELLS * ((k-1) % Q) + s;
243 int r = (k-1)/Q;
244
245 u.v = ox->dpf[i][q];
246 u.p[r] = val;
247 ox->dpf[i][q] = u.v;
248 }
249
250
251
252
253 /*****************************************************************
254 * 3. Declarations of the external API.
255 *****************************************************************/
256
257 /* p7_omx.c */
258 extern P7_OMX *p7_omx_Create(int allocM, int allocL, int allocXL);
259 extern int p7_omx_GrowTo(P7_OMX *ox, int allocM, int allocL, int allocXL);
260 extern int p7_omx_FDeconvert(P7_OMX *ox, P7_GMX *gx);
261 extern int p7_omx_Reuse (P7_OMX *ox);
262 extern void p7_omx_Destroy(P7_OMX *ox);
263
264 extern int p7_omx_SetDumpMode(FILE *fp, P7_OMX *ox, int truefalse);
265 extern int p7_omx_DumpMFRow(P7_OMX *ox, int rowi, uint8_t xE, uint8_t xN, uint8_t xJ, uint8_t xB, uint8_t xC);
266 extern int p7_omx_DumpVFRow(P7_OMX *ox, int rowi, int16_t xE, int16_t xN, int16_t xJ, int16_t xB, int16_t xC);
267 extern int p7_omx_DumpFBRow(P7_OMX *ox, int logify, int rowi, int width, int precision, float xE, float xN, float xJ, float xB, float xC);
268
269
270
271 /* p7_oprofile.c */
272 extern P7_OPROFILE *p7_oprofile_Create(int M, const ESL_ALPHABET *abc);
273 extern int p7_oprofile_IsLocal(const P7_OPROFILE *om);
274 extern void p7_oprofile_Destroy(P7_OPROFILE *om);
275 extern size_t p7_oprofile_Sizeof(P7_OPROFILE *om);
276 extern P7_OPROFILE *p7_oprofile_Copy(P7_OPROFILE *om);
277 extern P7_OPROFILE *p7_oprofile_Clone(const P7_OPROFILE *om);
278 extern int p7_oprofile_UpdateFwdEmissionScores(P7_OPROFILE *om, P7_BG *bg, float *fwd_emissions, float *sc_arr);
279 extern int p7_oprofile_UpdateVitEmissionScores(P7_OPROFILE *om, P7_BG *bg, float *fwd_emissions, float *sc_arr);
280 extern int p7_oprofile_UpdateMSVEmissionScores(P7_OPROFILE *om, P7_BG *bg, float *fwd_emissions, float *sc_arr);
281
282
283 extern int p7_oprofile_Convert(const P7_PROFILE *gm, P7_OPROFILE *om);
284 extern int p7_oprofile_ReconfigLength (P7_OPROFILE *om, int L);
285 extern int p7_oprofile_ReconfigMSVLength (P7_OPROFILE *om, int L);
286 extern int p7_oprofile_ReconfigRestLength(P7_OPROFILE *om, int L);
287 extern int p7_oprofile_ReconfigMultihit (P7_OPROFILE *om, int L);
288 extern int p7_oprofile_ReconfigUnihit (P7_OPROFILE *om, int L);
289
290 extern int p7_oprofile_Dump(FILE *fp, const P7_OPROFILE *om);
291 extern int p7_oprofile_Sample(ESL_RANDOMNESS *r, const ESL_ALPHABET *abc, const P7_BG *bg, int M, int L,
292 P7_HMM **opt_hmm, P7_PROFILE **opt_gm, P7_OPROFILE **ret_om);
293 extern int p7_oprofile_Compare(const P7_OPROFILE *om1, const P7_OPROFILE *om2, float tol, char *errmsg);
294 extern int p7_profile_SameAsMF(const P7_OPROFILE *om, P7_PROFILE *gm);
295 extern int p7_profile_SameAsVF(const P7_OPROFILE *om, P7_PROFILE *gm);
296
297 extern int p7_oprofile_GetFwdTransitionArray(const P7_OPROFILE *om, int type, float *arr );
298 extern int p7_oprofile_GetSSVEmissionScoreArray(const P7_OPROFILE *om, uint8_t *arr );
299 extern int p7_oprofile_GetFwdEmissionScoreArray(const P7_OPROFILE *om, float *arr );
300 extern int p7_oprofile_GetFwdEmissionArray(const P7_OPROFILE *om, P7_BG *bg, float *arr );
301
302 /* decoding.c */
303 extern int p7_Decoding (const P7_OPROFILE *om, const P7_OMX *oxf, P7_OMX *oxb, P7_OMX *pp);
304 extern int p7_DomainDecoding(const P7_OPROFILE *om, const P7_OMX *oxf, const P7_OMX *oxb, P7_DOMAINDEF *ddef);
305
306 /* fwdback.c */
307 extern int p7_Forward (const ESL_DSQ *dsq, int L, const P7_OPROFILE *om, P7_OMX *fwd, float *opt_sc);
308 extern int p7_ForwardParser (const ESL_DSQ *dsq, int L, const P7_OPROFILE *om, P7_OMX *fwd, float *opt_sc);
309 extern int p7_Backward (const ESL_DSQ *dsq, int L, const P7_OPROFILE *om, const P7_OMX *fwd, P7_OMX *bck, float *opt_sc);
310 extern int p7_BackwardParser(const ESL_DSQ *dsq, int L, const P7_OPROFILE *om, const P7_OMX *fwd, P7_OMX *bck, float *opt_sc);
311
312 /* io.c */
313 extern int p7_oprofile_Write(FILE *ffp, FILE *pfp, P7_OPROFILE *om);
314 extern int p7_oprofile_ReadMSV (P7_HMMFILE *hfp, ESL_ALPHABET **byp_abc, P7_OPROFILE **ret_om);
315 extern int p7_oprofile_ReadInfoMSV(P7_HMMFILE *hfp, ESL_ALPHABET **byp_abc, P7_OPROFILE **ret_om);
316 extern int p7_oprofile_ReadBlockMSV(P7_HMMFILE *hfp, ESL_ALPHABET **byp_abc, P7_OM_BLOCK *hmmBlock);
317 extern int p7_oprofile_ReadRest(P7_HMMFILE *hfp, P7_OPROFILE *om);
318 extern int p7_oprofile_Position(P7_HMMFILE *hfp, off_t offset);
319
320 extern P7_OM_BLOCK *p7_oprofile_CreateBlock(int size);
321 extern void p7_oprofile_DestroyBlock(P7_OM_BLOCK *block);
322
323 /* ssvfilter.c */
324 extern int p7_SSVFilter (const ESL_DSQ *dsq, int L, const P7_OPROFILE *om, float *ret_sc);
325
326 /* msvfilter.c */
327 extern int p7_MSVFilter (const ESL_DSQ *dsq, int L, const P7_OPROFILE *om, P7_OMX *ox, float *ret_sc);
328 extern int p7_SSVFilter_longtarget(const ESL_DSQ *dsq, int L, P7_OPROFILE *om, P7_OMX *ox, const P7_SCOREDATA *msvdata, P7_BG *bg, double P, P7_HMM_WINDOWLIST *windowlist);
329
330
331 /* null2.c */
332 extern int p7_Null2_ByExpectation(const P7_OPROFILE *om, const P7_OMX *pp, float *null2);
333 extern int p7_Null2_ByTrace (const P7_OPROFILE *om, const P7_TRACE *tr, int zstart, int zend, P7_OMX *wrk, float *null2);
334
335 /* optacc.c */
336 extern int p7_OptimalAccuracy(const P7_OPROFILE *om, const P7_OMX *pp, P7_OMX *ox, float *ret_e);
337 extern int p7_OATrace (const P7_OPROFILE *om, const P7_OMX *pp, const P7_OMX *ox, P7_TRACE *tr);
338
339 /* stotrace.c */
340 extern int p7_StochasticTrace(ESL_RANDOMNESS *rng, const ESL_DSQ *dsq, int L, const P7_OPROFILE *om, const P7_OMX *ox, P7_TRACE *tr);
341
342 /* vitfilter.c */
343 extern int p7_ViterbiFilter(const ESL_DSQ *dsq, int L, const P7_OPROFILE *om, P7_OMX *ox, float *ret_sc);
344 extern int p7_ViterbiFilter_longtarget(const ESL_DSQ *dsq, int L, const P7_OPROFILE *om, P7_OMX *ox,
345 float filtersc, double P, P7_HMM_WINDOWLIST *windowlist);
346
347
348 /* vitscore.c */
349 extern int p7_ViterbiScore (const ESL_DSQ *dsq, int L, const P7_OPROFILE *om, P7_OMX *ox, float *ret_sc);
350
351
352 /*****************************************************************
353 * 4. Implementation specific initialization
354 *****************************************************************/
355 static inline void
356 impl_Init(void)
357 {
358 #ifdef HAVE_FLUSH_ZERO_MODE
359 /* In order to avoid the performance penalty dealing with sub-normal
360 * values in the floating point calculations, set the processor flag
361 * so sub-normals are "flushed" immediately to zero.
362 */
363 _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
364 #endif
365
366 #ifdef _PMMINTRIN_H_INCLUDED
367 /*
368 * FLUSH_ZERO doesn't necessarily work in non-SIMD calculations
369 * (yes on 64-bit, maybe not of 32-bit). This ensures that those
370 * scalar calculations will agree across architectures.
371 * (See TW notes 2012/0106_printf_underflow_bug/00NOTES for details)
372 */
373 _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
374 #endif
375 }
376 #endif /* P7_IMPL_SSE_INCLUDED */
377
378
379 /*
380 * Currently (and this remains in flux as of 14 Dec 07) an optimized
381 * implementation is required to provide an MSVFilter(),
382 * ViterbiFilter() and a ForwardFilter() implementation. A call to
383 * p7_oprofile_Convert() makes an optimized profile that works for
384 * all filters.
385 *
386 * Any "Filter" returns a score may be an approximation (with
387 * characterized or at least characterizable error), and which may
388 * have limited upper range, such that high scores are returned as
389 * eslINFINITY. Additionally, Filters might only work on local
390 * alignment modes, because they are allowed to make assumptions about
391 * the range of scores.
392 *
393 * Here, MSVFilter() and ViterbiFilter() are 8-bit lspace
394 * implementations with limited precision and limited range (max 20
395 * bits); ForwardFilter() is a pspace float implementation with
396 * correct precision and limited range (max ~127 bits). Both require
397 * local mode models.
398 *
399 * An optimized implementation may also provide other optimized
400 * routines. It provides specialized Convert*() functions for these,
401 * which may no-op (if the OPROFILE already suffices), or may
402 * overwrite parts of the OPROFILE that Filters or other routines
403 * might need. Therefore, after using a "bonus" function, a fresh
404 * Convert() will be needed before a Filter() is called again. This
405 * API is tentative.
406 *
407 * For example, here, ViterbiScore() is a 32-bit lspace float SSE
408 * implementation of the Viterbi algorithm.
409 *
410 * A "Score" function might be an additional target for optimization,
411 * for example. A "Score" function returns a correct score with full
412 * floating-point precision and range, and works for any mode model.
413 *
414 * In the generic implementation, profile scores are 32-bit floating
415 * point log-odds scores. In an optimized implementation, internally,
416 * profile scores can be of any type, and may be in log space (lspace)
417 * or probability space (pspace). (Calculations in probability space
418 * are useful in the Forward algorithm, but always limit range.) A
419 * shorthand of "lspace uchar" means log-odds scores stored as
420 * unsigned chars, for example; "pspace float" means odds ratios
421 * stored as floats.
422 *
423 * A note on memory alignment: malloc() is required to return a
424 * pointer "suitably aligned so that it may be aligned to a pointer of
425 * any type of object" (C99 7.20.3). __m128 vectors are 128-bits wide,
426 * so malloc() ought to return a pointer aligned on a 16-byte
427 * boundary. However, this is not the case for glibc, and apparently
428 * other system libraries. Google turns up threads of arguments
429 * between glibc and gcc developers over whose problem this is; this
430 * argument has apparently not been resolved, and is of no help.
431 * Here, we manually align the relevant pointers by overallocating in
432 * *_mem with malloc, then arithmetically manipulating the address to
433 * mask off (~0xf).
434 */