1 -- { dg-do run { target i?86-*-* x86_64-*-* } }
2 -- { dg-options "-O1 -msse" }
3 -- { dg-require-effective-target sse_runtime }
5 with Ada
.Unchecked_Conversion
;
9 -- Base vector type definitions
12 VECTOR_ALIGN
: constant := 16;
13 VECTOR_BYTES
: constant := 16;
17 type m128
is array (1 .. 4) of Float;
18 for m128
'Alignment use VECTOR_ALIGN
;
19 pragma Machine_Attribute
(m128
, "vector_type");
20 pragma Machine_Attribute
(m128
, "may_alias");
27 function mm_add_ss
(A
, B
: m128
) return m128
;
28 pragma Import
(Intrinsic
, mm_add_ss
, "__builtin_ia32_addss");
30 -- User views / conversions or overlays
32 type Vf32_View
is array (1 .. 4) of Float;
33 for Vf32_View
'Alignment use VECTOR_ALIGN
;
35 function To_m128
is new Ada
.Unchecked_Conversion
(Vf32_View
, m128
);
36 function To_m128
is new Ada
.Unchecked_Conversion
(m128
, Vf32_View
);
41 for Vz
'Address use Z
'Address;
43 X
:= To_m128
((1.0, 1.0, 2.0, 2.0));
44 Y
:= To_m128
((2.0, 2.0, 1.0, 1.0));
45 Z
:= mm_add_ss
(X
, Y
);
47 if Vz
/= (3.0, 1.0, 2.0, 2.0) then