 
 : rewrite-tagged-comparison? ( insn -- ? )
     #! Are we comparing two tagged fixnums? Then untag them.
-    [ src1>> vreg>expr tag-fixnum-expr? ]
-    [ src2>> tag-mask get bitand 0 = ]
-    bi and ; inline
+    {
+        [ src1>> vreg>expr tag-fixnum-expr? ]
+        [ src2>> tag-mask get bitand 0 = ]
+    } 1&& ; inline
 
 : (rewrite-tagged-comparison) ( insn -- src1 src2 cc )
     [ src1>> vreg>expr in1>> vn>vreg ]


: ##branch-t? ( insn -- ? )
    dup ##compare-imm-branch? [
        [ cc>> cc/= eq? ]
        [ src2>> \ f tag-number eq? ] bi and
    ] [ drop f ] if ; inline

: rewrite-boolean-comparison? ( insn -- ? )

        ] when
    ] when ;

: combine-add-imm? ( insn -- ? )
    {
        [ src1>> vreg>expr op>> \ ##add-imm = ]
        [ src2>> number? ]
    } 1&& ;

: combine-add-imm ( dst src n -- insn )
    [ vreg>expr [ in1>> vn>vreg ] [ in2>> vn>constant ] bi ] dip
    + \ ##add-imm new-insn ;

M: ##add-imm rewrite
    dup combine-add-imm? [
        [ dst>> ] [ src1>> ] [ src2>> ] tri combine-add-imm
        dup number-values
    ] when ;

M: insn rewrite ;
