aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/i386/test-i386-pcmpistri.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcg/i386/test-i386-pcmpistri.c')
-rw-r--r--tests/tcg/i386/test-i386-pcmpistri.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/tcg/i386/test-i386-pcmpistri.c b/tests/tcg/i386/test-i386-pcmpistri.c
new file mode 100644
index 0000000000..1e81ae611a
--- /dev/null
+++ b/tests/tcg/i386/test-i386-pcmpistri.c
@@ -0,0 +1,33 @@
+/* Test pcmpistri instruction. */
+
+#include <nmmintrin.h>
+#include <stdio.h>
+
+union u {
+ __m128i x;
+ unsigned char uc[16];
+};
+
+union u s0 = { .uc = { 0 } };
+union u s1 = { .uc = "abcdefghijklmnop" };
+union u s2 = { .uc = "bcdefghijklmnopa" };
+union u s3 = { .uc = "bcdefghijklmnab" };
+
+int
+main(void)
+{
+ int ret = 0;
+ if (_mm_cmpistri(s0.x, s0.x, 0x4c) != 15) {
+ printf("FAIL: pcmpistri test 1\n");
+ ret = 1;
+ }
+ if (_mm_cmpistri(s1.x, s2.x, 0x4c) != 15) {
+ printf("FAIL: pcmpistri test 2\n");
+ ret = 1;
+ }
+ if (_mm_cmpistri(s1.x, s3.x, 0x4c) != 16) {
+ printf("FAIL: pcmpistri test 3\n");
+ ret = 1;
+ }
+ return ret;
+}