Add testcases for cu12. Update opcode table.
Part of fixing #289839.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12820 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/docs/internals/s390-opcodes.csv b/docs/internals/s390-opcodes.csv
index 8f2deb8..51a58ee 100644
--- a/docs/internals/s390-opcodes.csv
+++ b/docs/internals/s390-opcodes.csv
@@ -663,7 +663,7 @@
 cu21,"convert utf-16 to utf-8",implemented
 cu42,"convert utf-32 to utf-16",implemented
 cu41,"convert utf-32 to utf-8","not implemented","open bugzilla"
-cu12,"convert utf-8 to utf-16","not implemented","open bugzilla"
+cu12,"convert utf-8 to utf-16",implemented
 cu14,"convert utf-8 to utf-32","not implemented","open bugzilla"
 srstu,"search string unicode","not implemented",
 trtr,"tranlate and test reverse","not implemented",
diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am
index e4c7319..912a7be 100644
--- a/none/tests/s390x/Makefile.am
+++ b/none/tests/s390x/Makefile.am
@@ -7,7 +7,7 @@
              and_EI or_EI xor_EI insert_EI mul_GE add_GE condloadstore \
              op_exception fgx stck stckf stcke stfle cksm mvcl clcl troo \
              trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \
-             cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42
+             cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1
 
 check_PROGRAMS = $(INSN_TESTS) \
 		 allexec \
@@ -30,8 +30,9 @@
 AM_CCASFLAGS += @FLAG_M64@
 
 allexec_CFLAGS   = $(AM_CFLAGS) @FLAG_W_NO_NONNULL@
-
-ex_clone_LDFLAGS = -lpthread
 tcxb_CFLAGS      = $(AM_CFLAGS) -std=gnu99
+cu12_1_CFLAGS    = $(AM_CFLAGS) -DM3=1
 cu21_1_CFLAGS    = $(AM_CFLAGS) -DM3=1
 cu24_1_CFLAGS    = $(AM_CFLAGS) -DM3=1
