yet another spill harness (by the llvm master _sabre_ himself)
authorMatthias Braun <matze@braunis.de>
Tue, 22 Jan 2008 10:25:45 +0000 (10:25 +0000)
committerMatthias Braun <matze@braunis.de>
Tue, 22 Jan 2008 10:25:45 +0000 (10:25 +0000)
[r17487]

ir/be/test/codegen/spillharness2.c [new file with mode: 0644]

diff --git a/ir/be/test/codegen/spillharness2.c b/ir/be/test/codegen/spillharness2.c
new file mode 100644 (file)
index 0000000..50b19e2
--- /dev/null
@@ -0,0 +1,40 @@
+void f(int);
+
+volatile int G1, G2, G3, G4, G5;
+
+volatile int VG;
+
+void test()
+{
+       int foo = rand();
+
+        // spill foo.
+       int t1 = G1;
+       int t2 = G2;
+       int t3 = G3;
+       int t4 = G4;
+       int t5 = G5;
+
+       int bar = rand();
+       int i;
+
+       G1 = t1; G2 = t2; G3 = t3; G4 = t4; G5 = t5;
+       G1 = t1; G2 = t2; G3 = t3; G4 = t4; G5 = t5;
+       G1 = t1; G2 = t2; G3 = t3; G4 = t4; G5 = t5;
+
+       i = 10000;
+       while (i--) {
+               VG = foo;  // really keep foo in a reg.
+               f(bar);   // bar live
+               G1 = t1;
+               VG = foo;
+               G2 = t2;
+               VG = foo;
+               G3 = t3;
+               VG = foo;
+               G4 = t4;
+               VG = foo;
+               G5 = t5;
+
+       }
+}