test bt instruction
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 12 May 2008 14:44:14 +0000 (14:44 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 12 May 2008 14:44:14 +0000 (14:44 +0000)
[r19585]

ir/be/test/bttest.c [new file with mode: 0644]

diff --git a/ir/be/test/bttest.c b/ir/be/test/bttest.c
new file mode 100644 (file)
index 0000000..9f56ca5
--- /dev/null
@@ -0,0 +1,33 @@
+#include <stdio.h>
+
+int bttest(int x, int n) {
+       if (x & (1 << n))
+               return 1;
+       return 0;
+}
+
+int nbttest(int x, int n) {
+       if (!(x & (1 << n)))
+               return 1;
+       return 0;
+}
+
+int bttest1(int x, int n) {
+       if ((x & (1 << n)) == (1 << n))
+               return 1;
+       return 0;
+}
+
+int bttest2(int x, int n) {
+       if ((x & (1 << n)) != (1 << n))
+               return 1;
+       return 0;
+}
+
+int main() {
+       printf("%d\n", bttest(128, 7));
+       printf("%d\n", nbttest(128, 7));
+       printf("%d\n", bttest1(128, 7));
+       printf("%d\n", bttest2(128, 7));
+       return 0;
+}