Deleted Added
sdiff udiff text old ( 102780 ) new ( 107590 )
full compact
1/* Copyright (C) 2002 Free Software Foundation, Inc.
2
3 This file is part of GNU CC.
4
5 GNU CC is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.

--- 17 unchanged lines hidden (view full) ---

26
27/* Implemented from the specification included in the Intel C++ Compiler
28 User Guide and Reference, version 5.0. */
29
30#ifndef _MMINTRIN_H_INCLUDED
31#define _MMINTRIN_H_INCLUDED
32
33/* The data type intended for user use. */
34typedef int __m64 __attribute__ ((__mode__ (__V2SI__)));
35
36/* Internal data types for implementing the intrinsics. */
37typedef int __v2si __attribute__ ((__mode__ (__V2SI__)));
38typedef int __v4hi __attribute__ ((__mode__ (__V4HI__)));
39typedef int __v8qi __attribute__ ((__mode__ (__V8QI__)));
40
41/* Empty the multimedia state. */
42static __inline void
43_mm_empty (void)
44{
45 __builtin_ia32_emms ();
46}
47
48/* Convert I to a __m64 object. The integer is zero-extended to 64-bits. */
49static __inline __m64
50_mm_cvtsi32_si64 (int __i)
51{
52 long long __tmp = (unsigned int)__i;
53 return (__m64) __tmp;
54}
55
56/* Convert the lower 32 bits of the __m64 object into an integer. */
57static __inline int
58_mm_cvtsi64_si32 (__m64 __i)
59{
60 long long __tmp = (long long)__i;
61 return __tmp;
62}
63
64/* Pack the four 16-bit values from M1 into the lower four 8-bit values of
65 the result, and the four 16-bit values from M2 into the upper four 8-bit
66 values of the result, all with signed saturation. */
67static __inline __m64
68_mm_packs_pi16 (__m64 __m1, __m64 __m2)
69{

--- 196 unchanged lines hidden (view full) ---

266{
267 return (__m64) __builtin_ia32_pmullw ((__v4hi)__m1, (__v4hi)__m2);
268}
269
270/* Shift four 16-bit values in M left by COUNT. */
271static __inline __m64
272_mm_sll_pi16 (__m64 __m, __m64 __count)
273{
274 return (__m64) __builtin_ia32_psllw ((__v4hi)__m, (long long)__count);
275}
276
277static __inline __m64
278_mm_slli_pi16 (__m64 __m, int __count)
279{
280 return (__m64) __builtin_ia32_psllw ((__v4hi)__m, __count);
281}
282
283/* Shift two 32-bit values in M left by COUNT. */
284static __inline __m64
285_mm_sll_pi32 (__m64 __m, __m64 __count)
286{
287 return (__m64) __builtin_ia32_pslld ((__v2si)__m, (long long)__count);
288}
289
290static __inline __m64
291_mm_slli_pi32 (__m64 __m, int __count)
292{
293 return (__m64) __builtin_ia32_pslld ((__v2si)__m, __count);
294}
295
296/* Shift the 64-bit value in M left by COUNT. */
297static __inline __m64
298_mm_sll_si64 (__m64 __m, __m64 __count)
299{
300 return (__m64) __builtin_ia32_psllq ((long long)__m, (long long)__count);
301}
302
303static __inline __m64
304_mm_slli_si64 (__m64 __m, int __count)
305{
306 return (__m64) __builtin_ia32_psllq ((long long)__m, (long long)__count);
307}
308
309/* Shift four 16-bit values in M right by COUNT; shift in the sign bit. */
310static __inline __m64
311_mm_sra_pi16 (__m64 __m, __m64 __count)
312{
313 return (__m64) __builtin_ia32_psraw ((__v4hi)__m, (long long)__count);
314}
315
316static __inline __m64
317_mm_srai_pi16 (__m64 __m, int __count)
318{
319 return (__m64) __builtin_ia32_psraw ((__v4hi)__m, __count);
320}
321
322/* Shift two 32-bit values in M right by COUNT; shift in the sign bit. */
323static __inline __m64
324_mm_sra_pi32 (__m64 __m, __m64 __count)
325{
326 return (__m64) __builtin_ia32_psrad ((__v2si)__m, (long long)__count);
327}
328
329static __inline __m64
330_mm_srai_pi32 (__m64 __m, int __count)
331{
332 return (__m64) __builtin_ia32_psrad ((__v2si)__m, __count);
333}
334
335/* Shift four 16-bit values in M right by COUNT; shift in zeros. */
336static __inline __m64
337_mm_srl_pi16 (__m64 __m, __m64 __count)
338{
339 return (__m64) __builtin_ia32_psrlw ((__v4hi)__m, (long long)__count);
340}
341
342static __inline __m64
343_mm_srli_pi16 (__m64 __m, int __count)
344{
345 return (__m64) __builtin_ia32_psrlw ((__v4hi)__m, __count);
346}
347
348/* Shift two 32-bit values in M right by COUNT; shift in zeros. */
349static __inline __m64
350_mm_srl_pi32 (__m64 __m, __m64 __count)
351{
352 return (__m64) __builtin_ia32_psrld ((__v2si)__m, (long long)__count);
353}
354
355static __inline __m64
356_mm_srli_pi32 (__m64 __m, int __count)
357{
358 return (__m64) __builtin_ia32_psrld ((__v2si)__m, __count);
359}
360
361/* Shift the 64-bit value in M left by COUNT; shift in zeros. */
362static __inline __m64
363_mm_srl_si64 (__m64 __m, __m64 __count)
364{
365 return (__m64) __builtin_ia32_psrlq ((long long)__m, (long long)__count);
366}
367
368static __inline __m64
369_mm_srli_si64 (__m64 __m, int __count)
370{
371 return (__m64) __builtin_ia32_psrlq ((long long)__m, (long long)__count);
372}
373
374/* Bit-wise AND the 64-bit values in M1 and M2. */
375static __inline __m64
376_mm_and_si64 (__m64 __m1, __m64 __m2)
377{
378 return (__m64) __builtin_ia32_pand ((long long)__m1, (long long)__m2);
379}
380
381/* Bit-wise complement the 64-bit value in M1 and bit-wise AND it with the
382 64-bit value in M2. */
383static __inline __m64
384_mm_andnot_si64 (__m64 __m1, __m64 __m2)
385{
386 return (__m64) __builtin_ia32_pandn ((long long)__m1, (long long)__m2);
387}
388
389/* Bit-wise inclusive OR the 64-bit values in M1 and M2. */
390static __inline __m64
391_mm_or_si64 (__m64 __m1, __m64 __m2)
392{
393 return (__m64)__builtin_ia32_por ((long long)__m1, (long long)__m2);
394}
395
396/* Bit-wise exclusive OR the 64-bit values in M1 and M2. */
397static __inline __m64
398_mm_xor_si64 (__m64 __m1, __m64 __m2)
399{
400 return (__m64)__builtin_ia32_pxor ((long long)__m1, (long long)__m2);
401}
402
403/* Compare eight 8-bit values. The result of the comparison is 0xFF if the
404 test is true and zero if false. */
405static __inline __m64
406_mm_cmpeq_pi8 (__m64 __m1, __m64 __m2)
407{
408 return (__m64) __builtin_ia32_pcmpeqb ((__v8qi)__m1, (__v8qi)__m2);

--- 32 unchanged lines hidden (view full) ---

441{
442 return (__m64) __builtin_ia32_pcmpgtd ((__v2si)__m1, (__v2si)__m2);
443}
444
445/* Creates a 64-bit zero. */
446static __inline __m64
447_mm_setzero_si64 (void)
448{
449 return (__m64)__builtin_ia32_mmx_zero ();
450}
451
452/* Creates a vector of two 32-bit values; I0 is least significant. */
453static __inline __m64
454_mm_set_pi32 (int __i1, int __i0)
455{
456 union {
457 __m64 __q;

--- 87 unchanged lines hidden ---