summaryrefslogtreecommitdiffstats
path: root/tests/tcg/s390x/mie3-sel.c
diff options
context:
space:
mode:
authorDavid Miller2022-02-23 23:31:16 +0100
committerThomas Huth2022-02-28 11:29:15 +0100
commite2c3fb069994858fea9aca9a4e64fa5afd34021a (patch)
treefcb834de3f1c6992e315c8ab99d27add543c8eda /tests/tcg/s390x/mie3-sel.c
parents390x/cpumodel: Bump up QEMU model to a stripped-down IBM z15 GA1 (diff)
downloadqemu-e2c3fb069994858fea9aca9a4e64fa5afd34021a.tar.gz
qemu-e2c3fb069994858fea9aca9a4e64fa5afd34021a.tar.xz
qemu-e2c3fb069994858fea9aca9a4e64fa5afd34021a.zip
tests/tcg/s390x: Tests for Miscellaneous-Instruction-Extensions Facility 3
tests/tcg/s390x/mie3-compl.c: [N]*K instructions tests/tcg/s390x/mie3-mvcrl.c: MVCRL instruction tests/tcg/s390x/mie3-sel.c: SELECT instruction Signed-off-by: David Miller <dmiller423@gmail.com> Message-Id: <20220223223117.66660-4-dmiller423@gmail.com> [thuth: Squash mnemonic -> .insn patch, white space cleanup, improve asm usage] Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/tcg/s390x/mie3-sel.c')
-rw-r--r--tests/tcg/s390x/mie3-sel.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/tcg/s390x/mie3-sel.c b/tests/tcg/s390x/mie3-sel.c
new file mode 100644
index 0000000000..b0c5c9857d
--- /dev/null
+++ b/tests/tcg/s390x/mie3-sel.c
@@ -0,0 +1,38 @@
+#include <stdint.h>
+
+#define Fi3(S, ASM) uint64_t S(uint64_t a, uint64_t b, uint64_t c) \
+{ \
+ uint64_t res = 0; \
+ asm ( \
+ "lg %%r2, %[a]\n" \
+ "lg %%r3, %[b]\n" \
+ "lg %%r0, %[c]\n" \
+ "ltgr %%r0, %%r0\n" \
+ ASM \
+ "stg %%r0, %[res] " \
+ : [res] "=m" (res) \
+ : [a] "m" (a), \
+ [b] "m" (b), \
+ [c] "m" (c) \
+ : "r0", "r2", \
+ "r3", "r4" \
+ ); \
+ return res; \
+}
+
+Fi3 (_selre, ".insn rrf, 0xB9F00000, %%r0, %%r3, %%r2, 8\n")
+Fi3 (_selgrz, ".insn rrf, 0xB9E30000, %%r0, %%r3, %%r2, 8\n")
+Fi3 (_selfhrnz, ".insn rrf, 0xB9C00000, %%r0, %%r3, %%r2, 7\n")
+
+int main(int argc, char *argv[])
+{
+ uint64_t a = ~0, b = ~0, c = ~0;
+ a = _selre(0x066600000066ull, 0x066600000006ull, a);
+ b = _selgrz(0xF00D00000005ull, 0xF00D00000055ull, b);
+ c = _selfhrnz(0x043200000044ull, 0x065400000004ull, c);
+
+ return (int) (
+ (0xFFFFFFFF00000066ull != a) ||
+ (0x0000F00D00000005ull != b) ||
+ (0x00000654FFFFFFFFull != c));
+}