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 unsigned long long __m64 __attribute__ ((__aligned__ (8)));
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 return (unsigned int) __i;
53}
54
55/* Convert the lower 32 bits of the __m64 object into an integer. */
56static __inline int
57_mm_cvtsi64_si32 (__m64 __i)
58{
59 return __i;
60}
61
62/* Pack the four 16-bit values from M1 into the lower four 8-bit values of
63 the result, and the four 16-bit values from M2 into the upper four 8-bit
64 values of the result, all with signed saturation. */
65static __inline __m64
66_mm_packs_pi16 (__m64 __m1, __m64 __m2)
67{

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

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

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

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

--- 87 unchanged lines hidden ---