+2015-07-08 Andrew Bennett <andrew.bennett@imgtec.com>
+
+ * gcc.target/mips/branch-2.c: Change NOMIPS16 to NOCOMPRESSION.
+ * gcc.target/mips/branch-3.c: Ditto
+ * gcc.target/mips/branch-4.c: Ditto.
+ * gcc.target/mips/branch-5.c: Ditto.
+ * gcc.target/mips/branch-6.c: Ditto.
+ * gcc.target/mips/branch-7.c: Ditto.
+ * gcc.target/mips/branch-8.c: Ditto.
+ * gcc.target/mips/branch-9.c: Ditto.
+ * gcc.target/mips/branch-10.c: Ditto.
+ * gcc.target/mips/branch-11.c: Ditto.
+ * gcc.target/mips/branch-12.c: Ditto.
+ * gcc.target/mips/branch-13.c: Ditto.
+ * gcc.target/mips/umips-branch-5.c: New file.
+ * gcc.target/mips/umips-branch-6.c: New file.
+ * gcc.target/mips/umips-branch-7.c: New file.
+ * gcc.target/mips/umips-branch-8.c: New file.
+ * gcc.target/mips/umips-branch-9.c: New file.
+ * gcc.target/mips/umips-branch-10.c: New file.
+ * gcc.target/mips/umips-branch-11.c: New file.
+ * gcc.target/mips/umips-branch-12.c: New file.
+ * gcc.target/mips/umips-branch-13.c: New file.
+ * gcc.target/mips/umips-branch-14.c: New file.
+ * gcc.target/mips/umips-branch-15.c: New file.
+ * gcc.target/mips/umips-branch-16.c: New file.
+ * gcc.target/mips/branch-helper.h (OCCUPY_0x10000): New define.
+ (OCCUPY_0xfffc): New define.
+
2015-07-08 Renlin Li <renlin.li@arm.com>
* gcc.target/arm/unsigned-float.c: Different options for hf toolchain.
#include "branch-helper.h"
-NOMIPS16 void
+NOCOMPRESSION void
foo (int (*bar) (void), int *x)
{
*x = bar ();
#include "branch-helper.h"
-NOMIPS16 void
+NOCOMPRESSION void
foo (int (*bar) (void), int *x)
{
*x = bar ();
#include "branch-helper.h"
-NOMIPS16 void
+NOCOMPRESSION void
foo (int (*bar) (void), int *x)
{
*x = bar ();
#include "branch-helper.h"
-NOMIPS16 void
+NOCOMPRESSION void
foo (int (*bar) (void), int *x)
{
*x = bar ();
#include "branch-helper.h"
-NOMIPS16 void
+NOCOMPRESSION void
foo (volatile int *x)
{
if (__builtin_expect (*x == 0, 1))
#include "branch-helper.h"
-NOMIPS16 void
+NOCOMPRESSION void
foo (volatile int *x)
{
if (__builtin_expect (*x == 0, 1))
#include "branch-helper.h"
-NOMIPS16 void
+NOCOMPRESSION void
foo (volatile int *x)
{
if (__builtin_expect (*x == 0, 1))
#include "branch-helper.h"
-NOMIPS16 void
+NOCOMPRESSION void
foo (volatile int *x)
{
if (__builtin_expect (*x == 0, 1))
#include "branch-helper.h"
-NOMIPS16 void
+NOCOMPRESSION void
foo (volatile int *x)
{
if (__builtin_expect (*x == 0, 1))
#include "branch-helper.h"
-NOMIPS16 void
+NOCOMPRESSION void
foo (volatile int *x)
{
if (__builtin_expect (*x == 0, 1))
#include "branch-helper.h"
-NOMIPS16 void
+NOCOMPRESSION void
foo (int (*bar) (void), int *x)
{
*x = bar ();
#include "branch-helper.h"
-NOMIPS16 void
+NOCOMPRESSION void
foo (int (*bar) (void), int *x)
{
*x = bar ();
D2 ("nop") "\n\t" \
D1 ("nop"))
+/* Emit something that is 0xfffc bytes long, which is the largest
+ permissible range for microMIPS forward branches when branches
+ have delay slots. */
+#define OCCUPY_0xfffc \
+ asm (D13 ("nop32") "\n\t" \
+ D12 ("nop32") "\n\t" \
+ D11 ("nop32") "\n\t" \
+ D10 ("nop32") "\n\t" \
+ D9 ("nop32") "\n\t" \
+ D8 ("nop32") "\n\t" \
+ D7 ("nop32") "\n\t" \
+ D6 ("nop32") "\n\t" \
+ D5 ("nop32") "\n\t" \
+ D4 ("nop32") "\n\t" \
+ D3 ("nop32") "\n\t" \
+ D2 ("nop32") "\n\t" \
+ D1 ("nop32") "\n\t" \
+ D0 ("nop32"))
/* Likewise emit something that is 0x1fffc bytes long. */
#define OCCUPY_0x1fffc do { asm ("nop"); OCCUPY_0x1fff8; } while (0)
+/* Likewise emit something that is 0x10000 bytes long. */
+#define OCCUPY_0x10000 do { asm ("nop32"); OCCUPY_0xfffc; } while (0)
--- /dev/null
+/* { dg-options "-mshared -mabi=64 -mmicromips" } */
+/* { dg-final { scan-assembler "\tdaddiu\t\\\$3,\\\$3,%lo\\(%neg\\(%gp_rel\\(foo\\)\\)\\)\n" } } */
+/* { dg-final { scan-assembler "\tld\t\\\$1,%got_page\\(\[^)\]*\\)\\(\\\$3\\)\\n" } } */
+/* { dg-final { scan-assembler "\tjr\t\\\$1\n" } } */
+/* { dg-final { scan-assembler-not "\\\$28" } } */
+
+#include "branch-helper.h"
+
+NOMIPS16 void
+foo (volatile int *x)
+{
+ if (__builtin_expect (*x == 0, 1))
+ OCCUPY_0x10000;
+}
--- /dev/null
+/* { dg-options "-mshared -mabi=32 -mmicromips" } */
+/* { dg-final { scan-assembler-not "(\\\$28|cpload|cprestore)" } } */
+/* { dg-final { scan-assembler-not "\tjrc?\t\\\$1\n" } } */
+
+#include "branch-helper.h"
+
+NOMIPS16 void
+foo (int (*bar) (void), int *x)
+{
+ *x = bar ();
+ if (__builtin_expect (*x == 0, 1))
+ OCCUPY_0xfffc;
+}
--- /dev/null
+/* { dg-options "-mshared -mabi=32 -mmicromips" } */
+/* { dg-final { scan-assembler "\t\\.cpload\t\\\$25\n" } } */
+/* { dg-final { scan-assembler "\t\\.cprestore\t16\n" } } */
+/* { dg-final { scan-assembler "\tlw\t\\\$1,16\\(\\\$(fp|sp)\\)\n" } } */
+/* { dg-final { scan-assembler "\tlw\t\\\$1,%got\\(\[^)\]*\\)\\(\\\$1\\)\n" } } */
+/* { dg-final { scan-assembler "\taddiu\t\\\$1,\\\$1,%lo\\(\[^)\]*\\)\n" } } */
+/* { dg-final { scan-assembler "\tjr\t\\\$1\n" } } */
+/* { dg-final { scan-assembler-not "\\\$28" } } */
+
+#include "branch-helper.h"
+
+NOMIPS16 void
+foo (int (*bar) (void), int *x)
+{
+ *x = bar ();
+ if (__builtin_expect (*x == 0, 1))
+ OCCUPY_0x10000;
+}
--- /dev/null
+/* { dg-options "-mshared -mabi=n32 -mmicromips" } */
+/* { dg-final { scan-assembler-not "(\\\$28|%gp_rel|%got)" } } */
+/* { dg-final { scan-assembler-not "\tjrc?\t\\\$1\n" } } */
+
+#include "branch-helper.h"
+
+NOMIPS16 void
+foo (int (*bar) (void), int *x)
+{
+ *x = bar ();
+ if (__builtin_expect (*x == 0, 1))
+ OCCUPY_0xfffc;
+}
--- /dev/null
+/* { dg-options "-mshared -mabi=n32 -mmicromips" } */
+/* { dg-final { scan-assembler "\tsd\t\\\$28," } } */
+/* { dg-final { scan-assembler "\tld\t\\\$28," } } */
+/* { dg-final { scan-assembler "\taddiu\t\\\$28,\\\$28,%lo\\(%neg\\(%gp_rel\\(foo\\)\\)\\)\n" } } */
+/* { dg-final { scan-assembler "\tlw\t\\\$1,%got_page\\(\[^)\]*\\)\\(\\\$28\\)\n" } } */
+/* { dg-final { scan-assembler "\taddiu\t\\\$1,\\\$1,%got_ofst\\(\[^)\]*\\)\n" } } */
+/* { dg-final { scan-assembler "\tjr\t\\\$1\n" } } */
+
+#include "branch-helper.h"
+
+NOMIPS16 void
+foo (int (*bar) (void), int *x)
+{
+ *x = bar ();
+ if (__builtin_expect (*x == 0, 1))
+ OCCUPY_0x10000;
+}
--- /dev/null
+/* { dg-options "-mshared -mabi=64 -mmicromips" } */
+/* { dg-final { scan-assembler-not "(\\\$28|%gp_rel|%got)" } } */
+/* { dg-final { scan-assembler-not "\tjrc?\t\\\$1\n" } } */
+
+#include "branch-helper.h"
+
+NOMIPS16 void
+foo (int (*bar) (void), int *x)
+{
+ *x = bar ();
+ if (__builtin_expect (*x == 0, 1))
+ OCCUPY_0xfffc;
+}
--- /dev/null
+/* { dg-options "-mshared -mabi=64 -mmicromips" } */
+/* { dg-final { scan-assembler "\tsd\t\\\$28," } } */
+/* { dg-final { scan-assembler "\tld\t\\\$28," } } */
+/* { dg-final { scan-assembler "\tdaddiu\t\\\$28,\\\$28,%lo\\(%neg\\(%gp_rel\\(foo\\)\\)\\)\n" } } */
+/* { dg-final { scan-assembler "\tld\t\\\$1,%got_page\\(\[^)\]*\\)\\(\\\$28\\)\n" } } */
+/* { dg-final { scan-assembler "\tdaddiu\t\\\$1,\\\$1,%got_ofst\\(\[^)\]*\\)\n" } } */
+/* { dg-final { scan-assembler "\tjr\t\\\$1\n" } } */
+
+#include "branch-helper.h"
+
+NOMIPS16 void
+foo (int (*bar) (void), int *x)
+{
+ *x = bar ();
+ if (__builtin_expect (*x == 0, 1))
+ OCCUPY_0x10000;
+}
--- /dev/null
+/* { dg-options "-mshared -mabi=32 -mmicromips" } */
+/* { dg-final { scan-assembler-not "(\\\$25|\\\$28|cpload)" } } */
+/* { dg-final { scan-assembler-not "\tjr\t\\\$1\n" } } */
+/* { dg-final { scan-assembler-not "\\.cprestore" } } */
+
+#include "branch-helper.h"
+
+NOMIPS16 void
+foo (volatile int *x)
+{
+ if (__builtin_expect (*x == 0, 1))
+ OCCUPY_0xfffc;
+}
--- /dev/null
+/* { dg-options "-mshared -mabi=32 -mmicromips" } */
+/* { dg-final { scan-assembler "\t\\.cpload\t\\\$25\n" } } */
+/* { dg-final { scan-assembler "\tjr\t\\\$1\n" } } */
+/* { dg-final { scan-assembler-not "\\.cprestore" } } */
+
+#include "branch-helper.h"
+
+NOMIPS16 void
+foo (volatile int *x)
+{
+ if (__builtin_expect (*x == 0, 1))
+ OCCUPY_0x10000;
+}
--- /dev/null
+/* { dg-options "-mshared -mabi=n32 -mmicromips" } */
+/* { dg-final { scan-assembler-not "(\\\$25|\\\$28|%gp_rel|%got)" } } */
+/* { dg-final { scan-assembler-not "\tjrc?\t\\\$1\n" } } */
+
+#include "branch-helper.h"
+
+NOMIPS16 void
+foo (volatile int *x)
+{
+ if (__builtin_expect (*x == 0, 1))
+ OCCUPY_0xfffc;
+}
--- /dev/null
+/* { dg-options "-mshared -mabi=n32 -mmicromips" } */
+/* { dg-final { scan-assembler "\taddiu\t\\\$3,\\\$3,%lo\\(%neg\\(%gp_rel\\(foo\\)\\)\\)\n" } } */
+/* { dg-final { scan-assembler "\tlw\t\\\$1,%got_page\\(\[^)\]*\\)\\(\\\$3\\)\\n" } } */
+/* { dg-final { scan-assembler "\tjr\t\\\$1\n" } } */
+/* { dg-final { scan-assembler-not "\\\$28" } } */
+
+#include "branch-helper.h"
+
+NOMIPS16 void
+foo (volatile int *x)
+{
+ if (__builtin_expect (*x == 0, 1))
+ OCCUPY_0x10000;
+}
--- /dev/null
+/* { dg-options "-mshared -mabi=64 -mmicromips" } */
+/* { dg-final { scan-assembler-not "(\\\$25|\\\$28|%gp_rel|%got)" } } */
+/* { dg-final { scan-assembler-not "\tjrc?\t\\\$1\n" } } */
+
+#include "branch-helper.h"
+
+NOMIPS16 void
+foo (volatile int *x)
+{
+ if (__builtin_expect (*x == 0, 1))
+ OCCUPY_0xfffc;
+}