summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sh/sh4a-bitmovua.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/sh/sh4a-bitmovua.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/sh/sh4a-bitmovua.c')
-rw-r--r--gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c b/gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c
new file mode 100644
index 000000000..761c7b0b5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c
@@ -0,0 +1,73 @@
+/* Verify that we generate movua to load unaligned 32-bit values. */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O" } */
+/* { dg-final { scan-assembler-times "\tmovua\\.l\t" 6 } } */
+
+#ifdef __SH4A__
+/* Aligned. */
+struct s0 { long long d : 32; } x0;
+long long f0() {
+ return x0.d;
+}
+
+/* Unaligned load. */
+struct s1 { long long c : 8; long long d : 32; } x1;
+long long f1() {
+ return x1.d;
+}
+
+/* Unaligned load. */
+struct s2 { long long c : 16; long long d : 32; } x2;
+long long f2() {
+ return x2.d;
+}
+
+/* Unaligned load. */
+struct s3 { long long c : 24; long long d : 32; } x3;
+long long f3() {
+ return x3.d;
+}
+
+/* Aligned. */
+struct s4 { long long c : 32; long long d : 32; } x4;
+long long f4() {
+ return x4.d;
+}
+
+/* Aligned. */
+struct u0 { unsigned long long d : 32; } y_0;
+unsigned long long g0() {
+ return y_0.d;
+}
+
+/* Unaligned load. */
+struct u1 { long long c : 8; unsigned long long d : 32; } y_1;
+unsigned long long g1() {
+ return y_1.d;
+}
+
+/* Unaligned load. */
+struct u2 { long long c : 16; unsigned long long d : 32; } y2;
+unsigned long long g2() {
+ return y2.d;
+}
+
+/* Unaligned load. */
+struct u3 { long long c : 24; unsigned long long d : 32; } y3;
+unsigned long long g3() {
+ return y3.d;
+}
+
+/* Aligned. */
+struct u4 { long long c : 32; unsigned long long d : 32; } y4;
+unsigned long long g4() {
+ return y4.d;
+}
+#else
+asm ("movua.l\t");
+asm ("movua.l\t");
+asm ("movua.l\t");
+asm ("movua.l\t");
+asm ("movua.l\t");
+asm ("movua.l\t");
+#endif