summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann <ssp@redhat.com>2013-12-25 16:32:47 -0500
committerSøren Sandmann <ssp@redhat.com>2013-12-25 16:32:47 -0500
commit3acd04133a2234f53a874c0171a2b033f46c7bd8 (patch)
tree4455e7038156700145598ef819c61d7e1e1f5b13
parent5819bba6146cf99ffd69ec060691f115388758a3 (diff)
UIMM
-rw-r--r--simplex86.h7
-rw-r--r--testsuite.c13
2 files changed, 20 insertions, 0 deletions
diff --git a/simplex86.h b/simplex86.h
index 98b2ff6..2fdec0d 100644
--- a/simplex86.h
+++ b/simplex86.h
@@ -239,6 +239,13 @@ typedef enum
((v) >= -32768 && (v) < 32768)? OP_I16 : \
OP_I32))
+#define UIMM(v) \
+ ((((int64_t)(ssize_t)(v)) << 6) | \
+ (((v) == 1)? IMM (1) : \
+ ((v) >= 0 && (v) < 256)? IMM ((int8_t)v) : \
+ ((v) >= 0 && (v) < 65536)? IMM ((int16_t)v) : \
+ IMM (v)))
+
#define IMM64(v) \
IMM ((((int64_t)(ssize_t)(v)) >> 32)), IMM ((int32_t)(ssize_t)(v))
diff --git a/testsuite.c b/testsuite.c
index 0aece9e..7eba0f8 100644
--- a/testsuite.c
+++ b/testsuite.c
@@ -202,6 +202,18 @@ test_crc32 (assembler_t *as)
}
static uint8_t *
+test_pshuflw (assembler_t *as)
+{
+ fragment_t *frag = fragment_new (as);
+
+ BEGIN_ASM (frag)
+ I_pshuflw, xmm2, xmm2, UIMM (0xff),
+ END_ASM ();
+
+ return assembler_link (as, frag, NULL);
+}
+
+static uint8_t *
test_riprel (assembler_t *as)
{
fragment_t *frag = fragment_new (as);
@@ -464,6 +476,7 @@ main ()
success &= run_test (as, "test_misc", test_misc, 0x483565c1);
success &= run_test (as, "test_riprel", test_riprel, 0xf5497642);
success &= run_test (as, "test_movdq", test_movdq, 0xf6f727a6);
+ success &= run_test (as, "test_pshuflw", test_pshuflw, 0x7a8c7f59);
if (success)
printf ("Test suite PASSED\n");