Oracle® Solaris Studio 12.4: C User's Guide

Exit Print View

Updated: March 2015
 
 

2.19.1 SIMD Intrinsics

The SIMD data provided by SPARC64X and SPARC64X+ can hold a pair of double or unsigned long long values. The compiler has a few intrinsic types and functions to handle these data.

2.19.1.1 Types and Operations

Prototypes declared in the sparcace_types.h header file support the following two SIMD data types that SPARC64X and SPARC64X+ provide:

__m128d

a pair of double-precision floating-point numbers

__m128i

a pair of signed/unsigned 64-bit integers

SIMD data type

  • is handled as a basic type, not aggregate; it has no internal structures. You need to use a intrinsic function to get a part of the data.

  • can be modified with type modifiers: const and/or volatile.

  • can be specified with storage class specifiers: auto, static, register, extern and/or typedef.

  • can be elements of an aggregate: array, struct and/or union.

SIMD data type variables

  • can be a formal parameter of a function.

  • can be an actual argument of a function call.

  • can be the return value of a function.

  • can be lhs or rhs of assignment operator "=".

  • can be the operand of address operator "&".

  • can be the operand of sizeof operator.

  • can be the operand of typeof operator.

Literal syntax is not supported for SIMD data types; you can build a SIMD data type constant with a proper intrinsic function.

2.19.1.2 Extensions to the Application Binary Interface

Passing/receiving a SIMD value to/from a function

Up to the first 8 SIMD arguments are passed via floating-point registers. The first halves of SIMD arguments occupy %d0, %d4, %d8, ..., %d28. The second halves of SIMD arguments occupy %d256, %d260, %d264, ..., %d284. If there are nine or more SIMD arguments, they are passed via the stack area.

Returning a SIMD value from a function

The first half of a SIMD return value appears in %d0. The second half appears in %d256.

Storing a SIMD value in memory

A SIMD type value should be stored at a 16 byte-aligned address in order to be loaded/stored with SIMD load(ldd,s)/store(std,s).

2.19.1.3 Intrinsic functions

The intrinsic functions declared in the sparcace_types.h header file are as follows:

__m128d __sparcace_set_m128d(double a, double b)

This function builds an __m128d type data from a pair of double-precision floating-point numbers and returns the object.

__m128i __sparcace_set_m128i(unsigned long long a, unsigned long long b)

This function builds an __m128i type data from a pair of unsigned long long type numbers and returns the object.

double __sparcace_extract_m128d(__m128d a, int imm

This function extracts a double-precision floating-point number from the __m128d type data passed as the first parameter. The value extracted is controlled by the second parameter. The second parameter must be an integer and must be a constant of 0 or 1.

unsigned long long __sparcace_extract_m128i(__m128i a, int imm)

This function extracts an unsigned long long type number from the __m128i type data passed as the first parameter. The value extracted is controlled by the second parameter. The second parameter must be an integer and must be a constant of 0 or 1.