+
+ex_clone_LDFLAGS = -lpthread
diff --git a/none/tests/s390x/cu12.c b/none/tests/s390x/cu12.c
new file mode 100644
index 0000000..8badb2a
--- /dev/null
+++ b/none/tests/s390x/cu12.c
@@ -0,0 +1,594 @@
+#include <stdint.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "opcodes.h"
+
+#ifndef M3
+#define M3 0
+#endif
+
+/* The abstracted result of an CU12 insn */
+typedef struct {
+   uint64_t addr1;  // target
+   uint64_t len1;
+   uint64_t addr2;  // source
+   uint64_t len2;
+   uint32_t cc;
+} cu12_t;
+
+/* Define various input buffers. */
+
+/* 1-byte UTF-8 character */
+uint8_t pattern1[] = {
+   0x00, 0x01, 0x02, 0x03
+};
+
+/* 2-byte UTF-8 character */
+uint8_t pattern2[] = {
+   0xc2, 0x80,
+   0xc2, 0x81,
+   0xc2, 0x82,
+   0xc2, 0x83,
+};
+
+/* 3-byte UTF-8 character */
+uint8_t pattern3[] = {
+   0xe1, 0x80, 0x80,
+   0xe1, 0x80, 0x81,
+   0xe1, 0x80, 0x82,
+   0xe1, 0x80, 0x83,
+};
+
+/* 4-byte UTF-8 character */
+uint8_t pattern4[] = {
+   0xf4, 0x80, 0x80, 0x80,
+   0xf4, 0x80, 0x80, 0x81,
+   0xf4, 0x80, 0x80, 0x82,
+   0xf4, 0x80, 0x80, 0x83,
+};
+
+
+/* Mixed bytes */
+uint8_t mixed[] = {
+   0x01,                    // 1 byte
+   0xc3, 0x80,              // 2 bytes
+   0x12,                    // 1 byte
+   0xe1, 0x90, 0x93,        // 3 bytes
+   0x23,                    // 1 byte
+   0xf4, 0x80, 0x90, 0x8a,  // 4 bytes
+   0x34,                    // 1 byte
+   0xc4, 0x8c,              // 2 bytes
+   0xe1, 0x91, 0x94,        // 3 bytes
+   0xc5, 0x8a,              // 2 bytes
+   0xf4, 0x80, 0x90, 0x8a,  // 4 bytes
+   0xc5, 0x8a,              // 2 bytes
+   0xe1, 0x91, 0x94,        // 3 bytes
+   0xf4, 0x80, 0x90, 0x8a,  // 4 bytes
+   0xe1, 0x91, 0x94,        // 3 bytes
+};
+
+/* This is the buffer for the converted bytes. */
+uint16_t buff[1000];  /* Large so we con'don't have to worry about it */
+
+
+static cu12_t
+do_cu12(uint16_t *dst, uint64_t dst_len, uint8_t *src, uint64_t src_len)
+{
+   int cc = 42;
+   cu12_t regs;
+
+   /* build up the register pairs */
+   register uint8_t  *source     asm("4") = src;
+   register uint64_t  source_len asm("5") = src_len;
+   register uint16_t *dest       asm("2") = dst;
+   register uint64_t  dest_len   asm("3") = dst_len;
+
+   asm volatile(
+                CU12(M3,2,4)
+                "ipm %2\n\t"
+                "srl %2,28\n\t"
+                : "+d"(dest), "+d"(source), "=d"(cc),
+                  "+d"(source_len), "+d"(dest_len)
+                :
+                : "memory", "cc");
+
+   /* Capture register contents at end of cu12 */
+   regs.addr1 = (uint64_t)dest;
+   regs.len1  = dest_len;
+   regs.addr2 = (uint64_t)source;
+   regs.len2  = source_len;
+   regs.cc = cc;
+   
+   return regs;
+}
+
+void
+run_test(uint16_t *dst, uint64_t dst_len, uint8_t *src, uint64_t src_len)
+{
+   int i;
+   cu12_t result;
+
+   printf("UTF8:  ");
+   if (src_len == 0) 
+      printf(" <none>");
+   else {
+      for(i = 0; i < src_len; ++i)
+         printf(" %02x", src[i]);
+   }
+   printf("\n");
+      
+   result = do_cu12(dst, dst_len, src, src_len);
+
+   // Write out the converted byte, if any
+   printf("UTF16: ");
+   if (dst_len - result.len1 == 0)
+      printf(" <none>");
+   else {
+      uint64_t num_bytes = dst_len - result.len1;
+
+      /* The number of bytes that were written must be divisible by 2 */
+      if (num_bytes % 2 != 0)
+         fprintf(stderr, "*** number of bytes is not a multiple of 2\n");
+
+      for (i = 0; i < num_bytes / 2; i++) {
+         printf(" %04x", dst[i]);
+      }
+   }
+   printf("\n");
+
+   printf("  cc = %d\n", result.cc);
+   if (dst != NULL)
+      printf("  dst address difference: %"PRId64, result.addr1 - (uint64_t)dst);
+   printf("  dst len: %"PRId64"\n", result.len1);
+
+   if (src != NULL)
+      printf("  src address difference: %"PRId64, result.addr2 - (uint64_t)src);
+   printf("  src len: %"PRId64"\n", result.len2);
+}
+
+// Test conversion of a one-byte character
+void convert_1_byte(void)
+{
+   int i;
+
+   printf("===== Conversion of a one-byte character =====\n");
+
+   printf("\n----- Valid characters -----\n");
+   uint8_t valid[] = { 
+      0x00, 0x7f,              // corner cases
+      0x01, 0x10, 0x7e, 0x5d   // misc 
+   };
+   run_test(buff, sizeof buff, valid, sizeof valid);
+
+   // As conversion stops upon encountering an invalid character, we
+   // need to test each invalid character separately, to make sure it
+   // is recognized as invalid.
+   
+   printf("\n----- Invalid characters -----\n");
+   uint8_t always_invalid[] = {
+      0x80, 0xbf,              // corner cases
+      0xf8, 0xff,              // corner cases
+      0x81, 0xbe, 0x95, 0xab   // misc
+   };
+   for (i = 0; i < sizeof always_invalid; ++i) {
+      uint8_t invalid_char[1];
+      invalid_char[0] = always_invalid[i];
+      run_test(buff, sizeof buff, invalid_char, sizeof invalid_char);
+   }
+
+   // In case of m3 == 0 we get cc=0 indicating exhaustion of source
+   printf("\n----- Invalid characters if m3 == 1 -----\n");
+   uint8_t invalid_if_m3[] = {  // contains all such invalid characters
+      0xc0, 0xc1,
+      0xf5, 0xf6, 0xf7
+   };
+   for (i = 0; i < sizeof invalid_if_m3; ++i) {
+      uint8_t invalid_char[1];
+      invalid_char[0] = invalid_if_m3[i];
+      run_test(buff, sizeof buff, invalid_char, sizeof invalid_char);
+   }
+
+   printf("\n----- 1st char valid, 2nd char invalid -----\n");
+   uint8_t valid_invalid[] = {
+      0x10, // valid
+      0xaa  // invalid
+   };
+   run_test(buff, sizeof buff, valid_invalid, sizeof valid_invalid);
+}
+
+// Test conversion of a two-byte character
+void convert_2_bytes(void)
+{
+   int i;
+
+   printf("\n===== Conversion of a two-byte character =====\n");
+
+   printf("\n----- Valid characters -----\n");
+   uint8_t valid[] = { 
+      0xc2, 0x80,             // corner case
+      0xc2, 0xbf,             // corner case
+      0xdf, 0x80,             // corner case
+      0xdf, 0xbf,             // corner case
+      0xc3, 0xbe, 0xda, 0xbc  // misc 
+   };
+   run_test(buff, sizeof buff, valid, sizeof valid);
+
+   printf("\n----- Valid characters if m3 == 0 -----\n");
+   // First char is 0xc0 or 0xc1
+   uint8_t valid_if_not_m3[] = {
+      0xc0, 0x80,
+      0xc0, 0xbf,
+      0xc1, 0x80,
+      0xc0, 0xbf
+   };
+   run_test(buff, sizeof buff, valid_if_not_m3, sizeof valid_if_not_m3);
+
+   // Test for invalid two-byte characters where the 1st byte is valid
+   // The 2nd byte is invalid if not in range 0x80..0xbf, inclusive
+
+   // As conversion stops upon encountering an invalid character, we
+   // need to test each invalid character separately, to make sure it
+   // is recognized as invalid.
+   
+   printf("\n----- Invalid characters if m3 == 1 -----\n");
+   uint8_t always_invalid[] = {
+      0xc2, 0x00,
+      0xc2, 0x7f,
+      0xc2, 0xc0,
+      0xc2, 0xff
+   };
+   for (i = 0; i < sizeof always_invalid; i += 2) {
+      uint8_t invalid_char[2];
+      invalid_char[0] = always_invalid[i];
+      invalid_char[1] = always_invalid[i+1];
+      run_test(buff, sizeof buff, invalid_char, sizeof invalid_char);
+   }
+
+   /* Nb: for a two-byte character we need not test the case where 
+      invalidity of the character (cc=2) takes precedence over exhaustion
+      of the 1st operand (cc=1). Invalidity of the character has already
+      been tested when testing the 1st byte. */
+
+   printf("\n----- 1st char valid, 2nd char invalid -----\n");
+   uint8_t valid_invalid[] = {
+      0xc3, 0x81, // valid
+      0xc4, 0x00  // invalid
+   };
+   run_test(buff, sizeof buff, valid_invalid, sizeof valid_invalid);
+}
+
+// Test conversion of a three-byte character
+void
+convert_3_bytes(void)
+{
+   int i;
+
+   printf("\n===== Conversion of a three-byte character =====\n");
+
+   /* Exhaustively test the 1st byte E0 - EF, and the interval boundaries for
+      the 2nd and 3rd bytes */
+   printf("\n----- Valid characters -----\n");
+   uint8_t e0[] = { 
+      0xe0, 0xa0, 0x80,
+      0xe0, 0xbf, 0x80,
+      0xe0, 0xa0, 0xbf,
+      0xe0, 0xbf, 0xbf,
+      0xe0, 0xaa, 0xbb,   // random  e0 .. ..
+   };
+   run_test(buff, sizeof buff, e0, sizeof e0);
+
+   uint8_t ed[] = { 
+      0xed, 0x80, 0x80,
+      0xed, 0x9f, 0x80,
+      0xed, 0x80, 0xbf,
+      0xed, 0x9f, 0xbf,
+      0xed, 0x8a, 0xbb,   // random  ed .. ..
+   };
+   run_test(buff, sizeof buff, ed, sizeof ed);
+
+   for (i = 0; i <= 0xf; ++i) {
+      uint8_t exxx_1[3] = { 0x0, 0x80, 0x80 };
+      uint8_t exxx_2[3] = { 0x0, 0xbf, 0x80 };
+      uint8_t exxx_3[3] = { 0x0, 0x80, 0xbf };
+      uint8_t exxx_4[3] = { 0x0, 0xbf, 0xbf };
+
+      if (i == 0x00) continue;   // special case e0
+      if (i == 0x0d) continue;   // special case ed
+
+      exxx_1[0] = 0xe0 | i;
+      exxx_2[0] = 0xe0 | i;
+      exxx_3[0] = 0xe0 | i;
+      exxx_4[0] = 0xe0 | i;
+      run_test(buff, sizeof buff, exxx_1, sizeof exxx_1);
+      run_test(buff, sizeof buff, exxx_2, sizeof exxx_2);
+      run_test(buff, sizeof buff, exxx_3, sizeof exxx_3);
+      run_test(buff, sizeof buff, exxx_4, sizeof exxx_4);
+   };
+
+   printf("\n----- Invalid characters (2nd byte is invalid) -----\n");
+   // Test for invalid three-byte characters where the 1st byte is valid
+   // The 2nd byte is invalid.
+
+   // As conversion stops upon encountering an invalid character, we
+   // need to test each invalid character separately, to make sure it
+   // is recognized as invalid.
+
+   e0[0] = 0xe0;  // valid
+   e0[1] = 0x9f;  // invalid  because outside [0xa0 .. 0xbf]
+   e0[2] = 0x80;  // valid
+   run_test(buff, sizeof buff, e0, sizeof e0);
+   e0[1] = 0xc0;  // invalid  because outside [0xa0 .. 0xbf]
+   run_test(buff, sizeof buff, e0, sizeof e0);
+
+   ed[0] = 0xed;  // valid
+   ed[1] = 0x7f;  // invalid  because outside [0x80 .. 0x9f]
+   ed[2] = 0x80;  // valid
+   run_test(buff, sizeof buff, ed, sizeof ed);
+   ed[1] = 0xa0;  // invalid  because outside [0x80 .. 0x9f]
+   run_test(buff, sizeof buff, ed, sizeof ed);
+
+   for (i = 0; i <= 0xf; ++i) {
+      uint8_t exxx_1[3] = { 0x0, 0x7f, 0x80 };
+      uint8_t exxx_2[3] = { 0x0, 0xc0, 0x80 };
+
+      if (i == 0x00) continue;   // special case e0
+      if (i == 0x0d) continue;   // special case ed
+
+      exxx_1[0] = 0xe0 | i;
+      exxx_2[0] = 0xe0 | i;
+      run_test(buff, sizeof buff, exxx_1, sizeof exxx_1);
+      run_test(buff, sizeof buff, exxx_2, sizeof exxx_2);
+   };
+
+   printf("\n----- Invalid characters (3rd byte is invalid) -----\n");
+   // For all 1st bytes 0xe0 .. 0xef the 3rd bytes must be in [0x80 .. 0xbf]
+   // No need to special case 0xe0 and 0xed
+   for (i = 0; i <= 0xf; ++i) {
+      uint8_t exxx_1[3] = { 0x0, 0xab, 0x7f };
+      uint8_t exxx_2[3] = { 0x0, 0xab, 0xc0 };
+
+      exxx_1[0] = 0xe0 | i;
+      exxx_2[0] = 0xe0 | i;
+      run_test(buff, sizeof buff, exxx_1, sizeof exxx_1);
+      run_test(buff, sizeof buff, exxx_2, sizeof exxx_2);
+   };
+
+   printf("\n----- Invalid 2nd char AND output exhausted -----\n");
+   /* The character is invalid in its 2nd byte AND the output buffer is 
+      exhausted (2 bytes are needed) */
+   uint8_t pat1[] = {
+      0xe0, 0x00, 0x80
+   };
+   run_test(buff, 1, pat1, 3);
+
+   printf("\n----- Invalid 3rd char AND output exhausted -----\n");
+   /* The character is invalid in its 3rd byte AND the output buffer is 
+      exhausted (2 bytes are needed) */
+   uint8_t pat2[] = {
+      0xe4, 0x84, 0x00
+   };
+   run_test(buff, 1, pat2, 3);
+
+   printf("\n----- 1st char valid, 2nd char invalid -----\n");
+   uint8_t valid_invalid[] = {
+      0xe1, 0x90, 0x90, // valid
+      0xe1, 0x00, 0x90  // invalid
+   };
+   run_test(buff, sizeof buff, valid_invalid, sizeof valid_invalid);
+}
+
+// Test conversion of a four-byte character
+void
+convert_4_bytes(void)
+{
+   int i, j;
+
+   printf("\n===== Conversion of a four-byte character =====\n");
+
+   printf("\n----- Valid characters -----\n");
+   for (i = 0; i <= 4; ++i) {
+      uint8_t valid[4];
+
+      valid[0] = 0xf0 | i;
+
+      for (j = 0; j <= 1; ++j) {
+         // Byte 2
+         if (i == 0) {
+            valid[1] = j == 0 ? 0x90 : 0xbf;    // 0xf0
+         } else if (i == 4) {
+            valid[1] = j == 0 ? 0x80 : 0x8f;    // 0xf4
+         } else {
+            valid[1] = j == 0 ? 0x80 : 0xbf;    // 0xf1 .. 0xf3
+         }
+         // Byte 3 and byte 4 have same interval 0x80 .. 0xbf
+         valid[2] = 0x80;
+         valid[3] = 0x80;
+         run_test(buff, sizeof buff, valid, sizeof valid);
+         valid[2] = 0x80;
+         valid[3] = 0xbf;
+         run_test(buff, sizeof buff, valid, sizeof valid);
+         valid[2] = 0xbf;
+         valid[3] = 0x80;
+         run_test(buff, sizeof buff, valid, sizeof valid);
+         valid[2] = 0xbf;
+         valid[3] = 0xbf;
+         run_test(buff, sizeof buff, valid, sizeof valid);
+      }
+   }
+
+   printf("\n----- Valid characters if m3 == 0 -----\n");
+   // First char is 0xf5 .. 0xf7
+   uint8_t valid_if_not_m3[] = {
+      0xf5, 0x00, 0x00, 0x00,
+      0xf6, 0x11, 0x22, 0x33,
+      0xf7, 0x44, 0x55, 0x66,
+   };
+   run_test(buff, sizeof buff, valid_if_not_m3, sizeof valid_if_not_m3);
+
+   // As conversion stops upon encountering an invalid character, we
+   // need to test each invalid character separately, to make sure it
+   // is recognized as invalid.
+
+   printf("\n----- Invalid characters (2nd byte is invalid) -----\n");
+   // Test for invalid four-byte characters where the 2nd byte is invalid.
+   // All other bytes are valid
+   uint8_t f0[4], f4[4];
+
+   f0[0] = 0xf0;  // valid
+   f0[1] = 0x8f;  // invalid  because outside [0x90 .. 0xbf]
+   f0[2] = 0x80;  // valid
+   f0[3] = 0x80;  // valid
+   run_test(buff, sizeof buff, f0, sizeof f0);
+   f0[1] = 0xc0;  // invalid  because outside [0x90 .. 0xbf]
+   run_test(buff, sizeof buff, f0, sizeof f0);
+
+   f4[0] = 0xed;  // valid
+   f4[1] = 0x7f;  // invalid  because outside [0x80 .. 0x8f]
+   f4[2] = 0x80;  // valid
+   run_test(buff, sizeof buff, f4, sizeof f4);
+   f4[1] = 0x90;  // invalid  because outside [0x80 .. 0x9f]
+   run_test(buff, sizeof buff, f4, sizeof f4);
+
+   for (i = 0; i <= 0x4; ++i) {
+      uint8_t fxxx_1[4] = { 0x0, 0x7f, 0x80, 0x80 };
+      uint8_t fxxx_2[4] = { 0x0, 0xc0, 0x80, 0x80 };
+
+      if (i == 0) continue;   // special case f0
+      if (i == 4) continue;   // special case f4
+
+      fxxx_1[0] = 0xf0 | i;
+      fxxx_2[0] = 0xf0 | i;
+      run_test(buff, sizeof buff, fxxx_1, sizeof fxxx_1);
+      run_test(buff, sizeof buff, fxxx_2, sizeof fxxx_2);
+   };
+
+   printf("\n----- Invalid characters (3rd byte is invalid) -----\n");
+   // Test for invalid four-byte characters where the 3rd byte is invalid.
+   // All other bytes are valid
+   for (i = 0; i <= 0x4; ++i) {
+      uint8_t fxxx[4] = { 0x0, 0x0, 0x0, 0x80 };
+
+      fxxx[0] = 0xf0 | i;
+      fxxx[1] = (i == 0) ? 0x94 : 0x84;
+      fxxx[2] = 0x7f;
+      run_test(buff, sizeof buff, fxxx, sizeof fxxx);
+      fxxx[2] = 0xc0;
+      run_test(buff, sizeof buff, fxxx, sizeof fxxx);
+   };
+
+   printf("\n----- Invalid characters (4th byte is invalid) -----\n");
+   // Test for invalid four-byte characters where the 3rd byte is invalid.
+   // All other bytes are valid
+   for (i = 0; i <= 0x4; ++i) {
+      uint8_t fxxx[4] = { 0x0, 0x0, 0x80, 0x0 };
+
+      fxxx[0] = 0xf0 | i;
+      fxxx[1] = (i == 0) ? 0x94 : 0x84;
+      fxxx[3] = 0x7f;
+      run_test(buff, sizeof buff, fxxx, sizeof fxxx);
+      fxxx[3] = 0xc0;
+      run_test(buff, sizeof buff, fxxx, sizeof fxxx);
+   };
+
+   printf("\n----- Invalid 2nd char AND output exhausted -----\n");
+   /* The character is invalid in its 2nd byte AND the output buffer is 
+      exhausted (4 bytes are needed) */
+   uint8_t pat1[] = {
+      0xf0, 0x00, 0x80, 0x80
+   };
+   run_test(buff, 1, pat1, 4);
+
+   printf("\n----- Invalid 3rd char AND output exhausted -----\n");
+   /* The character is invalid in its 3rd byte AND the output buffer is 
+      exhausted (4 bytes are needed) */
+   uint8_t pat2[] = {
+      0xf0, 0xaa, 0x00, 0x80
+   };
+   run_test(buff, 3, pat2, 4);
+
+   printf("\n----- Invalid 4th char AND output exhausted -----\n");
+   /* The character is invalid in its 4th byte AND the output buffer is 
+      exhausted (4 bytes are needed) */
+   uint8_t pat3[] = {
+      0xf0, 0xaa, 0xaa, 0x00
+   };
+   run_test(buff, 3, pat3, 4);
+
+   printf("\n----- 1st char valid, 2nd char invalid -----\n");
+   uint8_t valid_invalid[] = {
+      0xf0, 0xaa, 0xaa, 0xaa, // valid
+      0xf0, 0x00, 0x00, 0x00  // invalid
+   };
+   run_test(buff, sizeof buff, valid_invalid, sizeof valid_invalid);
+}
+
+
+int main()
+{
+   convert_1_byte();
+   convert_2_bytes();
+   convert_3_bytes();
+   convert_4_bytes();
+
+   /* Length == 0, no memory should be read or written */
+   printf("\n------------- test1 ----------------\n");
+   run_test(NULL, 0, NULL, 0);
+
+   /* Test exhaustion of source length (source bytes are valid) */
+   printf("\n------------- test2.1 ----------------\n");
+
+   /* No character will be written to BUFF, i.e. loop in jitted code
+      is not iterated */
+   run_test(buff, sizeof buff, NULL,     0);
+   run_test(buff, sizeof buff, pattern1, 0);
+   run_test(buff, sizeof buff, pattern2, 0);
+   run_test(buff, sizeof buff, pattern2, 1);
+   run_test(buff, sizeof buff, pattern3, 0);
+   run_test(buff, sizeof buff, pattern3, 1);
+   run_test(buff, sizeof buff, pattern3, 2);
+   run_test(buff, sizeof buff, pattern4, 0);
+   run_test(buff, sizeof buff, pattern4, 1);
+   run_test(buff, sizeof buff, pattern4, 2);
+   run_test(buff, sizeof buff, pattern4, 3);
+
+   printf("\n------------- test2.2 ----------------\n");
+   /* At least one character will be written to BUFF, i.e. loop in jitted
+      code is iterated */
+   run_test(buff, sizeof buff, pattern1, 2);
+   run_test(buff, sizeof buff, pattern2, 5);
+   run_test(buff, sizeof buff, pattern3, 6);
+   run_test(buff, sizeof buff, pattern4, 9);
+
+   /* Test exhaustion of destination length (source bytes are valid) */
+   printf("\n------------- test3.1 ----------------\n");
+
+   /* No character will be written to BUFF, i.e. loop in jitted code
+      is not iterated */
+
+   /* Want to write 2 or 4 bytes at a time */
+   run_test(NULL, 0, pattern1, sizeof pattern1);  // 2-byte result
+   run_test(NULL, 0, pattern2, sizeof pattern2);  // 2-byte result
+   run_test(NULL, 1, pattern2, sizeof pattern2);  // 2-byte result
+   run_test(NULL, 0, pattern3, sizeof pattern3);  // 2-byte result
+   run_test(NULL, 1, pattern3, sizeof pattern3);  // 2-byte result
+   run_test(NULL, 0, pattern4, sizeof pattern4);  // 4-byte result
+   run_test(NULL, 1, pattern4, sizeof pattern4);  // 4-byte result
+   run_test(NULL, 2, pattern4, sizeof pattern4);  // 4-byte result
+   run_test(NULL, 3, pattern4, sizeof pattern4);  // 4-byte result
+
+   printf("\n------------- test3.2 ----------------\n");
+   /* At least one character will be written to BUFF, i.e. loop in jitted
+      code is iterated */
+   run_test(buff, 4, pattern1, sizeof pattern1);
+   run_test(buff, 5, pattern1, sizeof pattern2);
+   run_test(buff, 6, pattern1, sizeof pattern3);
+   run_test(buff, 7, pattern1, sizeof pattern4);
+
+   /* Convert buffer with mixed characters */
+   printf("\n------------- test4 ----------------\n");
+   run_test(buff, sizeof buff, mixed, sizeof mixed);
+
+   return 0;
+}
diff --git a/none/tests/s390x/cu12.stderr.exp b/none/tests/s390x/cu12.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/s390x/cu12.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/cu12.stdout.exp b/none/tests/s390x/cu12.stdout.exp
new file mode 100644
index 0000000..0f570b7
--- /dev/null
+++ b/none/tests/s390x/cu12.stdout.exp
@@ -0,0 +1,1325 @@
+===== Conversion of a one-byte character =====
+
+----- Valid characters -----
+UTF8:   00 7f 01 10 7e 5d
+UTF16:  0000 007f 0001 0010 007e 005d
+  cc = 0
+  dst address difference: 12  dst len: 1988
+  src address difference: 6  src len: 0
+
+----- Invalid characters -----
+UTF8:   80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   bf
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   f8
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   ff
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   81
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   be
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   95
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   ab
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+
+----- Invalid characters if m3 == 1 -----
+UTF8:   c0
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   c1
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   f5
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   f6
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   f7
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+
+----- 1st char valid, 2nd char invalid -----
+UTF8:   10 aa
+UTF16:  0010
+  cc = 2
+  dst address difference: 2  dst len: 1998
+  src address difference: 1  src len: 1
+
+===== Conversion of a two-byte character =====
+
+----- Valid characters -----
+UTF8:   c2 80 c2 bf df 80 df bf c3 be da bc
+UTF16:  0080 00bf 07c0 07ff 00fe 06bc
+  cc = 0
+  dst address difference: 12  dst len: 1988
+  src address difference: 12  src len: 0
+
+----- Valid characters if m3 == 0 -----
+UTF8:   c0 80 c0 bf c1 80 c0 bf
+UTF16:  0000 003f 0040 003f
+  cc = 0
+  dst address difference: 8  dst len: 1992
+  src address difference: 8  src len: 0
+
+----- Invalid characters if m3 == 1 -----
+UTF8:   c2 00
+UTF16:  0080
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 2  src len: 0
+UTF8:   c2 7f
+UTF16:  00bf
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 2  src len: 0
+UTF8:   c2 c0
+UTF16:  0080
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 2  src len: 0
+UTF8:   c2 ff
+UTF16:  00bf
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 2  src len: 0
+
+----- 1st char valid, 2nd char invalid -----
+UTF8:   c3 81 c4 00
+UTF16:  00c1 0100
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+
+===== Conversion of a three-byte character =====
+
+----- Valid characters -----
+UTF8:   e0 a0 80 e0 bf 80 e0 a0 bf e0 bf bf e0 aa bb
+UTF16:  0800 0fc0 083f 0fff 0abb
+  cc = 0
+  dst address difference: 10  dst len: 1990
+  src address difference: 15  src len: 0
+UTF8:   ed 80 80 ed 9f 80 ed 80 bf ed 9f bf ed 8a bb
+UTF16:  d000 d7c0 d03f d7ff d2bb
+  cc = 0
+  dst address difference: 10  dst len: 1990
+  src address difference: 15  src len: 0
+UTF8:   e1 80 80
+UTF16:  1000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e1 bf 80
+UTF16:  1fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e1 80 bf
+UTF16:  103f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e1 bf bf
+UTF16:  1fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e2 80 80
+UTF16:  2000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e2 bf 80
+UTF16:  2fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e2 80 bf
+UTF16:  203f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e2 bf bf
+UTF16:  2fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e3 80 80
+UTF16:  3000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e3 bf 80
+UTF16:  3fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e3 80 bf
+UTF16:  303f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e3 bf bf
+UTF16:  3fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e4 80 80
+UTF16:  4000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e4 bf 80
+UTF16:  4fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e4 80 bf
+UTF16:  403f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e4 bf bf
+UTF16:  4fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e5 80 80
+UTF16:  5000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e5 bf 80
+UTF16:  5fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e5 80 bf
+UTF16:  503f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e5 bf bf
+UTF16:  5fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e6 80 80
+UTF16:  6000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e6 bf 80
+UTF16:  6fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e6 80 bf
+UTF16:  603f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e6 bf bf
+UTF16:  6fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e7 80 80
+UTF16:  7000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e7 bf 80
+UTF16:  7fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e7 80 bf
+UTF16:  703f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e7 bf bf
+UTF16:  7fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e8 80 80
+UTF16:  8000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e8 bf 80
+UTF16:  8fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e8 80 bf
+UTF16:  803f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e8 bf bf
+UTF16:  8fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e9 80 80
+UTF16:  9000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e9 bf 80
+UTF16:  9fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e9 80 bf
+UTF16:  903f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e9 bf bf
+UTF16:  9fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ea 80 80
+UTF16:  a000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ea bf 80
+UTF16:  afc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ea 80 bf
+UTF16:  a03f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ea bf bf
+UTF16:  afff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   eb 80 80
+UTF16:  b000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   eb bf 80
+UTF16:  bfc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   eb 80 bf
+UTF16:  b03f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   eb bf bf
+UTF16:  bfff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ec 80 80
+UTF16:  c000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ec bf 80
+UTF16:  cfc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ec 80 bf
+UTF16:  c03f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ec bf bf
+UTF16:  cfff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ee 80 80
+UTF16:  e000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ee bf 80
+UTF16:  efc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ee 80 bf
+UTF16:  e03f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ee bf bf
+UTF16:  efff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ef 80 80
+UTF16:  f000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ef bf 80
+UTF16:  ffc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ef 80 bf
+UTF16:  f03f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ef bf bf
+UTF16:  ffff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+
+----- Invalid characters (2nd byte is invalid) -----
+UTF8:   e0 9f 80 e0 bf 80 e0 a0 bf e0 bf bf e0 aa bb
+UTF16:  07c0 0fc0 083f 0fff 0abb
+  cc = 0
+  dst address difference: 10  dst len: 1990
+  src address difference: 15  src len: 0
+UTF8:   e0 c0 80 e0 bf 80 e0 a0 bf e0 bf bf e0 aa bb
+UTF16:  0000 0fc0 083f 0fff 0abb
+  cc = 0
+  dst address difference: 10  dst len: 1990
+  src address difference: 15  src len: 0
+UTF8:   ed 7f 80 ed 9f 80 ed 80 bf ed 9f bf ed 8a bb
+UTF16:  dfc0 d7c0 d03f d7ff d2bb
+  cc = 0
+  dst address difference: 10  dst len: 1990
+  src address difference: 15  src len: 0
+UTF8:   ed a0 80 ed 9f 80 ed 80 bf ed 9f bf ed 8a bb
+UTF16:  d800 d7c0 d03f d7ff d2bb
+  cc = 0
+  dst address difference: 10  dst len: 1990
+  src address difference: 15  src len: 0
+UTF8:   e1 7f 80
+UTF16:  1fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e1 c0 80
+UTF16:  1000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e2 7f 80
+UTF16:  2fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e2 c0 80
+UTF16:  2000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e3 7f 80
+UTF16:  3fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e3 c0 80
+UTF16:  3000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e4 7f 80
+UTF16:  4fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e4 c0 80
+UTF16:  4000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e5 7f 80
+UTF16:  5fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e5 c0 80
+UTF16:  5000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e6 7f 80
+UTF16:  6fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e6 c0 80
+UTF16:  6000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e7 7f 80
+UTF16:  7fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e7 c0 80
+UTF16:  7000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e8 7f 80
+UTF16:  8fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e8 c0 80
+UTF16:  8000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e9 7f 80
+UTF16:  9fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e9 c0 80
+UTF16:  9000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ea 7f 80
+UTF16:  afc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ea c0 80
+UTF16:  a000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   eb 7f 80
+UTF16:  bfc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   eb c0 80
+UTF16:  b000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ec 7f 80
+UTF16:  cfc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ec c0 80
+UTF16:  c000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ee 7f 80
+UTF16:  efc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ee c0 80
+UTF16:  e000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ef 7f 80
+UTF16:  ffc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ef c0 80
+UTF16:  f000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+
+----- Invalid characters (3rd byte is invalid) -----
+UTF8:   e0 ab 7f
+UTF16:  0aff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e0 ab c0
+UTF16:  0ac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e1 ab 7f
+UTF16:  1aff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e1 ab c0
+UTF16:  1ac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e2 ab 7f
+UTF16:  2aff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e2 ab c0
+UTF16:  2ac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e3 ab 7f
+UTF16:  3aff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e3 ab c0
+UTF16:  3ac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e4 ab 7f
+UTF16:  4aff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e4 ab c0
+UTF16:  4ac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e5 ab 7f
+UTF16:  5aff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e5 ab c0
+UTF16:  5ac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e6 ab 7f
+UTF16:  6aff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e6 ab c0
+UTF16:  6ac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e7 ab 7f
+UTF16:  7aff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e7 ab c0
+UTF16:  7ac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e8 ab 7f
+UTF16:  8aff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e8 ab c0
+UTF16:  8ac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e9 ab 7f
+UTF16:  9aff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e9 ab c0
+UTF16:  9ac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ea ab 7f
+UTF16:  aaff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ea ab c0
+UTF16:  aac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   eb ab 7f
+UTF16:  baff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   eb ab c0
+UTF16:  bac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ec ab 7f
+UTF16:  caff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ec ab c0
+UTF16:  cac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ed ab 7f
+UTF16:  daff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ed ab c0
+UTF16:  dac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ee ab 7f
+UTF16:  eaff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ee ab c0
+UTF16:  eac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ef ab 7f
+UTF16:  faff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ef ab c0
+UTF16:  fac0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+
+----- Invalid 2nd char AND output exhausted -----
+UTF8:   e0 00 80
+UTF16:  <none>
+  cc = 1
+  dst address difference: 0  dst len: 1
+  src address difference: 0  src len: 3
+
+----- Invalid 3rd char AND output exhausted -----
+UTF8:   e4 84 00
+UTF16:  <none>
+  cc = 1
+  dst address difference: 0  dst len: 1
+  src address difference: 0  src len: 3
+
+----- 1st char valid, 2nd char invalid -----
+UTF8:   e1 90 90 e1 00 90
+UTF16:  1410 1010
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 6  src len: 0
+
+===== Conversion of a four-byte character =====
+
+----- Valid characters -----
+UTF8:   f0 90 80 80
+UTF16:  d800 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 90 80 bf
+UTF16:  d800 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 90 bf 80
+UTF16:  d803 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 90 bf bf
+UTF16:  d803 dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 bf 80 80
+UTF16:  d8bc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 bf 80 bf
+UTF16:  d8bc dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 bf bf 80
+UTF16:  d8bf dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 bf bf bf
+UTF16:  d8bf dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 80 80 80
+UTF16:  d8c0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 80 80 bf
+UTF16:  d8c0 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 80 bf 80
+UTF16:  d8c3 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 80 bf bf
+UTF16:  d8c3 dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 bf 80 80
+UTF16:  d9bc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 bf 80 bf
+UTF16:  d9bc dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 bf bf 80
+UTF16:  d9bf dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 bf bf bf
+UTF16:  d9bf dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 80 80 80
+UTF16:  d9c0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 80 80 bf
+UTF16:  d9c0 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 80 bf 80
+UTF16:  d9c3 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 80 bf bf
+UTF16:  d9c3 dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 bf 80 80
+UTF16:  dabc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 bf 80 bf
+UTF16:  dabc dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 bf bf 80
+UTF16:  dabf dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 bf bf bf
+UTF16:  dabf dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 80 80 80
+UTF16:  dac0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 80 80 bf
+UTF16:  dac0 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 80 bf 80
+UTF16:  dac3 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 80 bf bf
+UTF16:  dac3 dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 bf 80 80
+UTF16:  dbbc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 bf 80 bf
+UTF16:  dbbc dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 bf bf 80
+UTF16:  dbbf dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 bf bf bf
+UTF16:  dbbf dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 80 80 80
+UTF16:  dbc0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 80 80 bf
+UTF16:  dbc0 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 80 bf 80
+UTF16:  dbc3 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 80 bf bf
+UTF16:  dbc3 dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 8f 80 80
+UTF16:  dbfc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 8f 80 bf
+UTF16:  dbfc dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 8f bf 80
+UTF16:  dbff dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 8f bf bf
+UTF16:  dbff dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+
+----- Valid characters if m3 == 0 -----
+UTF8:   f5 00 00 00 f6 11 22 33 f7 44 55 66
+UTF16:  d8c0 dc00 da06 dcb3 dad1 dd66
+  cc = 0
+  dst address difference: 12  dst len: 1988
+  src address difference: 12  src len: 0
+
+----- Invalid characters (2nd byte is invalid) -----
+UTF8:   f0 8f 80 80
+UTF16:  dbfc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 c0 80 80
+UTF16:  dbc0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   ed 7f 80 00
+UTF16:  dfc0 0000
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   ed 90 80 00
+UTF16:  d400 0000
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 7f 80 80
+UTF16:  d9bc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 c0 80 80
+UTF16:  d8c0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 7f 80 80
+UTF16:  dabc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 c0 80 80
+UTF16:  d9c0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 7f 80 80
+UTF16:  dbbc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 c0 80 80
+UTF16:  dac0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+
+----- Invalid characters (3rd byte is invalid) -----
+UTF8:   f0 94 7f 80
+UTF16:  d813 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 94 c0 80
+UTF16:  d810 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 84 7f 80
+UTF16:  d8d3 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 84 c0 80
+UTF16:  d8d0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 84 7f 80
+UTF16:  d9d3 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 84 c0 80
+UTF16:  d9d0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 84 7f 80
+UTF16:  dad3 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 84 c0 80
+UTF16:  dad0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 84 7f 80
+UTF16:  dbd3 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 84 c0 80
+UTF16:  dbd0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+
+----- Invalid characters (4th byte is invalid) -----
+UTF8:   f0 94 80 7f
+UTF16:  d810 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 94 80 c0
+UTF16:  d810 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 84 80 7f
+UTF16:  d8d0 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 84 80 c0
+UTF16:  d8d0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 84 80 7f
+UTF16:  d9d0 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 84 80 c0
+UTF16:  d9d0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 84 80 7f
+UTF16:  dad0 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 84 80 c0
+UTF16:  dad0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 84 80 7f
+UTF16:  dbd0 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 84 80 c0
+UTF16:  dbd0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+
+----- Invalid 2nd char AND output exhausted -----
+UTF8:   f0 00 80 80
+UTF16:  <none>
+  cc = 1
+  dst address difference: 0  dst len: 1
+  src address difference: 0  src len: 4
+
+----- Invalid 3rd char AND output exhausted -----
+UTF8:   f0 aa 00 80
+UTF16:  <none>
+  cc = 1
+  dst address difference: 0  dst len: 3
+  src address difference: 0  src len: 4
+
+----- Invalid 4th char AND output exhausted -----
+UTF8:   f0 aa aa 00
+UTF16:  <none>
+  cc = 1
+  dst address difference: 0  dst len: 3
+  src address difference: 0  src len: 4
+
+----- 1st char valid, 2nd char invalid -----
+UTF8:   f0 aa aa aa f0 00 00 00
+UTF16:  d86a deaa dbc0 dc00
+  cc = 0
+  dst address difference: 8  dst len: 1992
+  src address difference: 8  src len: 0
+
+------------- test1 ----------------
+UTF8:   <none>
+UTF16:  <none>
+  cc = 0
+  dst len: 0
+  src len: 0
+
+------------- test2.1 ----------------
+UTF8:   <none>
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src len: 0
+UTF8:   <none>
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 0
+UTF8:   <none>
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 0
+UTF8:   c2
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   <none>
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 0
+UTF8:   e1
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   e1 80
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 2
+UTF8:   <none>
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 0
+UTF8:   f4
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   f4 80
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 2
+UTF8:   f4 80 80
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+
+------------- test2.2 ----------------
+UTF8:   00 01
+UTF16:  0000 0001
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 2  src len: 0
+UTF8:   c2 80 c2 81 c2
+UTF16:  0080 0081
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 1
+UTF8:   e1 80 80 e1 80 81
+UTF16:  1000 1001
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 6  src len: 0
+UTF8:   f4 80 80 80 f4 80 80 81 f4
+UTF16:  dbc0 dc00 dbc0 dc01
+  cc = 0
+  dst address difference: 8  dst len: 1992
+  src address difference: 8  src len: 1
+
+------------- test3.1 ----------------
+UTF8:   00 01 02 03
+UTF16:  <none>
+  cc = 1
+  dst len: 0
+  src address difference: 0  src len: 4
+UTF8:   c2 80 c2 81 c2 82 c2 83
+UTF16:  <none>
+  cc = 1
+  dst len: 0
+  src address difference: 0  src len: 8
+UTF8:   c2 80 c2 81 c2 82 c2 83
+UTF16:  <none>
+  cc = 1
+  dst len: 1
+  src address difference: 0  src len: 8
+UTF8:   e1 80 80 e1 80 81 e1 80 82 e1 80 83
+UTF16:  <none>
+  cc = 1
+  dst len: 0
+  src address difference: 0  src len: 12
+UTF8:   e1 80 80 e1 80 81 e1 80 82 e1 80 83
+UTF16:  <none>
+  cc = 1
+  dst len: 1
+  src address difference: 0  src len: 12
+UTF8:   f4 80 80 80 f4 80 80 81 f4 80 80 82 f4 80 80 83
+UTF16:  <none>
+  cc = 1
+  dst len: 0
+  src address difference: 0  src len: 16
+UTF8:   f4 80 80 80 f4 80 80 81 f4 80 80 82 f4 80 80 83
+UTF16:  <none>
+  cc = 1
+  dst len: 1
+  src address difference: 0  src len: 16
+UTF8:   f4 80 80 80 f4 80 80 81 f4 80 80 82 f4 80 80 83
+UTF16:  <none>
+  cc = 1
+  dst len: 2
+  src address difference: 0  src len: 16
+UTF8:   f4 80 80 80 f4 80 80 81 f4 80 80 82 f4 80 80 83
+UTF16:  <none>
+  cc = 1
+  dst len: 3
+  src address difference: 0  src len: 16
+
+------------- test3.2 ----------------
+UTF8:   00 01 02 03
+UTF16:  0000 0001
+  cc = 1
+  dst address difference: 4  dst len: 0
+  src address difference: 2  src len: 2
+UTF8:   00 01 02 03 c2 80 c2 81
+UTF16:  0000 0001
+  cc = 1
+  dst address difference: 4  dst len: 1
+  src address difference: 2  src len: 6
+UTF8:   00 01 02 03 c2 80 c2 81 c2 82 c2 83
+UTF16:  0000 0001 0002
+  cc = 1
+  dst address difference: 6  dst len: 0
+  src address difference: 3  src len: 9
+UTF8:   00 01 02 03 c2 80 c2 81 c2 82 c2 83 e1 80 80 e1
+UTF16:  0000 0001 0002
+  cc = 1
+  dst address difference: 6  dst len: 1
+  src address difference: 3  src len: 13
+
+------------- test4 ----------------
+UTF8:   01 c3 80 12 e1 90 93 23 f4 80 90 8a 34 c4 8c e1 91 94 c5 8a f4 80 90 8a c5 8a e1 91 94 f4 80 90 8a e1 91 94
+UTF16:  0001 00c0 0012 1413 0023 dbc1 dc0a 0034 010c 1454 014a dbc1 dc0a 014a 1454 dbc1 dc0a 1454
+  cc = 0
+  dst address difference: 36  dst len: 1964
+  src address difference: 36  src len: 0
diff --git a/none/tests/s390x/cu12.vgtest b/none/tests/s390x/cu12.vgtest
new file mode 100644
index 0000000..cdf8071
--- /dev/null
+++ b/none/tests/s390x/cu12.vgtest
@@ -0,0 +1 @@
+prog: cu12
diff --git a/none/tests/s390x/cu12_1.c b/none/tests/s390x/cu12_1.c
new file mode 120000
index 0000000..a331548
--- /dev/null
+++ b/none/tests/s390x/cu12_1.c
@@ -0,0 +1 @@
+cu12.c
\ No newline at end of file
diff --git a/none/tests/s390x/cu12_1.stderr.exp b/none/tests/s390x/cu12_1.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/s390x/cu12_1.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/cu12_1.stdout.exp b/none/tests/s390x/cu12_1.stdout.exp
new file mode 100644
index 0000000..4142326
--- /dev/null
+++ b/none/tests/s390x/cu12_1.stdout.exp
@@ -0,0 +1,1325 @@
+===== Conversion of a one-byte character =====
+
+----- Valid characters -----
+UTF8:   00 7f 01 10 7e 5d
+UTF16:  0000 007f 0001 0010 007e 005d
+  cc = 0
+  dst address difference: 12  dst len: 1988
+  src address difference: 6  src len: 0
+
+----- Invalid characters -----
+UTF8:   80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   bf
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   f8
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   ff
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   81
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   be
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   95
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   ab
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+
+----- Invalid characters if m3 == 1 -----
+UTF8:   c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   c1
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   f5
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   f6
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   f7
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+
+----- 1st char valid, 2nd char invalid -----
+UTF8:   10 aa
+UTF16:  0010
+  cc = 2
+  dst address difference: 2  dst len: 1998
+  src address difference: 1  src len: 1
+
+===== Conversion of a two-byte character =====
+
+----- Valid characters -----
+UTF8:   c2 80 c2 bf df 80 df bf c3 be da bc
+UTF16:  0080 00bf 07c0 07ff 00fe 06bc
+  cc = 0
+  dst address difference: 12  dst len: 1988
+  src address difference: 12  src len: 0
+
+----- Valid characters if m3 == 0 -----
+UTF8:   c0 80 c0 bf c1 80 c0 bf
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 8
+
+----- Invalid characters if m3 == 1 -----
+UTF8:   c2 00
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 2
+UTF8:   c2 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 2
+UTF8:   c2 c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 2
+UTF8:   c2 ff
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 2
+
+----- 1st char valid, 2nd char invalid -----
+UTF8:   c3 81 c4 00
+UTF16:  00c1
+  cc = 2
+  dst address difference: 2  dst len: 1998
+  src address difference: 2  src len: 2
+
+===== Conversion of a three-byte character =====
+
+----- Valid characters -----
+UTF8:   e0 a0 80 e0 bf 80 e0 a0 bf e0 bf bf e0 aa bb
+UTF16:  0800 0fc0 083f 0fff 0abb
+  cc = 0
+  dst address difference: 10  dst len: 1990
+  src address difference: 15  src len: 0
+UTF8:   ed 80 80 ed 9f 80 ed 80 bf ed 9f bf ed 8a bb
+UTF16:  d000 d7c0 d03f d7ff d2bb
+  cc = 0
+  dst address difference: 10  dst len: 1990
+  src address difference: 15  src len: 0
+UTF8:   e1 80 80
+UTF16:  1000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e1 bf 80
+UTF16:  1fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e1 80 bf
+UTF16:  103f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e1 bf bf
+UTF16:  1fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e2 80 80
+UTF16:  2000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e2 bf 80
+UTF16:  2fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e2 80 bf
+UTF16:  203f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e2 bf bf
+UTF16:  2fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e3 80 80
+UTF16:  3000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e3 bf 80
+UTF16:  3fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e3 80 bf
+UTF16:  303f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e3 bf bf
+UTF16:  3fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e4 80 80
+UTF16:  4000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e4 bf 80
+UTF16:  4fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e4 80 bf
+UTF16:  403f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e4 bf bf
+UTF16:  4fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e5 80 80
+UTF16:  5000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e5 bf 80
+UTF16:  5fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e5 80 bf
+UTF16:  503f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e5 bf bf
+UTF16:  5fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e6 80 80
+UTF16:  6000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e6 bf 80
+UTF16:  6fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e6 80 bf
+UTF16:  603f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e6 bf bf
+UTF16:  6fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e7 80 80
+UTF16:  7000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e7 bf 80
+UTF16:  7fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e7 80 bf
+UTF16:  703f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e7 bf bf
+UTF16:  7fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e8 80 80
+UTF16:  8000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e8 bf 80
+UTF16:  8fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e8 80 bf
+UTF16:  803f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e8 bf bf
+UTF16:  8fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e9 80 80
+UTF16:  9000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e9 bf 80
+UTF16:  9fc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e9 80 bf
+UTF16:  903f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   e9 bf bf
+UTF16:  9fff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ea 80 80
+UTF16:  a000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ea bf 80
+UTF16:  afc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ea 80 bf
+UTF16:  a03f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ea bf bf
+UTF16:  afff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   eb 80 80
+UTF16:  b000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   eb bf 80
+UTF16:  bfc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   eb 80 bf
+UTF16:  b03f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   eb bf bf
+UTF16:  bfff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ec 80 80
+UTF16:  c000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ec bf 80
+UTF16:  cfc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ec 80 bf
+UTF16:  c03f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ec bf bf
+UTF16:  cfff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ee 80 80
+UTF16:  e000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ee bf 80
+UTF16:  efc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ee 80 bf
+UTF16:  e03f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ee bf bf
+UTF16:  efff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ef 80 80
+UTF16:  f000
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ef bf 80
+UTF16:  ffc0
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ef 80 bf
+UTF16:  f03f
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+UTF8:   ef bf bf
+UTF16:  ffff
+  cc = 0
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 0
+
+----- Invalid characters (2nd byte is invalid) -----
+UTF8:   e0 9f 80 e0 bf 80 e0 a0 bf e0 bf bf e0 aa bb
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 15
+UTF8:   e0 c0 80 e0 bf 80 e0 a0 bf e0 bf bf e0 aa bb
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 15
+UTF8:   ed 7f 80 ed 9f 80 ed 80 bf ed 9f bf ed 8a bb
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 15
+UTF8:   ed a0 80 ed 9f 80 ed 80 bf ed 9f bf ed 8a bb
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 15
+UTF8:   e1 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e1 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e2 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e2 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e3 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e3 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e4 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e4 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e5 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e5 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e6 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e6 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e7 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e7 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e8 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e8 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e9 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e9 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ea 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ea c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   eb 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   eb c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ec 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ec c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ee 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ee c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ef 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ef c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+
+----- Invalid characters (3rd byte is invalid) -----
+UTF8:   e0 ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e0 ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e1 ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e1 ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e2 ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e2 ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e3 ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e3 ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e4 ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e4 ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e5 ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e5 ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e6 ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e6 ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e7 ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e7 ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e8 ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e8 ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e9 ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   e9 ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ea ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ea ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   eb ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   eb ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ec ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ec ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ed ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ed ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ee ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ee ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ef ab 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+UTF8:   ef ab c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+
+----- Invalid 2nd char AND output exhausted -----
+UTF8:   e0 00 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 1
+  src address difference: 0  src len: 3
+
+----- Invalid 3rd char AND output exhausted -----
+UTF8:   e4 84 00
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 1
+  src address difference: 0  src len: 3
+
+----- 1st char valid, 2nd char invalid -----
+UTF8:   e1 90 90 e1 00 90
+UTF16:  1410
+  cc = 2
+  dst address difference: 2  dst len: 1998
+  src address difference: 3  src len: 3
+
+===== Conversion of a four-byte character =====
+
+----- Valid characters -----
+UTF8:   f0 90 80 80
+UTF16:  d800 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 90 80 bf
+UTF16:  d800 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 90 bf 80
+UTF16:  d803 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 90 bf bf
+UTF16:  d803 dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 bf 80 80
+UTF16:  d8bc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 bf 80 bf
+UTF16:  d8bc dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 bf bf 80
+UTF16:  d8bf dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f0 bf bf bf
+UTF16:  d8bf dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 80 80 80
+UTF16:  d8c0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 80 80 bf
+UTF16:  d8c0 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 80 bf 80
+UTF16:  d8c3 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 80 bf bf
+UTF16:  d8c3 dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 bf 80 80
+UTF16:  d9bc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 bf 80 bf
+UTF16:  d9bc dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 bf bf 80
+UTF16:  d9bf dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 bf bf bf
+UTF16:  d9bf dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 80 80 80
+UTF16:  d9c0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 80 80 bf
+UTF16:  d9c0 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 80 bf 80
+UTF16:  d9c3 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 80 bf bf
+UTF16:  d9c3 dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 bf 80 80
+UTF16:  dabc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 bf 80 bf
+UTF16:  dabc dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 bf bf 80
+UTF16:  dabf dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f2 bf bf bf
+UTF16:  dabf dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 80 80 80
+UTF16:  dac0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 80 80 bf
+UTF16:  dac0 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 80 bf 80
+UTF16:  dac3 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 80 bf bf
+UTF16:  dac3 dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 bf 80 80
+UTF16:  dbbc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 bf 80 bf
+UTF16:  dbbc dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 bf bf 80
+UTF16:  dbbf dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f3 bf bf bf
+UTF16:  dbbf dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 80 80 80
+UTF16:  dbc0 dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 80 80 bf
+UTF16:  dbc0 dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 80 bf 80
+UTF16:  dbc3 dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 80 bf bf
+UTF16:  dbc3 dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 8f 80 80
+UTF16:  dbfc dc00
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 8f 80 bf
+UTF16:  dbfc dc3f
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 8f bf 80
+UTF16:  dbff dfc0
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f4 8f bf bf
+UTF16:  dbff dfff
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+
+----- Valid characters if m3 == 0 -----
+UTF8:   f5 00 00 00 f6 11 22 33 f7 44 55 66
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 12
+
+----- Invalid characters (2nd byte is invalid) -----
+UTF8:   f0 8f 80 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f0 c0 80 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   ed 7f 80 00
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   ed 90 80 00
+UTF16:  d400 0000
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 0
+UTF8:   f1 7f 80 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f1 c0 80 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f2 7f 80 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f2 c0 80 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f3 7f 80 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f3 c0 80 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+
+----- Invalid characters (3rd byte is invalid) -----
+UTF8:   f0 94 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f0 94 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f1 84 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f1 84 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f2 84 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f2 84 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f3 84 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f3 84 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f4 84 7f 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f4 84 c0 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+
+----- Invalid characters (4th byte is invalid) -----
+UTF8:   f0 94 80 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f0 94 80 c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f1 84 80 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f1 84 80 c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f2 84 80 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f2 84 80 c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f3 84 80 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f3 84 80 c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f4 84 80 7f
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+UTF8:   f4 84 80 c0
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 4
+
+----- Invalid 2nd char AND output exhausted -----
+UTF8:   f0 00 80 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 1
+  src address difference: 0  src len: 4
+
+----- Invalid 3rd char AND output exhausted -----
+UTF8:   f0 aa 00 80
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 3
+  src address difference: 0  src len: 4
+
+----- Invalid 4th char AND output exhausted -----
+UTF8:   f0 aa aa 00
+UTF16:  <none>
+  cc = 2
+  dst address difference: 0  dst len: 3
+  src address difference: 0  src len: 4
+
+----- 1st char valid, 2nd char invalid -----
+UTF8:   f0 aa aa aa f0 00 00 00
+UTF16:  d86a deaa
+  cc = 2
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 4
+
+------------- test1 ----------------
+UTF8:   <none>
+UTF16:  <none>
+  cc = 0
+  dst len: 0
+  src len: 0
+
+------------- test2.1 ----------------
+UTF8:   <none>
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src len: 0
+UTF8:   <none>
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 0
+UTF8:   <none>
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 0
+UTF8:   c2
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   <none>
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 0
+UTF8:   e1
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   e1 80
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 2
+UTF8:   <none>
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 0
+UTF8:   f4
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 1
+UTF8:   f4 80
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 2
+UTF8:   f4 80 80
+UTF16:  <none>
+  cc = 0
+  dst address difference: 0  dst len: 2000
+  src address difference: 0  src len: 3
+
+------------- test2.2 ----------------
+UTF8:   00 01
+UTF16:  0000 0001
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 2  src len: 0
+UTF8:   c2 80 c2 81 c2
+UTF16:  0080 0081
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 4  src len: 1
+UTF8:   e1 80 80 e1 80 81
+UTF16:  1000 1001
+  cc = 0
+  dst address difference: 4  dst len: 1996
+  src address difference: 6  src len: 0
+UTF8:   f4 80 80 80 f4 80 80 81 f4
+UTF16:  dbc0 dc00 dbc0 dc01
+  cc = 0
+  dst address difference: 8  dst len: 1992
+  src address difference: 8  src len: 1
+
+------------- test3.1 ----------------
+UTF8:   00 01 02 03
+UTF16:  <none>
+  cc = 1
+  dst len: 0
+  src address difference: 0  src len: 4
+UTF8:   c2 80 c2 81 c2 82 c2 83
+UTF16:  <none>
+  cc = 1
+  dst len: 0
+  src address difference: 0  src len: 8
+UTF8:   c2 80 c2 81 c2 82 c2 83
+UTF16:  <none>
+  cc = 1
+  dst len: 1
+  src address difference: 0  src len: 8
+UTF8:   e1 80 80 e1 80 81 e1 80 82 e1 80 83
+UTF16:  <none>
+  cc = 1
+  dst len: 0
+  src address difference: 0  src len: 12
+UTF8:   e1 80 80 e1 80 81 e1 80 82 e1 80 83
+UTF16:  <none>
+  cc = 1
+  dst len: 1
+  src address difference: 0  src len: 12
+UTF8:   f4 80 80 80 f4 80 80 81 f4 80 80 82 f4 80 80 83
+UTF16:  <none>
+  cc = 1
+  dst len: 0
+  src address difference: 0  src len: 16
+UTF8:   f4 80 80 80 f4 80 80 81 f4 80 80 82 f4 80 80 83
+UTF16:  <none>
+  cc = 1
+  dst len: 1
+  src address difference: 0  src len: 16
+UTF8:   f4 80 80 80 f4 80 80 81 f4 80 80 82 f4 80 80 83
+UTF16:  <none>
+  cc = 1
+  dst len: 2
+  src address difference: 0  src len: 16
+UTF8:   f4 80 80 80 f4 80 80 81 f4 80 80 82 f4 80 80 83
+UTF16:  <none>
+  cc = 1
+  dst len: 3
+  src address difference: 0  src len: 16
+
+------------- test3.2 ----------------
+UTF8:   00 01 02 03
+UTF16:  0000 0001
+  cc = 1
+  dst address difference: 4  dst len: 0
+  src address difference: 2  src len: 2
+UTF8:   00 01 02 03 c2 80 c2 81
+UTF16:  0000 0001
+  cc = 1
+  dst address difference: 4  dst len: 1
+  src address difference: 2  src len: 6
+UTF8:   00 01 02 03 c2 80 c2 81 c2 82 c2 83
+UTF16:  0000 0001 0002
+  cc = 1
+  dst address difference: 6  dst len: 0
+  src address difference: 3  src len: 9
+UTF8:   00 01 02 03 c2 80 c2 81 c2 82 c2 83 e1 80 80 e1
+UTF16:  0000 0001 0002
+  cc = 1
+  dst address difference: 6  dst len: 1
+  src address difference: 3  src len: 13
+
+------------- test4 ----------------
+UTF8:   01 c3 80 12 e1 90 93 23 f4 80 90 8a 34 c4 8c e1 91 94 c5 8a f4 80 90 8a c5 8a e1 91 94 f4 80 90 8a e1 91 94
+UTF16:  0001 00c0 0012 1413 0023 dbc1 dc0a 0034 010c 1454 014a dbc1 dc0a 014a 1454 dbc1 dc0a 1454
+  cc = 0
+  dst address difference: 36  dst len: 1964
+  src address difference: 36  src len: 0
diff --git a/none/tests/s390x/cu12_1.vgtest b/none/tests/s390x/cu12_1.vgtest
new file mode 100644
index 0000000..6b224d3
--- /dev/null
+++ b/none/tests/s390x/cu12_1.vgtest
@@ -0,0 +1 @@
+prog: cu12_1