summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/loop-2.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.target/i386/loop-2.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/loop-2.c')
-rw-r--r--gcc/testsuite/gcc.target/i386/loop-2.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/loop-2.c b/gcc/testsuite/gcc.target/i386/loop-2.c
new file mode 100644
index 000000000..cf44d3027
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/loop-2.c
@@ -0,0 +1,81 @@
+/* PR optimization/9888 */
+/* Originator: Jim Bray <jb@as220.org> */
+/* { dg-do run } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-mtune=k6 -Os" } */
+
+enum reload_type
+{
+ RELOAD_FOR_INPUT, RELOAD_FOR_OUTPUT, RELOAD_FOR_INSN,
+ RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INPADDR_ADDRESS,
+ RELOAD_FOR_OUTPUT_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS,
+ RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OPADDR_ADDR,
+ RELOAD_OTHER, RELOAD_FOR_OTHER_ADDRESS
+};
+
+#define FOO_SIZE 3
+
+/* My results, varying with FOO_SIZE:
+ 30: asm error "value of ..fff77 too large:
+ 3 to 29: ....ff7d...
+ 1 to 2: no error. */
+
+struct reload
+{
+ int foo[FOO_SIZE];
+ int opnum;
+ enum reload_type when_needed;
+ unsigned int optional:1;
+ unsigned int secondary_p:1;
+};
+
+#define N_RELOADS 2
+
+struct reload rld[N_RELOADS];
+int n_reloads = N_RELOADS;
+
+int main(void)
+{
+ int i;
+
+ enum reload_type operand_type[1];
+
+ enum reload_type address_type[1];
+
+ int operand_reloadnum[1];
+ int goal_alternative_matches[1];
+
+ for (i = 0; i < n_reloads; i++)
+ {
+ if (rld[i].secondary_p
+ && rld[i].when_needed == operand_type[rld[i].opnum])
+ rld[i].when_needed = address_type[rld[i].opnum];
+
+ if ((rld[i].when_needed == RELOAD_FOR_INPUT_ADDRESS
+ || rld[i].when_needed == RELOAD_FOR_OUTPUT_ADDRESS
+ || rld[i].when_needed == RELOAD_FOR_INPADDR_ADDRESS
+ || rld[i].when_needed == RELOAD_FOR_OUTADDR_ADDRESS)
+ && (operand_reloadnum[rld[i].opnum] < 0
+ || rld[operand_reloadnum[rld[i].opnum]].optional))
+ {
+
+ if (rld[i].when_needed == RELOAD_FOR_INPADDR_ADDRESS
+ || rld[i].when_needed == RELOAD_FOR_OUTADDR_ADDRESS)
+ rld[i].when_needed = RELOAD_FOR_OPADDR_ADDR;
+ else
+ rld[i].when_needed = RELOAD_FOR_OPERAND_ADDRESS;
+ }
+
+ if ((rld[i].when_needed == RELOAD_FOR_INPUT_ADDRESS
+ || rld[i].when_needed == RELOAD_FOR_INPADDR_ADDRESS)
+ && operand_reloadnum[rld[i].opnum] >= 0
+ && (rld[operand_reloadnum[rld[i].opnum]].when_needed
+ == RELOAD_OTHER))
+ rld[i].when_needed = RELOAD_FOR_OTHER_ADDRESS;
+
+ if (goal_alternative_matches[rld[i].opnum] >= 0)
+ rld[i].opnum = goal_alternative_matches[rld[i].opnum];
+ }
+
+ return 0;
+}