3 typedef vector
unsigned long long v2du
;
4 typedef vector
signed long long v2di
;
5 typedef vector
unsigned int v4su
;
6 typedef vector
signed int v4si
;
7 typedef vector
unsigned short v8hu
;
8 typedef vector
signed short v8hi
;
9 typedef vector
unsigned char v16qu
;
10 typedef vector
signed char v16qi
;
11 typedef vector
double v2df
;
12 typedef vector
float v4sf
;
14 typedef unsigned long long du
;
15 typedef signed long long di
;
16 typedef unsigned int su
;
17 typedef signed int si
;
18 typedef unsigned short hu
;
19 typedef signed short hi
;
20 typedef unsigned char qu
;
21 typedef signed char qi
;
25 /* To test whether we can optimize vector permutation away when
26 the two inputs are same type CTOR or one input is CTOR and the
29 /* CTOR + CTOR part (only same type supported). */
31 /* Test both operands are same type CTOR (type unsigned long long). */
32 __attribute__ ((noipa
)) v2du
33 test_ctor_ctor_same_du (du a
, du b
)
37 v16qu vc
= {0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23};
38 v2du vres
= (v2du
) vec_perm ((v16qu
) v1
, (v16qu
) v2
, vc
);
42 /* Test both operands are same type CTOR (type double). */
43 __attribute__ ((noipa
)) v2df
44 test_ctor_ctor_same_df (df a
, df b
)
48 v16qu vc
= {8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31};
49 v2df vres
= (v2df
) vec_perm ((v16qu
) v1
, (v16qu
) v2
, vc
);
53 /* Test both operands are same type CTOR (type signed int). */
54 __attribute__ ((noipa
)) v4si
55 test_ctor_ctor_same_si (si a
, si b
, si c
, si d
)
57 v4si v1
= {0, a
, 0, c
};
58 v4si v2
= {0, b
, 0, d
};
59 v16qu vc
= {4, 5, 6, 7, 20, 21, 22, 23, 12, 13, 14, 15, 28, 29, 30, 31};
60 v4si vres
= (v4si
) vec_perm ((v16qu
) v1
, (v16qu
) v2
, vc
);
64 /* Test both operands are same type CTOR (type float). */
65 __attribute__ ((noipa
)) v4sf
66 test_ctor_ctor_same_sf (sf a
, sf b
, sf c
, sf d
)
68 v4sf v1
= {c
, 0.0f
, d
, 0.0f
};
69 v4sf v2
= {a
, 0.0f
, b
, 0.0f
};
70 v16qu vc
= {16, 17, 18, 19, 24, 25, 26, 27, 0, 1, 2, 3, 8, 9, 10, 11};
71 v4sf vres
= (v4sf
) vec_perm ((v16qu
) v1
, (v16qu
) v2
, vc
);
75 /* Test both operands are same type CTOR (type unsigned short). */
76 __attribute__ ((noipa
)) v8hu
77 test_ctor_ctor_same_hu (hu a
, hu b
, hu c
, hu d
, hu e
, hu f
, hu g
, hu h
)
79 v8hu v1
= {0, a
, 0, b
, 0, c
, 0, d
};
80 v8hu v2
= {0, e
, 0, f
, 0, g
, 0, h
};
81 v16qu vc
= {2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31};
82 v8hu vres
= (v8hu
) vec_perm ((v16qu
) v1
, (v16qu
) v2
, vc
);
86 /* Test both operands are same type CTOR (type signed char). */
87 __attribute__ ((noipa
)) v16qi
88 test_ctor_ctor_same_qi (qi a
, qi b
, qi c
, qi d
, qi e
, qi f
, qi g
, qi h
)
90 v16qi v1
= {0, a
, 0, b
, 0, c
, 0, d
, 0, a
, 0, b
, 0, c
, 0, d
};
91 v16qi v2
= {0, e
, 0, f
, 0, g
, 0, h
, 0, e
, 0, f
, 0, g
, 0, h
};
92 v16qu vc
= {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31};
93 v16qi vres
= (v16qi
) vec_perm ((v16qu
) v1
, (v16qu
) v2
, vc
);
97 /* CTOR + CST part (same type). */
99 __attribute__ ((noipa
)) v2du
100 test_ctor_cst_same_du (du a
, du b
)
103 v2du v2
= {100, 200};
104 v16qu vc
= {0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23};
105 v2du vres
= (v2du
) vec_perm ((v16qu
) v1
, (v16qu
) v2
, vc
);
109 __attribute__ ((noipa
)) v4sf
110 test_ctor_cst_same_sf (sf a
, sf b
)
112 v4sf v1
= {0.0f
, a
, 0.0f
, b
};
113 v4sf v2
= {1.0f
, 2.0f
, 3.0f
, 4.0f
};
114 v16qu vc
= {4, 5, 6, 7, 20, 21, 22, 23, 12, 13, 14, 15, 28, 29, 30, 31};
115 v4sf vres
= (v4sf
) vec_perm ((v16qu
) v1
, (v16qu
) v2
, vc
);
119 /* CST + CTOR part (same type). */
121 __attribute__ ((noipa
)) v2df
122 test_ctor_cst_same_df (df a
, df b
)
125 v2df v2
= {100.0, 200.0};
126 v16qu vc
= {8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31};
127 v2df vres
= (v2df
) vec_perm ((v16qu
) v1
, (v16qu
) v2
, vc
);
131 __attribute__ ((noipa
)) v4si
132 test_cst_ctor_same_si (si a
, si b
)
134 v4si v1
= {a
, 0, b
, 0};
135 v4si v2
= {1, 2, 3, 4};
136 v16qu vc
= {16, 17, 18, 19, 24, 25, 26, 27, 0, 1, 2, 3, 8, 9, 10, 11};
137 v4si vres
= (v4si
) vec_perm ((v16qu
) v1
, (v16qu
) v2
, vc
);
141 /* CTOR + CST part (different types). */
143 __attribute__ ((noipa
)) v2di
144 test_ctor_cst_diff_di_si (di a
, di b
)
147 v4si v2
= {3, 0, 4, 0};
148 v16qu vc
= {0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23};
149 v2di vres
= (v2di
) vec_perm ((v16qu
) v1
, (v16qu
) v2
, vc
);
153 /* CST + CTOR part (different types). */
155 __attribute__ ((noipa
)) v2du
156 test_cst_ctor_diff_sf_du (du a
, du b
)
158 v4sf v1
= {1.0f
, 2.0f
, 3.0f
, 4.0f
};
160 v16qu vc
= {0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23};
161 v2du vres
= (v2du
) vec_perm ((v16qu
) v1
, (v16qu
) v2
, vc
);