This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug web/25519] New: Online Documentation: error for addsubps and missing SSE2 instructions


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)  )


-- 
           Summary: Online Documentation: error for addsubps and missing
                    SSE2 instructions
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: web
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: othojunk at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25519


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]