Bug 25519 - Intel (SSE/MMX) intrinsics should only be mentioned instead of the builtins
Intel (SSE/MMX) intrinsics should only be mentioned instead of the builtins
Status: NEW
Product: gcc
Classification: Unclassified
Component: target
4.0.2
: P2 enhancement
: ---
Assigned To: Not yet assigned to anyone
: documentation, ssemmx
: 20049 23218 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-12-21 16:54 UTC by otho johnson
Modified: 2010-05-14 07:36 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-08-27 21:36:58


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description otho johnson 2005-12-21 16:54:39 UTC
In the "GCC online documentation" in the page entitled "5.45.5 X86 Built-in Functions" the lines documenting the addsubps and addsubpd instructions are listed as:

    v2df __builtin_ia32_addsubpd (v2df, v2df)
    v2df __builtin_ia32_addsubps (v2df, v2df)

The first line is correct as can be deduced by the hungarian notation of double as 'd' as the last letter. However the second line is a float operator yet the prototype given implies it to be a float operator. This is not the case as putting a v2df into the function results in an error. For instance take the following code:


#include <stdio.h>
typedef double v2df __attribute__ ((vector_size (16)));

int main()  {
    v2df a, b, c;
    c = __builtin_ia32_addsubps (a, b);
    return 1;
}

Attempting to compile this will result in the following error:

error: incompatible types in assignment

A simple change to v4sf will allow the code to compile, and I have verified that it works according to spec. Also all online documentation for the assembly instruction associated with this call, addsubps, document it as a 4-vector single precision float operator.

As a side comment I noticed that none of the sse2 instructions were listed on this page, yet also exist. For instance the instructions 

__builtin_ia32_addpd
__builtin_ia32_subpd
__builtin_ia32_mulpd
__builtin_ia32_divpd

do not exist on this page yet should.

I appreciate the help that this online documentation has provided. I dislike using asm on code that needs to be created and maintained in my enviornment, where little or no training on assembly is done or desired. We perform much work  on datasets of complex numbers and this documentation has allowed a simple yet fast and efficient way to perform complex multiplications and other operations. Here is for instance a macro for a complex multiplication:

// using SSE3 instructions
#define v4sf_complex_mult( a, b)	__builtin_ia32_addsubps (	\
	__builtin_ia32_movsldup (a) * (b),	\
	__builtin_ia32_movshdup (a) * __builtin_ia32_shufps (b, b, 0xb1)  )
Comment 1 Andrew Pinski 2005-12-21 16:59:35 UTC
You should be using the Intel intrinsics by using {x,}mmintrin.h/mm3dnow.h.
Comment 2 Andrew Pinski 2005-12-25 01:05:50 UTC
The documention should just reference the Intel intrinsics.

Confirmed.
Comment 3 Andrew Pinski 2006-04-28 17:39:53 UTC
This is a documentation regression as now, the builtins are inconstaint with the source.
Comment 4 Andrew Pinski 2006-04-28 17:41:12 UTC
*** Bug 23218 has been marked as a duplicate of this bug. ***
Comment 5 patchapp@dberlin.org 2006-10-10 13:55:18 UTC
Subject: Bug number PR25519

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00542.html
Comment 6 Richard Biener 2006-10-16 08:36:15 UTC
Subject: Bug 25519

Author: rguenth
Date: Mon Oct 16 08:36:03 2006
New Revision: 117774

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117774
Log:
2006-10-16  Richard Guenther  <rguenther@suse.de>

	PR target/25519
	* doc/extend.texi (X86 Built-in Functions): Fix typos in
	SSE builtin documentation.  Document SSE2 builtins.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/doc/extend.texi

Comment 7 Richard Biener 2006-10-16 08:39:02 UTC
Subject: Bug 25519

Author: rguenth
Date: Mon Oct 16 08:38:52 2006
New Revision: 117775

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117775
Log:
2006-10-16  Richard Guenther  <rguenther@suse.de>

	PR target/25519
	* doc/extend.texi (X86 Built-in Functions): Fix typos in
	SSE builtin documentation.  Document SSE2 builtins.

Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/doc/extend.texi

Comment 8 Richard Biener 2006-10-16 08:40:43 UTC
Subject: Bug 25519

Author: rguenth
Date: Mon Oct 16 08:40:32 2006
New Revision: 117776

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117776
Log:
2006-10-16  Richard Guenther  <rguenther@suse.de>

	PR target/25519
	* doc/extend.texi (X86 Built-in Functions): Fix typos in
	SSE builtin documentation.  Document SSE2 builtins.

Modified:
    branches/gcc-4_0-branch/gcc/ChangeLog
    branches/gcc-4_0-branch/gcc/doc/extend.texi

Comment 9 Richard Biener 2006-10-16 08:41:44 UTC
SSE2 builtins are now documented, so not a regression anymore.  Still a paragraph mentioning the intrinsics could improve the situation.
Comment 10 Uroš Bizjak 2010-05-14 07:36:04 UTC
*** Bug 20049 has been marked as a duplicate of this bug. ***