@@ -2194,7 +2194,9 @@ BU_P9V_64BIT_AV_X (STXVL, "stxvl", MISC)
BU_P9V_64BIT_AV_X (XST_LEN_R, "xst_len_r", MISC)
/* 1 argument vector functions added in ISA 3.0 (power9). */
-BU_P9V_AV_1 (VCLZLSBB, "vclzlsbb", CONST, vclzlsbb)
+BU_P9V_AV_1 (VCLZLSBB_V16QI, "vclzlsbb_v16qi", CONST, vclzlsbb_v16qi)
+BU_P9V_AV_1 (VCLZLSBB_V8HI, "vclzlsbb_v8hi", CONST, vclzlsbb_v8hi)
+BU_P9V_AV_1 (VCLZLSBB_V4SI, "vclzlsbb_v4si", CONST, vclzlsbb_v4si)
BU_P9V_AV_1 (VCTZLSBB_V16QI, "vctzlsbb_v16qi", CONST, vctzlsbb_v16qi)
BU_P9V_AV_1 (VCTZLSBB_V8HI, "vctzlsbb_v8hi", CONST, vctzlsbb_v8hi)
BU_P9V_AV_1 (VCTZLSBB_V4SI, "vctzlsbb_v4si", CONST, vctzlsbb_v4si)
@@ -5451,9 +5451,9 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI,
RS6000_BTI_unsigned_V4SI, 0 },
- { P9V_BUILTIN_VEC_VCLZLSBB, P9V_BUILTIN_VCLZLSBB,
+ { P9V_BUILTIN_VEC_VCLZLSBB, P9V_BUILTIN_VCLZLSBB_V16QI,
RS6000_BTI_INTSI, RS6000_BTI_V16QI, 0, 0 },
- { P9V_BUILTIN_VEC_VCLZLSBB, P9V_BUILTIN_VCLZLSBB,
+ { P9V_BUILTIN_VEC_VCLZLSBB, P9V_BUILTIN_VCLZLSBB_V16QI,
RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI, 0, 0 },
{ P9V_BUILTIN_VEC_VCTZLSBB, P9V_BUILTIN_VCTZLSBB_V16QI,
@@ -4723,7 +4723,8 @@
"vcmpnez<VSX_EXTRACT_WIDTH>. %0,%1,%2"
[(set_attr "type" "vecsimple")])
-;; Return first position of match between vectors
+;; Return first position of match between vectors using natural order
+;; for both LE and BE execution modes.
(define_expand "first_match_index_<mode>"
[(match_operand:SI 0 "register_operand")
(unspec:SI [(match_operand:VSX_EXTRACT_I 1 "register_operand")
@@ -4743,17 +4744,26 @@
sh = GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) / 2;
if (<MODE>mode == V16QImode)
- emit_insn (gen_vctzlsbb_<mode> (operands[0], not_result));
+ {
+ if (!BYTES_BIG_ENDIAN)
+ emit_insn (gen_vctzlsbb_<mode> (operands[0], not_result));
+ else
+ emit_insn (gen_vclzlsbb_<mode> (operands[0], not_result));
+ }
else
{
rtx tmp = gen_reg_rtx (SImode);
- emit_insn (gen_vctzlsbb_<mode> (tmp, not_result));
+ if (!BYTES_BIG_ENDIAN)
+ emit_insn (gen_vctzlsbb_<mode> (tmp, not_result));
+ else
+ emit_insn (gen_vclzlsbb_<mode> (tmp, not_result));
emit_insn (gen_ashrsi3 (operands[0], tmp, GEN_INT (sh)));
}
DONE;
})
-;; Return first position of match between vectors or end of string (EOS)
+;; Return first position of match between vectors or end of string (EOS) using
+;; natural element order for both LE and BE execution modes.
(define_expand "first_match_or_eos_index_<mode>"
[(match_operand:SI 0 "register_operand")
(unspec: SI [(match_operand:VSX_EXTRACT_I 1 "register_operand")
@@ -4785,17 +4795,26 @@
sh = GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) / 2;
if (<MODE>mode == V16QImode)
- emit_insn (gen_vctzlsbb_<mode> (operands[0], result));
+ {
+ if (!BYTES_BIG_ENDIAN)
+ emit_insn (gen_vctzlsbb_<mode> (operands[0], result));
+ else
+ emit_insn (gen_vclzlsbb_<mode> (operands[0], result));
+ }
else
{
rtx tmp = gen_reg_rtx (SImode);
- emit_insn (gen_vctzlsbb_<mode> (tmp, result));
+ if (!BYTES_BIG_ENDIAN)
+ emit_insn (gen_vctzlsbb_<mode> (tmp, result));
+ else
+ emit_insn (gen_vclzlsbb_<mode> (tmp, result));
emit_insn (gen_ashrsi3 (operands[0], tmp, GEN_INT (sh)));
}
DONE;
})
-;; Return first position of mismatch between vectors
+;; Return first position of mismatch between vectors using natural
+;; element order for both LE and BE execution modes.
(define_expand "first_mismatch_index_<mode>"
[(match_operand:SI 0 "register_operand")
(unspec: SI [(match_operand:VSX_EXTRACT_I 1 "register_operand")
@@ -4811,17 +4830,26 @@
sh = GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) / 2;
if (<MODE>mode == V16QImode)
- emit_insn (gen_vctzlsbb_<mode> (operands[0], cmp_result));
+ {
+ if (!BYTES_BIG_ENDIAN)
+ emit_insn (gen_vctzlsbb_<mode> (operands[0], cmp_result));
+ else
+ emit_insn (gen_vclzlsbb_<mode> (operands[0], cmp_result));
+ }
else
{
rtx tmp = gen_reg_rtx (SImode);
- emit_insn (gen_vctzlsbb_<mode> (tmp, cmp_result));
+ if (!BYTES_BIG_ENDIAN)
+ emit_insn (gen_vctzlsbb_<mode> (tmp, cmp_result));
+ else
+ emit_insn (gen_vclzlsbb_<mode> (tmp, cmp_result));
emit_insn (gen_ashrsi3 (operands[0], tmp, GEN_INT (sh)));
}
DONE;
})
;; Return first position of mismatch between vectors or end of string (EOS)
+;; using natural element order for both LE and BE execution modes.
(define_expand "first_mismatch_or_eos_index_<mode>"
[(match_operand:SI 0 "register_operand")
(unspec: SI [(match_operand:VSX_EXTRACT_I 1 "register_operand")
@@ -4856,11 +4884,19 @@
sh = GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) / 2;
if (<MODE>mode == V16QImode)
- emit_insn (gen_vctzlsbb_<mode> (operands[0], result));
+ {
+ if (!BYTES_BIG_ENDIAN)
+ emit_insn (gen_vctzlsbb_<mode> (operands[0], result));
+ else
+ emit_insn (gen_vclzlsbb_<mode> (operands[0], result));
+ }
else
{
rtx tmp = gen_reg_rtx (SImode);
- emit_insn (gen_vctzlsbb_<mode> (tmp, result));
+ if (!BYTES_BIG_ENDIAN)
+ emit_insn (gen_vctzlsbb_<mode> (tmp, result));
+ else
+ emit_insn (gen_vclzlsbb_<mode> (tmp, result));
emit_insn (gen_ashrsi3 (operands[0], tmp, GEN_INT (sh)));
}
DONE;
@@ -5040,10 +5076,10 @@
[(set_attr "type" "vecsimple")])
;; Vector Count Leading Zero Least-Significant Bits Byte
-(define_insn "vclzlsbb"
+(define_insn "vclzlsbb_<mode>"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec:SI
- [(match_operand:V16QI 1 "altivec_register_operand" "v")]
+ [(match_operand:VSX_EXTRACT_I 1 "altivec_register_operand" "v")]
UNSPEC_VCLZLSBB))]
"TARGET_P9_VECTOR"
"vclzlsbb %0,%1"
@@ -10,8 +10,84 @@
#include <stdio.h>
#endif
+#ifdef DEBUG2
+#include <stdio.h>
+#endif
+
+
void abort (void);
+#ifdef DEBUG2
+void print_signed_char (char *name, vector signed char src)
+{
+ int i;
+
+ for (i = 0; i < 8; i++)
+ printf("%s[%d] = %d, ", name, i, src[i]);
+
+ printf("\n");
+
+ for (i = 8; i < 15; i++)
+ printf("%s[%d] = %d, ", name, i, src[i]);
+
+ printf("%s[%d] = %d\n", name, 15, src[i]);
+}
+
+void print_unsigned_char (char *name, vector unsigned char src)
+{
+ int i;
+
+ for (i = 0; i < 8; i++)
+ printf("%s[%d] = %d, ", name, i, src[i]);
+
+ printf("\n");
+
+ for (i = 8; i < 15; i++)
+ printf("%s[%d] = %d, ", name, i, src[i]);
+
+ printf("%s[%d] = %d\n", name, 15, src[i]);
+}
+
+void print_signed_short_int (char *name, vector signed short int src)
+{
+ int i;
+
+ for (i = 0; i < 7; i++)
+ printf("%s[%d] = %d, ", name, i, src[i]);
+
+ printf("%s[%d] = %d\n", name, 7, src[i]);
+}
+
+void print_unsigned_short_int (char *name, vector unsigned short int src)
+{
+ int i;
+
+ for (i = 0; i < 7; i++)
+ printf("%s[%d] = %d, ", name, i, src[i]);
+
+ printf("%s[%d] = %d\n", name, 7, src[i]);
+}
+
+void print_signed_int (char *name, vector signed int src)
+{
+ int i;
+
+ for (i = 0; i < 3; i++)
+ printf("%s[%d] = %d, ", name, i, src[i]);
+
+ printf("%s[%d] = %d\n", name, 3, src[i]);
+}
+
+void print_unsigned_int (char *name, vector unsigned int src)
+{
+ int i;
+
+ for (i = 0; i < 3; i++)
+ printf("%s[%d] = %d, ", name, i, src[i]);
+
+ printf("%s[%d] = %d\n", name, 3, src[i]);
+}
+#endif
int main() {
@@ -24,7 +100,9 @@ int main() {
unsigned int result, expected_result;
- /* Tests for: vec_first_match_index() */
+ /* Tests for: vec_first_match_index()
+ The element index in natural element order is returned for the
+ first match or the number of elements if there is no match. */
/* char */
char_src1 = (vector signed char) {-1, 2, 3, 4, -5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16};
@@ -34,6 +112,12 @@ int main() {
result = vec_first_match_index (char_src1, char_src2);
+#ifdef DEBUG2
+ print_signed_char("src1", char_src1);
+ print_signed_char("src2", char_src2);
+ printf(" vec_first_match_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: char first match result (%d) does not match expected result (%d)\n",
@@ -50,6 +134,12 @@ int main() {
result = vec_first_match_index (char_src1, char_src2);
+#ifdef DEBUG2
+ print_signed_char("src1", char_src1);
+ print_signed_char("src2", char_src2);
+ printf("vec_first_match_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: char first match result (%d) does not match expected result (%d)\n",
@@ -66,6 +156,12 @@ int main() {
result = vec_first_match_index (uchar_src1, uchar_src2);
+#ifdef DEBUG2
+ print_unsigned_char("src1", uchar_src1);
+ print_unsigned_char("src2", uchar_src2);
+ printf("vec_first_match_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uchar first match result (%d) does not match expected result (%d)\n",
@@ -82,6 +178,12 @@ int main() {
result = vec_first_match_index (uchar_src1, uchar_src2);
+#ifdef DEBUG2
+ print_unsigned_char("src1", uchar_src1);
+ print_unsigned_char("src2", uchar_src2);
+ printf("vec_first_match_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uchar first match result (%d) does not match expected result (%d)\n",
@@ -98,6 +200,12 @@ int main() {
result = vec_first_match_index (short_src1, short_src2);
+#ifdef DEBUG2
+ print_signed_short_int("src1", short_src1);
+ print_signed_short_int("src2", short_src2);
+ printf("vec_first_match_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: short int first match result (%d) does not match expected result (%d)\n",
@@ -113,6 +221,12 @@ int main() {
result = vec_first_match_index (short_src1, short_src2);
+#ifdef DEBUG2
+ print_signed_short_int("src1", short_src1);
+ print_signed_short_int("src2", short_src2);
+ printf("vec_first_match_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: short int first match result (%d) does not match expected result (%d)\n",
@@ -128,6 +242,12 @@ int main() {
result = vec_first_match_index (ushort_src1, ushort_src2);
+#ifdef DEBUG2
+ print_unsigned_short_int("src1", ushort_src1);
+ print_unsigned_short_int("src2", ushort_src2);
+ printf("vec_first_match_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: ushort int first match result (%d) does not match expected result (%d)\n",
@@ -145,6 +265,12 @@ int main() {
result = vec_first_match_index (ushort_src1, ushort_src2);
+#ifdef DEBUG2
+ print_unsigned_short_int("src1", ushort_src1);
+ print_unsigned_short_int("src2", ushort_src2);
+ printf("vec_first_match_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: ushort int first match result (%d) does not match expected result (%d)\n",
@@ -161,6 +287,12 @@ int main() {
result = vec_first_match_index (int_src1, int_src2);
+#ifdef DEBUG2
+ print_signed_int("src1", int_src1);
+ print_signed_int("src2", int_src2);
+ printf("vec_first_match_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: int first match result (%d) does not match expected result (%d)\n",
@@ -176,6 +308,12 @@ int main() {
result = vec_first_match_index (int_src1, int_src2);
+#ifdef DEBUG2
+ print_signed_int("src1", int_src1);
+ print_signed_int("src2", int_src2);
+ printf("vec_first_match_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: int first match result (%d) does not match expected result (%d)\n",
@@ -191,6 +329,12 @@ int main() {
result = vec_first_match_index (uint_src1, uint_src2);
+#ifdef DEBUG2
+ print_unsigned_int("src1", uint_src1);
+ print_unsigned_int("src2", uint_src2);
+ printf("vec_first_match_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uint first match result (%d) does not match expected result (%d)\n",
@@ -206,6 +350,12 @@ int main() {
result = vec_first_match_index (uint_src1, uint_src2);
+#ifdef DEBUG2
+ print_unsigned_int("src1", uint_src1);
+ print_unsigned_int("src2", uint_src2);
+ printf("vec_first_match_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uint first match result (%d) does not match expected result (%d)\n",
@@ -214,7 +364,9 @@ int main() {
abort();
#endif
- /* Tests for: vec_first_mismatch_index() */
+ /* Tests for: vec_first_mismatch_index()
+ The element index in BE order is returned for the first mismatch
+ or the number of elements if there is no match. */
/* char */
char_src1 = (vector signed char) {-1, 2, 3, 4, -5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16};
@@ -224,6 +376,12 @@ int main() {
result = vec_first_mismatch_index (char_src1, char_src2);
+#ifdef DEBUG2
+ print_signed_char("src1", char_src1);
+ print_signed_char("src2", char_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: char first mismatch result (%d) does not match expected result (%d)\n",
@@ -240,6 +398,12 @@ int main() {
result = vec_first_mismatch_index (char_src1, char_src2);
+#ifdef DEBUG2
+ print_signed_char("src1", char_src1);
+ print_signed_char("src2", char_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: char first mismatch result (%d) does not match expected result (%d)\n",
@@ -256,6 +420,12 @@ int main() {
result = vec_first_mismatch_index (uchar_src1, uchar_src2);
+#ifdef DEBUG2
+ print_unsigned_char("src1", uchar_src1);
+ print_unsigned_char("src2", uchar_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uchar first mismatch result (%d) does not match expected result (%d)\n",
@@ -272,10 +442,16 @@ int main() {
result = vec_first_mismatch_index (uchar_src1, uchar_src2);
+#ifdef DEBUG2
+ print_unsigned_char("src1", uchar_src1);
+ print_unsigned_char("src2", uchar_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uchar first mismatch result (%d) does not match expected result (%d)\n",
- result, expected_result);
+ result, expected_result);
#else
abort();
#endif
@@ -288,6 +464,12 @@ int main() {
result = vec_first_mismatch_index (uchar_src1, uchar_src2);
+#ifdef DEBUG2
+ print_unsigned_char("src1", uchar_src1);
+ print_unsigned_char("src2", uchar_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uchar first mismatch result (%d) does not match expected result (%d)\n",
@@ -304,6 +486,12 @@ int main() {
result = vec_first_mismatch_index (short_src1, short_src2);
+#ifdef DEBUG2
+ print_signed_short_int("src1", short_src1);
+ print_signed_short_int("src2", short_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: short int first mismatch result (%d) does not match expected result (%d)\n",
@@ -319,6 +507,12 @@ int main() {
result = vec_first_mismatch_index (short_src1, short_src2);
+#ifdef DEBUG2
+ print_signed_short_int("src1", short_src1);
+ print_signed_short_int("src2", short_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: short int first mismatch result (%d) does not match expected result (%d)\n",
@@ -334,6 +528,12 @@ int main() {
result = vec_first_mismatch_index (ushort_src1, ushort_src2);
+#ifdef DEBUG2
+ print_unsigned_short_int("src1", ushort_src1);
+ print_unsigned_short_int("src2", ushort_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: ushort int first mismatch result (%d) does not match expected result (%d)\n",
@@ -349,6 +549,12 @@ int main() {
result = vec_first_mismatch_index (ushort_src1, ushort_src2);
+#ifdef DEBUG2
+ print_unsigned_short_int("src1", ushort_src1);
+ print_unsigned_short_int("src2", ushort_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: ushort int first mismatch result (%d) does not match expected result (%d)\n",
@@ -365,6 +571,12 @@ int main() {
result = vec_first_mismatch_index (int_src1, int_src2);
+#ifdef DEBUG2
+ print_signed_int("src1", int_src1);
+ print_signed_int("src2", int_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: int first mismatch result (%d) does not match expected result (%d)\n",
@@ -380,6 +592,12 @@ int main() {
result = vec_first_mismatch_index (int_src1, int_src2);
+#ifdef DEBUG2
+ print_signed_int("src1", int_src1);
+ print_signed_int("src2", int_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: int first mismatch result (%d) does not match expected result (%d)\n",
@@ -395,6 +613,12 @@ int main() {
result = vec_first_mismatch_index (int_src1, int_src2);
+#ifdef DEBUG2
+ print_signed_int("src1", int_src1);
+ print_signed_int("src2", int_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: int first mismatch result (%d) does not match expected result (%d)\n",
@@ -410,6 +634,12 @@ int main() {
result = vec_first_mismatch_index (uint_src1, uint_src2);
+#ifdef DEBUG2
+ print_unsigned_int("src1", uint_src1);
+ print_unsigned_int("src2", uint_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uint first mismatch result (%d) does not match expected result (%d)\n",
@@ -425,7 +655,14 @@ int main() {
result = vec_first_mismatch_index (uint_src1, uint_src2);
+#ifdef DEBUG2
+ print_unsigned_int("src1", uint_src1);
+ print_unsigned_int("src2", uint_src2);
+ printf("vec_first_mismatch_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
+
#ifdef DEBUG
printf("Error: uint first mismatch result (%d) does not match expected result (%d)\n",
result, expected_result);
@@ -433,7 +670,9 @@ int main() {
abort();
#endif
- /* Tests for: vec_first_match_or_eos_index() */
+ /* Tests for: vec_first_match_or_eos_index()
+ The element index in BE order is returned for the first match
+ or the number of elements if there is no match. */
/* char */
char_src1 = (vector signed char) {-1, 2, 3, 4, -5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16};
@@ -443,6 +682,12 @@ int main() {
result = vec_first_match_or_eos_index (char_src1, char_src2);
+#ifdef DEBUG2
+ print_signed_char("src1", char_src1);
+ print_signed_char("src2", char_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: char first match result (%d) does not match expected result (%d)\n",
@@ -459,6 +704,12 @@ int main() {
result = vec_first_match_or_eos_index (char_src1, char_src2);
+#ifdef DEBUG2
+ print_signed_char("src1", char_src1);
+ print_signed_char("src2", char_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: char first match or EOS result (%d) does not match expected result (%d)\n",
@@ -475,12 +726,18 @@ int main() {
result = vec_first_match_or_eos_index (char_src1, char_src2);
+#ifdef DEBUG2
+ print_signed_char("src1", char_src1);
+ print_signed_char("src2", char_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: char first match or EOS result (%d) does not match expected result (%d)\n",
result, expected_result);
#else
- abort();
+ abort();
#endif
uchar_src1 = (vector unsigned char) {1, 2, 3, 4, 5, 6, 7, 8,
@@ -491,6 +748,12 @@ int main() {
result = vec_first_match_or_eos_index (uchar_src1, uchar_src2);
+#ifdef DEBUG2
+ print_unsigned_char("src1", uchar_src1);
+ print_unsigned_char("src2", uchar_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uchar first match or EOS result (%d) does not match expected result (%d)\n",
@@ -507,6 +770,12 @@ int main() {
result = vec_first_match_or_eos_index (uchar_src1, uchar_src2);
+#ifdef DEBUG2
+ print_unsigned_char("src1", uchar_src1);
+ print_unsigned_char("src2", uchar_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uchar first match or EOS result (%d) does not match expected result (%d)\n",
@@ -523,6 +792,12 @@ int main() {
result = vec_first_match_or_eos_index (short_src1, short_src2);
+#ifdef DEBUG2
+ print_signed_short_int("src1", short_src1);
+ print_signed_short_int("src2", short_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: short int first match or EOS result (%d) does not match expected result (%d)\n",
@@ -538,6 +813,12 @@ int main() {
result = vec_first_match_or_eos_index (short_src1, short_src2);
+#ifdef DEBUG2
+ print_signed_short_int("src1", short_src1);
+ print_signed_short_int("src2", short_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: short int first match or EOS result (%d) does not match expected result (%d)\n",
@@ -553,6 +834,12 @@ int main() {
result = vec_first_match_or_eos_index (short_src1, short_src2);
+#ifdef DEBUG2
+ print_signed_short_int("src1", short_src1);
+ print_signed_short_int("src2", short_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: short int first match or EOS result (%d) does not match expected result (%d)\n",
@@ -568,6 +855,12 @@ int main() {
result = vec_first_match_or_eos_index (short_src1, short_src2);
+#ifdef DEBUG2
+ print_signed_short_int("src1", short_src1);
+ print_signed_short_int("src2", short_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: short int first match or EOS result (%d) does not match expected result (%d)\n",
@@ -583,6 +876,12 @@ int main() {
result = vec_first_match_or_eos_index (ushort_src1, ushort_src2);
+#ifdef DEBUG2
+ print_unsigned_short_int("src1", ushort_src1);
+ print_unsigned_short_int("src2", ushort_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: ushort int first match or EOS result (%d) does not match expected result (%d)\n",
@@ -600,6 +899,12 @@ int main() {
result = vec_first_match_or_eos_index (ushort_src1, ushort_src2);
+#ifdef DEBUG2
+ print_unsigned_short_int("src1", ushort_src1);
+ print_unsigned_short_int("src2", ushort_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: ushort int first match or EOS result (%d) does not match expected result (%d)\n",
@@ -616,10 +921,16 @@ int main() {
result = vec_first_match_or_eos_index (ushort_src1, ushort_src2);
+#ifdef DEBUG2
+ print_unsigned_short_int("src1", ushort_src1);
+ print_unsigned_short_int("src2", ushort_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
- printf("Error: ushort int first match or EOS result (%d) does not match expected result (%d)\n",
- result, expected_result);
+ printf("Error: ushort int first match or EOS result (%d) does not match expected result (%d)\n",
+ result, expected_result);
#else
abort();
#endif
@@ -632,6 +943,12 @@ int main() {
result = vec_first_match_or_eos_index (int_src1, int_src2);
+#ifdef DEBUG2
+ print_signed_int("src1", int_src1);
+ print_signed_int("src2", int_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: int first match or EOS result (%d) does not match expected result (%d)\n",
@@ -647,6 +964,12 @@ int main() {
result = vec_first_match_or_eos_index (int_src1, int_src2);
+#ifdef DEBUG2
+ print_signed_int("src1", int_src1);
+ print_signed_int("src2", int_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: int first match or EOS result (%d) does not match expected result (%d)\n",
@@ -662,10 +985,16 @@ int main() {
result = vec_first_match_or_eos_index (int_src1, int_src2);
+#ifdef DEBUG2
+ print_signed_int("src1", int_src1);
+ print_signed_int("src2", int_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
- printf("Error: int first match or EOS result (%d) does not match expected result (%d)\n",
- result, expected_result);
+ printf("Error: int first match or EOS result (%d) does not match expected result (%d)\n",
+ result, expected_result);
#else
abort();
#endif
@@ -677,6 +1006,12 @@ int main() {
result = vec_first_match_or_eos_index (uint_src1, uint_src2);
+#ifdef DEBUG2
+ print_unsigned_int("src1", uint_src1);
+ print_unsigned_int("src2", uint_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uint first match or EOS result (%d) does not match expected result (%d)\n",
@@ -692,6 +1027,12 @@ int main() {
result = vec_first_match_or_eos_index (uint_src1, uint_src2);
+#ifdef DEBUG2
+ print_unsigned_int("src1", uint_src1);
+ print_unsigned_int("src2", uint_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uint first match or EOS result (%d) does not match expected result (%d)\n",
@@ -707,6 +1048,12 @@ int main() {
result = vec_first_match_or_eos_index (uint_src1, uint_src2);
+#ifdef DEBUG2
+ print_unsigned_int("src1", uint_src1);
+ print_unsigned_int("src2", uint_src2);
+ printf("vec_first_match_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uint first match or EOS result (%d) does not match expected result (%d)\n",
@@ -715,7 +1062,9 @@ int main() {
abort();
#endif
- /* Tests for: vec_first_mismatch_or_eos_index() */
+ /* Tests for: vec_first_mismatch_or_eos_index()
+ The element index in BE order is returned for the first mismatch
+ or the number of elements if there is no match. */
/* char */
char_src1 = (vector signed char) {-1, 2, 3, 4, -5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16};
@@ -725,6 +1074,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (char_src1, char_src2);
+#ifdef DEBUG2
+ print_signed_char("src1", char_src1);
+ print_signed_char("src2", char_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: char first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -741,6 +1096,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (char_src1, char_src2);
+#ifdef DEBUG2
+ print_signed_char("src1", char_src1);
+ print_signed_char("src2", char_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: char first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -757,6 +1118,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (char_src1, char_src2);
+#ifdef DEBUG2
+ print_signed_char("src1", char_src1);
+ print_signed_char("src2", char_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: char first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -773,12 +1140,18 @@ int main() {
result = vec_first_mismatch_or_eos_index (uchar_src1, uchar_src2);
+#ifdef DEBUG2
+ print_unsigned_char("src1", uchar_src1);
+ print_unsigned_char("src2", uchar_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uchar first mismatch or EOS result (%d) does not match expected result (%d)\n",
result, expected_result);
#else
- abort();
+ abort();
#endif
uchar_src1 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
@@ -789,6 +1162,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (uchar_src1, uchar_src2);
+#ifdef DEBUG2
+ print_unsigned_char("src1", uchar_src1);
+ print_unsigned_char("src2", uchar_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uchar first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -805,6 +1184,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (uchar_src1, uchar_src2);
+#ifdef DEBUG2
+ print_unsigned_char("src1", uchar_src1);
+ print_unsigned_char("src2", uchar_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uchar first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -821,6 +1206,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (uchar_src1, uchar_src2);
+#ifdef DEBUG2
+ print_unsigned_char("src1", uchar_src1);
+ print_unsigned_char("src2", uchar_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: uchar first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -837,6 +1228,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (short_src1, short_src2);
+#ifdef DEBUG2
+ print_signed_short_int("src1", short_src1);
+ print_signed_short_int("src2", short_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: short int first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -852,6 +1249,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (short_src1, short_src2);
+#ifdef DEBUG2
+ print_signed_short_int("src1", short_src1);
+ print_signed_short_int("src2", short_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: short int first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -867,6 +1270,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (short_src1, short_src2);
+#ifdef DEBUG2
+ print_signed_short_int("src1", short_src1);
+ print_signed_short_int("src2", short_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: short int first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -882,6 +1291,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (short_src1, short_src2);
+#ifdef DEBUG2
+ print_signed_short_int("src1", short_src1);
+ print_signed_short_int("src2", short_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: short int first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -897,6 +1312,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (ushort_src1, ushort_src2);
+#ifdef DEBUG2
+ print_unsigned_short_int("src1", ushort_src1);
+ print_unsigned_short_int("src2", ushort_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: ushort int first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -912,7 +1333,13 @@ int main() {
result = vec_first_mismatch_or_eos_index (ushort_src1, ushort_src2);
- if (result != expected_result)
+#ifdef DEBUG2
+ print_unsigned_short_int("src1", ushort_src1);
+ print_unsigned_short_int("src2", ushort_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
+ if (result != expected_result)
#ifdef DEBUG
printf("Error: ushort int first mismatch or EOS result (%d) does not match expected result (%d)\n",
result, expected_result);
@@ -927,6 +1354,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (ushort_src1, ushort_src2);
+#ifdef DEBUG2
+ print_unsigned_short_int("src1", ushort_src1);
+ print_unsigned_short_int("src2", ushort_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: ushort int first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -943,6 +1376,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (int_src1, int_src2);
+#ifdef DEBUG2
+ print_signed_int("src1", int_src1);
+ print_signed_int("src2", int_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: int first mismatch or EOS result (%d) does not match expected result (%d)\n",
@@ -958,6 +1397,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (int_src1, int_src2);
+#ifdef DEBUG2
+ print_signed_int("src1", int_src1);
+ print_signed_int("src2", int_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: int first mismatch result (%d) does not match expected result (%d)\n",
@@ -973,6 +1418,12 @@ int main() {
result = vec_first_mismatch_or_eos_index (int_src1, int_src2);
+#ifdef DEBUG2
+ print_signed_int("src1", int_src1);
+ print_signed_int("src2", int_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
printf("Error: int first mismatch result (%d) does not match expected result (%d)\n",
@@ -988,6 +1439,11 @@ int main() {
result = vec_first_mismatch_or_eos_index (int_src1, int_src2);
+#ifdef DEBUG2
+ print_signed_int("src1", int_src1);
+ print_signed_int("src2", int_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
if (result != expected_result)
#ifdef DEBUG
printf("Error: int first mismatch result (%d) does not match expected result (%d)\n",
@@ -1003,9 +1459,14 @@ int main() {
result = vec_first_mismatch_or_eos_index (uint_src1, uint_src2);
+#ifdef DEBUG2
+ print_unsigned_int("src1", uint_src1);
+ print_unsigned_int("src2", uint_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
if (result != expected_result)
#ifdef DEBUG
- printf("Error: uint first mismatch result (%d) does not match expected result (%d)\n",
+ printf("Error: uint first mismatch or eos index result (%d) does not match expected result (%d)\n",
result, expected_result);
#else
abort();
@@ -1018,9 +1479,15 @@ int main() {
result = vec_first_mismatch_or_eos_index (uint_src1, uint_src2);
+#ifdef DEBUG2
+ print_unsigned_int("src1", uint_src1);
+ print_unsigned_int("src2", uint_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
- printf("Error: uint first mismatch result (%d) does not match expected result (%d)\n",
+ printf("Error: uint first mismatch or eos index result (%d) does not match expected result (%d)\n",
result, expected_result);
#else
abort();
@@ -1033,9 +1500,15 @@ int main() {
result = vec_first_mismatch_or_eos_index (uint_src1, uint_src2);
+#ifdef DEBUG2
+ print_unsigned_int("src1", uint_src1);
+ print_unsigned_int("src2", uint_src2);
+ printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
+#endif
+
if (result != expected_result)
#ifdef DEBUG
- printf("Error: uint first mismatch result (%d) does not match expected result (%d)\n",
+ printf("Error: uint first mismatch or eos index result (%d) does not match expected result (%d)\n",
result, expected_result);
#else
abort();
@@ -10,5 +10,5 @@ count_leading_zero_byte_bits (vector unsigned char *arg1_p)
{
vector unsigned char arg_1 = *arg1_p;
- return __builtin_vec_vclzlsbb (arg_1); /* { dg-error "builtin function '__builtin_altivec_vclzlsbb' requires the '-mcpu=power9' option" } */
+ return __builtin_vec_vclzlsbb (arg_1); /* { dg-error "builtin function '__builtin_altivec_vclzlsbb_v16qi' requires the '-mcpu=power9' option" } */
}