aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2020-12-13 20:46:17 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2020-12-13 20:46:17 +0000
commitd9ec27c1c385d21ee47db8be4168dbc45ebe6e11 (patch)
treea71839823b399d03923661adbbc42fc367de7dab /gcc/testsuite
parent294ca9eca0293146d91768f7a75335fb642b489e (diff)
downloadgcc-d9ec27c1c385d21ee47db8be4168dbc45ebe6e11.zip
gcc-d9ec27c1c385d21ee47db8be4168dbc45ebe6e11.tar.gz
gcc-d9ec27c1c385d21ee47db8be4168dbc45ebe6e11.tar.bz2
VAX: Check the correct operand for constant 0 push operation
Check the output operand for representing pushing a value onto the stack rather than the constant 0 input in determining whether to use the PUSHL or the CLRL instruction for a SImode move. The latter actually works by means of using the predecrement addressing mode with the SP register and the machine code produced even takes the same number of bytes, however at least with some VAX implementations it incurs a performance penalty. Besides, we don't want to check the wrong operand anyway and have code that works by chance only. Add a test case covering push operations; for operands different from constant zero there is actually a code size advantage for using PUSHL rather than the equivalent MOVL instruction. gcc/ * config/vax/vax.c (vax_output_int_move): Check the correct operand for constant 0 push operation. gcc/testsuite/ * gcc.target/vax/push.c: New test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.target/vax/push.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/vax/push.c b/gcc/testsuite/gcc.target/vax/push.c
new file mode 100644
index 0000000..647ea60
--- /dev/null
+++ b/gcc/testsuite/gcc.target/vax/push.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+void bar (void (*) (void), int, int);
+
+void
+foo (void)
+{
+ bar (foo, 1, 0);
+}
+
+/* Expect assembly like:
+
+ pushl $0
+ pushl $1
+ pushab foo
+ calls $3,bar
+
+rather than:
+
+ clrl -(%sp)
+ movl $1,-(%sp)
+ movab foo,-(%sp)
+ calls $3,bar
+
+ */
+
+/* { dg-final { scan-assembler "\[ \t\]+pushl\[ \t\]+\\\$0\n\[ \t\]+pushl\[ \t\]+\\\$1\n\[ \t\]+pushab\[ \t\]+foo\n" } } */