aboutsummaryrefslogtreecommitdiffstats
path: root/test/gourdinl
diff options
context:
space:
mode:
authorLéo Gourdin <leo.gourdin@univ-grenoble-alpes.fr>2021-03-29 08:42:36 +0200
committerLéo Gourdin <leo.gourdin@univ-grenoble-alpes.fr>2021-03-29 08:42:36 +0200
commit706b6384a0d1b9a3206049dadadee7f4a8dd5f9d (patch)
tree6f6565112ed27e6531665a0b2a4c5fbb646f8e5b /test/gourdinl
parent3e953ef41f736ed5b7db699b1adf21d46cb5b8db (diff)
downloadcompcert-kvx-706b6384a0d1b9a3206049dadadee7f4a8dd5f9d.tar.gz
compcert-kvx-706b6384a0d1b9a3206049dadadee7f4a8dd5f9d.zip
adding test for load replacement on a64
Diffstat (limited to 'test/gourdinl')
-rw-r--r--test/gourdinl/clause.h12
-rw-r--r--test/gourdinl/clause2.c23
-rwxr-xr-xtest/gourdinl/cscript.sh20
-rwxr-xr-xtest/gourdinl/gen_asm_files.sh6
4 files changed, 61 insertions, 0 deletions
diff --git a/test/gourdinl/clause.h b/test/gourdinl/clause.h
new file mode 100644
index 00000000..3eb44402
--- /dev/null
+++ b/test/gourdinl/clause.h
@@ -0,0 +1,12 @@
+typedef struct {
+ int b;
+ int a;
+} * CLAUSE;
+__inline__ int g(CLAUSE c) { return c->b; }
+__inline__ int d(CLAUSE c) { return c->a; }
+__inline__ void clause_SetNumOfConsLits(CLAUSE c, int e) {
+ c->b = e;
+ c->a = e;
+}
+__inline__ int f(CLAUSE c) { return g(c) + d(c); }
+__inline__ int clause_LastLitIndex(c) { return f(c); }
diff --git a/test/gourdinl/clause2.c b/test/gourdinl/clause2.c
new file mode 100644
index 00000000..42cd0fa6
--- /dev/null
+++ b/test/gourdinl/clause2.c
@@ -0,0 +1,23 @@
+#include "clause.h"
+int a, b;
+void c();
+void h() {
+ int f = clause_LastLitIndex(d);
+ a = clause_LastLitIndex(0);
+ if (f)
+ if (a)
+ 1;
+}
+void i() {
+ CLAUSE e = 0;
+ int *g[] = {h, c};
+ for (; b;)
+ l(e);
+}
+void m() {
+ int k, j;
+ for (; k <= 0;)
+ ;
+ clause_SetNumOfConsLits(0, j);
+ n(0 - j);
+}
diff --git a/test/gourdinl/cscript.sh b/test/gourdinl/cscript.sh
new file mode 100755
index 00000000..8bf3a613
--- /dev/null
+++ b/test/gourdinl/cscript.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+/home/yuki/Work/VERIMAG/Compcert_neutral/ccomp -stdlib ../../runtime -dparse -dclight -S -fstruct-return -c clause2.c > log 2>&1
+
+b1=$(cat log | ack "LDP_CONSEC_PEEP_IMM_DEC_ldr64")
+sb1=$?
+b2=$(cat log | ack "LDP_BACK_SPACED_PEEP_IMM_DEC_ldr32")
+sb2=$?
+b3=$(cat log | ack "STP_FORW_SPACED_PEEP_IMM_INC_str32")
+sb3=$?
+b4=$(cat log | ack "STP_CONSEC_PEEP_IMM_INC_str64")
+sb4=$?
+
+#if [ "$sb1" == 0 ] && [ "$sb2" == 0 ] && [ "$sb3" == 0 ] && [ "$sb4" == 0 ]
+if [ "$sb1" == 0 ] && [ "$sb2" == 0 ] && [ "$sb3" == 0 ] && [ "$sb4" == 0 ]
+then
+ exit 0
+else
+ exit 1
+fi
diff --git a/test/gourdinl/gen_asm_files.sh b/test/gourdinl/gen_asm_files.sh
new file mode 100755
index 00000000..08cd4b3d
--- /dev/null
+++ b/test/gourdinl/gen_asm_files.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+../../ccomp -S clause2.c -o clause2.nopostpass.noph.s -fno-coalesce-mem -fno-postpass
+../../ccomp -S clause2.c -o clause2.nopostpass.ph.s -fcoalesce-mem -fno-postpass
+../../ccomp -S clause2.c -o clause2.noph.s -fno-coalesce-mem
+../../ccomp -S clause2.c -o clause2.ph.s -fcoalesce-mem