On 15/03/2023 00.34, Ilya Leoshkevich wrote:
Add a small test for RXSBG with T=1 to prevent regressions.
Signed-off-by: Ilya Leoshkevich <i...@linux.ibm.com>
---
tests/tcg/s390x/Makefile.target | 1 +
tests/tcg/s390x/rxsbg.c | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+)
create mode 100644 tests/tcg/s390x/rxsbg.c
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index cf93b966862..b4d0d704534 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -29,6 +29,7 @@ TESTS+=clst
TESTS+=long-double
TESTS+=cdsg
TESTS+=chrl
+TESTS+=rxsbg
cdsg: CFLAGS+=-pthread
cdsg: LDFLAGS+=-pthread
diff --git a/tests/tcg/s390x/rxsbg.c b/tests/tcg/s390x/rxsbg.c
new file mode 100644
index 00000000000..b7f35411899
--- /dev/null
+++ b/tests/tcg/s390x/rxsbg.c
@@ -0,0 +1,25 @@
+/*
+ * Smoke test RXSBG instruction with T=1.
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <assert.h>
+#include <stdlib.h>
+
+int main(void)
+{
+ unsigned long r1, r2, cc;
+
+ r1 = 0xc8dc86a225a77bb4;
+ r2 = 0xd6aff24fa3e7320;
+ cc = 0;
+ asm("rxsbg %[r1],%[r2],177,43,228\n"
+ "ipm %[cc]"
+ : [cc] "+r" (cc)
+ : [r1] "r" (r1)
+ , [r2] "r" (r2)
+ : "cc");
+ cc = (cc >> 28) & 1;
+ assert(cc == 1);
+
+ return EXIT_SUCCESS;
+}
This also fails with Clang 15:
tests/tcg/s390x/rxsbg.c:15:9: error: invalid operand for instruction
asm("rxsbg %[r1],%[r2],177,43,228\n"
^
<inline asm>:1:23: note: instantiated into assembly here
rxsbg %r1,%r2,177,43,228
^
Thomas