Allow inline %assert inside of complex immediates.
[b43-tools.git] / assembler / test.asm
index b1f3f147b01267d520f7ce287aefc3b36abe7c79..cb0d3bdf95a42ab85ac3b4d136667ddd59e5d2e4 100644 (file)
 
 #define ECOND_MAC_ON   (0x20 | 4)
 
+%assert ((((1))) == ((((2 - 1) & 0xFF))))
+%assert ((1 == 2) || (1 == (0xFF & 1)))
+%assert (1 != (~1))
+%assert ((1 == (2 - 1)) && (2 == 2))
 
 .text
 
+       /* Inline assertion inside of a complex immediate.
+        * The %assert() expression will always return zero. */
+       mov     (1 + (%assert(1 == ((1 + 2) - 2)))), r0
+
 label:
        /* ADD instructions */
        add     r0,r1,r2        /* add */
@@ -38,7 +46,6 @@ label:
        addc    r0,r1,r2        /* add with carry */
        addc.   r0,r1,r2        /* add with carry, set carry */
 
-or 0x1000, r0, r0
 testlabel:
        /* SUB instructions */
        sub     r0,r1,r2        /* sub */
@@ -88,8 +95,8 @@ testlabel:
        jnzx    7,8,r0,r1,label /* Jump if nonzero after shift and mask */
 
        /* jump on external conditions */
-       jext    ECOND_MAC_ON,r0,r0,label  /* jump if external condition is TRUE */
-       jnext   ECOND_MAC_ON,r0,r0,label  /* jump if external condition is FALSE */
+       jext    ECOND_MAC_ON,label  /* jump if external condition is TRUE */
+       jnext   ECOND_MAC_ON,label  /* jump if external condition is FALSE */
 
        /* Subroutines */
        call    lr0,label       /* store PC in lr0, call func at label */
@@ -123,6 +130,7 @@ function_a:
        nap
        jmp loop-
  out:
+       mov r0, r0
        ret lr0, lr1
 
 function_b:
@@ -131,6 +139,7 @@ function_b:
        nap
        jmp loop-
  out:
+       mov r0, r0
        ret lr0, lr1
 
 
@@ -168,6 +177,7 @@ function_b:
        mov     testlabel, r0           /* Can use label as immediate value */
        mov r0,r1;mov r2, r3            /* ; does split instructions */
        mov     [(1+1)],[(2+2),off0]    /* Can use complex immediates as memory offsets */
+       orx     (0 + 1), (1 * 2), 0, 0, r0 /* Allow complex immediates as M or S */
 
 
 /* The .initvals section generates an "Initial Values" file