vec_st, vec_sta

Purpose

Stores a vector to memory at the given address.

Syntax

vec_st(a, b, c)
vec_sta(a, b, c)

Argument types

The following table describes the types of the function arguments.

a b c
vector4double long int*
unsigned*
long*
unsigned long*
long long*
unsigned long long*
float*
_Complex float*
double*
_Complex double*

Result

The effective address (EA) is the sum of b and c. The effective address is truncated to an n-byte alignment depending on the type of c as shown in the following table. The value of a is then stored at the effective address.

Type of c n
int*
unsigned*
16
long*
unsigned long*
long long*
unsigned long long*
32
float* 16
_Complex float*
double* 32
_Complex double*

vec_sta generates an exception (SIGBUS) if the effective address is not aligned to the appropriate memory boundary indicated in the table.

If c is a pointer to a variable of single-precision floating-point type or single-precision complex type, the elements of a are converted to single precision before being saved to memory.

If c is a pointer to a variable of 4-byte integer type, the four low-order bytes of the elements of a are saved to memory.

Formula

The following table shows the formulas depending on the type of c.

Type of c Formula
int*
unsigned*
Memory_4B[EA]=a[0]32:63
Memory_4B[EA+4]=a[1]32:63
Memory_4B[EA+8]=a[2]32:63
Memory_4B[EA+12]=a[3]32:63
long*
unsigned long*
long long*
unsigned long long*
Memory[EA]=a[0]
Memory[EA+8]=a[1]
Memory[EA+16]=a[2]
Memory[EA+24]=a[3]
float*
Memory_SP[EA]=(float) a[0]
Memory_SP[EA+4]=(float) a[1]
Memory_SP[EA+8]=(float) a[2]
Memory_SP[EA+12]=(float) a[3]
_Complex float*
double*
Memory[EA]=a[0]
Memory[EA+8]=a[1]
Memory[EA+16]=a[2]
Memory[EA+24]=a[3]
_Complex double*
Notes:
  • Memory_SP[] is a single-precision floating-point array.
  • Memory_4B[] is a 4-byte integer array.

Examples

Type of c a Memory values
int*
unsigned*
(10, 20, 30, 40) 10, 20, 30, 40
long*
unsigned long*
long long*
unsigned long long*
(10.0, 20.0, 30.0, 40.0) 0x4024000000000000,
0x4034000000000000,
0x403E000000000000,
0x4044000000000000
float* (10.0, 20.0, 30.0, 40.0) 10.0f, 20.0f, 30.0f, 40.0f
_Complex float* (10.0f, 20.0f) (30.0f, 40.0f)
double* 10.0, 20.0, 30.0, 40.0
_Complex double* (10.0, 20.0) (30.0, 40.0)