From: Carl Love Date: Wed, 6 Jun 2018 23:16:06 +0000 (+0000) Subject: vsx.md (first_match_index_): Calculate index using natural element order. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=029435a303a8081960fe6c7531ecf5f65c7d88ee;p=gcc.git vsx.md (first_match_index_): Calculate index using natural element order. gcc/ChangeLog: 2018-06-04 Carl Love * gcc/config/rs6000/vsx.md (first_match_index_): Calculate index using natural element order. Use gen_lshrsi3 instead of gen_ashrsi3 as it is slightly cheaper. (first_match_or_eos_index_): Calculate index using natural element order. (first_match_index_): Calculate index using natural element order. (first_match_or_eos_index_): Calculate index using natural order. (define_insn vclzlsbb): Change to define_insn vclzlsbb_. for BE and LE modes. * gcc/config/rs6000/rs6000-c.c: Rename P9V_BUILTIN_VCLZLSBB, P9V_BUILTIN_VCLZLSBB_V16QI. * gcc/config/rs6000/rs6000-builtin.def: Make VCLZLSBB mode specific. gcc/testsuite/ChangeLog: 2018-06-04 Carl Love * gcc.target/powerpc/builtins-8-p9-runnable.c: Add additional debug print statements. Fix a few formating issues. From-SVN: r261255 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ab526f91f49..4eaaa70b1c2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2018-06-04 Carl Love + + * gcc/config/rs6000/vsx.md (first_match_index_): Calculate index + using natural element order. Use gen_lshrsi3 instead of gen_ashrsi3 + as it is slightly cheaper. + (first_match_or_eos_index_): + Calculate index using natural element order. + (first_match_index_): + Calculate index using natural element order. + (first_match_or_eos_index_): + Calculate index using natural order. + (define_insn vclzlsbb): Change to define_insn vclzlsbb_. + for BE and LE modes. + * gcc/config/rs6000/rs6000-c.c: Rename P9V_BUILTIN_VCLZLSBB, + P9V_BUILTIN_VCLZLSBB_V16QI. + * gcc/config/rs6000/rs6000-builtin.def: Make VCLZLSBB mode + specific. + 2018-06-06 Kelvin Nilsen * doc/extend.texi (PowerPC AltiVec Built-in Functions): Adjust diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def index 98702c7cf79..f799681540d 100644 --- a/gcc/config/rs6000/rs6000-builtin.def +++ b/gcc/config/rs6000/rs6000-builtin.def @@ -2214,7 +2214,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) diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index 2ef6f7b6e81..08326c27758 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -5437,9 +5437,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, diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index 58796ff66f8..0e016fe6e33 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -4723,7 +4723,8 @@ "vcmpnez. %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_" [(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)) / 2; if (mode == V16QImode) - emit_insn (gen_vctzlsbb_ (operands[0], not_result)); + { + if (!BYTES_BIG_ENDIAN) + emit_insn (gen_vctzlsbb_ (operands[0], not_result)); + else + emit_insn (gen_vclzlsbb_ (operands[0], not_result)); + } else { rtx tmp = gen_reg_rtx (SImode); - emit_insn (gen_vctzlsbb_ (tmp, not_result)); - emit_insn (gen_ashrsi3 (operands[0], tmp, GEN_INT (sh))); + if (!BYTES_BIG_ENDIAN) + emit_insn (gen_vctzlsbb_ (tmp, not_result)); + else + emit_insn (gen_vclzlsbb_ (tmp, not_result)); + emit_insn (gen_lshrsi3 (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_" [(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)) / 2; if (mode == V16QImode) - emit_insn (gen_vctzlsbb_ (operands[0], result)); + { + if (!BYTES_BIG_ENDIAN) + emit_insn (gen_vctzlsbb_ (operands[0], result)); + else + emit_insn (gen_vclzlsbb_ (operands[0], result)); + } else { rtx tmp = gen_reg_rtx (SImode); - emit_insn (gen_vctzlsbb_ (tmp, result)); - emit_insn (gen_ashrsi3 (operands[0], tmp, GEN_INT (sh))); + if (!BYTES_BIG_ENDIAN) + emit_insn (gen_vctzlsbb_ (tmp, result)); + else + emit_insn (gen_vclzlsbb_ (tmp, result)); + emit_insn (gen_lshrsi3 (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_" [(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)) / 2; if (mode == V16QImode) - emit_insn (gen_vctzlsbb_ (operands[0], cmp_result)); + { + if (!BYTES_BIG_ENDIAN) + emit_insn (gen_vctzlsbb_ (operands[0], cmp_result)); + else + emit_insn (gen_vclzlsbb_ (operands[0], cmp_result)); + } else { rtx tmp = gen_reg_rtx (SImode); - emit_insn (gen_vctzlsbb_ (tmp, cmp_result)); - emit_insn (gen_ashrsi3 (operands[0], tmp, GEN_INT (sh))); + if (!BYTES_BIG_ENDIAN) + emit_insn (gen_vctzlsbb_ (tmp, cmp_result)); + else + emit_insn (gen_vclzlsbb_ (tmp, cmp_result)); + emit_insn (gen_lshrsi3 (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_" [(match_operand:SI 0 "register_operand") (unspec: SI [(match_operand:VSX_EXTRACT_I 1 "register_operand") @@ -4856,12 +4884,20 @@ sh = GET_MODE_SIZE (GET_MODE_INNER (mode)) / 2; if (mode == V16QImode) - emit_insn (gen_vctzlsbb_ (operands[0], result)); + { + if (!BYTES_BIG_ENDIAN) + emit_insn (gen_vctzlsbb_ (operands[0], result)); + else + emit_insn (gen_vclzlsbb_ (operands[0], result)); + } else { rtx tmp = gen_reg_rtx (SImode); - emit_insn (gen_vctzlsbb_ (tmp, result)); - emit_insn (gen_ashrsi3 (operands[0], tmp, GEN_INT (sh))); + if (!BYTES_BIG_ENDIAN) + emit_insn (gen_vctzlsbb_ (tmp, result)); + else + emit_insn (gen_vclzlsbb_ (tmp, result)); + emit_insn (gen_lshrsi3 (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_" [(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" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1bb75b2e00b..db46ffc4e7c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-06-04 Carl Love + + * gcc.target/powerpc/builtins-8-p9-runnable.c: Add additional + debug print statements. Fix a few formating issues. + 2018-06-06 Michael Meissner PR target/85657 diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-8-p9-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-8-p9-runnable.c index 9ec338df16f..158de5eeea4 100644 --- a/gcc/testsuite/gcc.target/powerpc/builtins-8-p9-runnable.c +++ b/gcc/testsuite/gcc.target/powerpc/builtins-8-p9-runnable.c @@ -10,8 +10,84 @@ #include #endif +#ifdef DEBUG2 +#include +#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();