Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Unified Diff: gdb/testsuite/gdb.arch/mips-octeon-bbit.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/testsuite/gdb.arch/iwmmxt-regs.exp ('k') | gdb/testsuite/gdb.arch/mips-octeon-bbit.exp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/testsuite/gdb.arch/mips-octeon-bbit.c
diff --git a/gdb/testsuite/gdb.arch/mips-octeon-bbit.c b/gdb/testsuite/gdb.arch/mips-octeon-bbit.c
new file mode 100644
index 0000000000000000000000000000000000000000..e3df4a4fd6dd37f75085dd2eebacb00e7074eca1
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/mips-octeon-bbit.c
@@ -0,0 +1,49 @@
+typedef unsigned long long uint64_t;
+void abort (void);
+
+#define BASE 0x1234567812345678ull
+
+#define DEF_BBIT_TAKEN(BRANCH_IF, BIT) \
+ int bbit_is_taken_##BRANCH_IF##_##BIT (volatile uint64_t *p) \
+ { \
+ int ret; \
+ asm (".set push \n\t" \
+ ".set noreorder \n\t" \
+ "bbit" #BRANCH_IF " %1, " #BIT ", 1f \n\t" \
+ "nop \n\t" \
+ "li %0, 0 \n\t" \
+ "b 2f \n\t" \
+ "nop \n\t" \
+ "1: \n\t" \
+ "li %0, 1 \n\t" \
+ "2: \n\t" \
+ ".set pop" \
+ : "=r"(ret) : "r"(*p)); \
+ return ret; \
+ } \
+ volatile uint64_t taken_##BRANCH_IF##_##BIT = \
+ BASE & (~(1ull << BIT)) | ((uint64_t) BRANCH_IF << BIT); \
+ volatile uint64_t not_taken_##BRANCH_IF##_##BIT = \
+ BASE & (~(1ull << BIT)) | (((uint64_t) !BRANCH_IF) << BIT);
+
+DEF_BBIT_TAKEN (0, 10);
+DEF_BBIT_TAKEN (0, 36);
+DEF_BBIT_TAKEN (1, 20);
+DEF_BBIT_TAKEN (1, 49);
+
+#define EXPECT(X) if (!(X)) abort ();
+
+main ()
+{
+ EXPECT (bbit_is_taken_0_10 (&taken_0_10));
+ EXPECT (!bbit_is_taken_0_10 (&not_taken_0_10));
+
+ EXPECT (bbit_is_taken_0_36 (&taken_0_36));
+ EXPECT (!bbit_is_taken_0_36 (&not_taken_0_36));
+
+ EXPECT (bbit_is_taken_1_20 (&taken_1_20));
+ EXPECT (!bbit_is_taken_1_20 (&not_taken_1_20));
+
+ EXPECT (bbit_is_taken_1_49 (&taken_1_49));
+ EXPECT (!bbit_is_taken_1_49 (&not_taken_1_49));
+}
« no previous file with comments | « gdb/testsuite/gdb.arch/iwmmxt-regs.exp ('k') | gdb/testsuite/gdb.arch/mips-octeon-bbit.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698