|
From: <sv...@va...> - 2012-12-02 20:58:53
|
florian 2012-12-02 20:58:45 +0000 (Sun, 02 Dec 2012)
New Revision: 13146
Log:
Add testcase for LAA insn.
Patch by Divya Vyas (div...@li...).
Part of fixing BZ #306035.
Added files:
trunk/none/tests/s390x/laa.c
trunk/none/tests/s390x/laa.stderr.exp
trunk/none/tests/s390x/laa.stdout.exp
trunk/none/tests/s390x/laa.vgtest
Modified directories:
trunk/none/tests/s390x/
Modified files:
trunk/none/tests/s390x/Makefile.am
Modified: trunk/none/tests/s390x/
Added: trunk/none/tests/s390x/laa.c (+59 -0)
===================================================================
--- trunk/none/tests/s390x/laa.c 2012-12-02 03:37:36 +00:00 (rev 13145)
+++ trunk/none/tests/s390x/laa.c 2012-12-02 20:58:45 +00:00 (rev 13146)
@@ -0,0 +1,59 @@
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+void
+test(int32_t op1_init, int32_t op2_init, int32_t op3_init, int expected_cc)
+{
+ register int32_t op1 asm("8") = op1_init;
+ register int32_t op3 asm("9") = op3_init;
+
+ int32_t op2 = op2_init;
+ int cc = 1 - expected_cc;
+
+ printf("before op1 = %#x\n", op1);
+ printf("before op2 = %#x\n", op2);
+ printf("before op3 = %#x\n", op3);
+
+ __asm__ volatile (
+ ".insn rsy,0xEB00000000f8, 8,9,%1\n\t"
+ "ipm %0\n\t"
+ "srl %0,28\n\t"
+ : "=d" (cc), "+Q" (op2), "+d"(op1), "+d"(op3)
+ :
+ : "cc");
+
+ printf("after op1 = %#x\n", op1);
+ printf("after op2 = %#x\n", op2);
+ printf("after op3 = %#x\n", op3);
+ printf("cc = %d\n", cc);
+
+ if (cc != expected_cc) {
+ printf("condition code is incorrect\n");
+ }
+ if (expected_cc == 0 && op2 != 0) {
+ printf("cc = 0, but result != 0\n");
+ }
+ if (expected_cc == 1 && op2 >= 0) {
+ printf("cc = 1, but result >= 0\n");
+ }
+ if (expected_cc == 2 && op2 <= 0) {
+ printf("cc = 2, but result <= 0\n");
+ }
+ /* the test for cc = 3 is left as an exercise for the reader. */
+}
+
+int main ()
+{
+ test(0, 0, 0, 0);
+ test(-1, -1, -1, 1);
+ test(0x10000000, 0x10000000, 0x12345678, 2);
+ test(0x10000000, 0x20000000, 0x12345678, 2);
+
+ test(-1, 3, -3, 0);
+ test(0, -1, -1, 1);
+ test(-1, 0x10000000, 0x12345678, 2);
+ test(0x10000000, 0x7fffffff, 1, 3);
+
+ return 0;
+}
Property changed: trunk/none/tests/s390x (+0 -0)
___________________________________________________________________
Name: svn:ignore
- .deps
add
add_EI
add_GE
allexec
and
and_EI
clc
clcle
cvb
cvd
div
ex_clone
ex_sig
flogr
icm
insert
insert_EI
lam_stam
lpr
Makefile
Makefile.in
mul
mul_GE
mvst
or
or_EI
srst
sub
sub_EI
tcxb
xc
xor
xor_EI
stck
stcke
stckf
op_exception
fgx
condloadstore
fold_And16
stfle
op00
cksm
clcl
mvcl
troo
trot
trto
trtt
tr
tre
clrj
clgrj
crj
cgrj
clij
clgij
cij
cgij
cs
csg
cds
cdsg
cu21
cu21_1
cu24
cu24_1
cu42
cu12
cu12_1
cu14
cu14_1
cu41
ecag
fpext
fpext_warn
fpconv
rounding-1
rounding-2
rounding-3
rounding-4
rounding-5
bfp-1
bfp-2
bfp-3
bfp-4
srnm
srnmb
comp-1
comp-2
ex
exrl
tm
tmll
stmg
test_sig
test_clone
test_fork
clst
mvc
spechelper-algr
spechelper-tmll
spechelper-icm-1
spechelper-icm-2
spechelper-cr
spechelper-ltr
spechelper-alr
spechelper-clr
spechelper-slr
spechelper-slgr
spechelper-or
spechelper-tm
rounding-6
+ .deps
add
add_EI
add_GE
allexec
and
and_EI
clc
clcle
cvb
cvd
div
ex_clone
ex_sig
flogr
icm
insert
insert_EI
lam_stam
lpr
Makefile
Makefile.in
mul
mul_GE
mvst
or
or_EI
srst
sub
sub_EI
tcxb
xc
xor
xor_EI
stck
stcke
stckf
op_exception
fgx
condloadstore
fold_And16
stfle
op00
cksm
clcl
mvcl
troo
trot
trto
trtt
tr
tre
clrj
clgrj
crj
cgrj
clij
clgij
cij
cgij
cs
csg
cds
cdsg
cu21
cu21_1
cu24
cu24_1
cu42
cu12
cu12_1
cu14
cu14_1
cu41
ecag
fpext
fpext_warn
fpconv
rounding-1
rounding-2
rounding-3
rounding-4
rounding-5
bfp-1
bfp-2
bfp-3
bfp-4
srnm
srnmb
comp-1
comp-2
ex
exrl
tm
tmll
stmg
test_sig
test_clone
test_fork
clst
mvc
spechelper-algr
spechelper-tmll
spechelper-icm-1
spechelper-icm-2
spechelper-cr
spechelper-ltr
spechelper-alr
spechelper-clr
spechelper-slr
spechelper-slgr
spechelper-or
spechelper-tm
rounding-6
laa
Added: trunk/none/tests/s390x/laa.vgtest (+1 -0)
===================================================================
--- trunk/none/tests/s390x/laa.vgtest 2012-12-02 03:37:36 +00:00 (rev 13145)
+++ trunk/none/tests/s390x/laa.vgtest 2012-12-02 20:58:45 +00:00 (rev 13146)
@@ -0,0 +1 @@
+prog: laa
Modified: trunk/none/tests/s390x/Makefile.am (+1 -1)
===================================================================
--- trunk/none/tests/s390x/Makefile.am 2012-12-02 03:37:36 +00:00 (rev 13145)
+++ trunk/none/tests/s390x/Makefile.am 2012-12-02 20:58:45 +00:00 (rev 13146)
@@ -17,7 +17,7 @@
spechelper-cr spechelper-clr \
spechelper-ltr spechelper-or \
spechelper-icm-1 spechelper-icm-2 spechelper-tmll \
- spechelper-tm
+ spechelper-tm laa
if BUILD_DFP_TESTS
INSN_TESTS += dfp-1
endif
Added: trunk/none/tests/s390x/laa.stdout.exp (+56 -0)
===================================================================
--- trunk/none/tests/s390x/laa.stdout.exp 2012-12-02 03:37:36 +00:00 (rev 13145)
+++ trunk/none/tests/s390x/laa.stdout.exp 2012-12-02 20:58:45 +00:00 (rev 13146)
@@ -0,0 +1,56 @@
+before op1 = 0
+before op2 = 0
+before op3 = 0
+after op1 = 0
+after op2 = 0
+after op3 = 0
+cc = 0
+before op1 = 0xffffffff
+before op2 = 0xffffffff
+before op3 = 0xffffffff
+after op1 = 0xffffffff
+after op2 = 0xfffffffe
+after op3 = 0xffffffff
+cc = 1
+before op1 = 0x10000000
+before op2 = 0x10000000
+before op3 = 0x12345678
+after op1 = 0x10000000
+after op2 = 0x22345678
+after op3 = 0x12345678
+cc = 2
+before op1 = 0x10000000
+before op2 = 0x20000000
+before op3 = 0x12345678
+after op1 = 0x20000000
+after op2 = 0x32345678
+after op3 = 0x12345678
+cc = 2
+before op1 = 0xffffffff
+before op2 = 0x3
+before op3 = 0xfffffffd
+after op1 = 0x3
+after op2 = 0
+after op3 = 0xfffffffd
+cc = 0
+before op1 = 0
+before op2 = 0xffffffff
+before op3 = 0xffffffff
+after op1 = 0xffffffff
+after op2 = 0xfffffffe
+after op3 = 0xffffffff
+cc = 1
+before op1 = 0xffffffff
+before op2 = 0x10000000
+before op3 = 0x12345678
+after op1 = 0x10000000
+after op2 = 0x22345678
+after op3 = 0x12345678
+cc = 2
+before op1 = 0x10000000
+before op2 = 0x7fffffff
+before op3 = 0x1
+after op1 = 0x7fffffff
+after op2 = 0x80000000
+after op3 = 0x1
+cc = 3
Added: trunk/none/tests/s390x/laa.stderr.exp (+2 -0)
===================================================================
--- trunk/none/tests/s390x/laa.stderr.exp 2012-12-02 03:37:36 +00:00 (rev 13145)
+++ trunk/none/tests/s390x/laa.stderr.exp 2012-12-02 20:58:45 +00:00 (rev 13146)
@@ -0,0 +1,2 @@
+
+
|