Changes between Version 5 and Version 6 of PrimBool


Ignore:
Timestamp:
Jan 25, 2013 10:22:47 AM (2 years ago)
Author:
jstolarek
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PrimBool

    v5 v6  
    3333{{{ 
    3434case <# x 0 of _ { 
    35   False -> 
    36     case >=# x width of _ { 
    37       False -> 
    38         case <# y 0 of _ { 
    39           False -> 
    40             case >=# y height of _ { 
    41               False -> E2 
    42               True  -> E1 
    43             }; 
    44           True -> E1 
    45         }; 
    46       True -> E1 
    47     }; 
    48   True -> E1 
     35  False -> 
     36    case >=# x width of _ { 
     37      False -> 
     38        case <# y 0 of _ { 
     39          False -> 
     40            case >=# y height of _ { 
     41              False -> E2 
     42              True  -> E1 
     43            }; 
     44          True -> E1 
     45        }; 
     46      True -> E1 
     47    }; 
     48  True -> E1 
    4949}; 
    5050}}} 
     
    5454{{{ 
    5555.Lc1rf: 
    56         testq %r14,%r14 
    57         jl .Lc1rk 
    58         cmpq %rdi,%r14 
    59         jge .Lc1rp 
    60         testq %rsi,%rsi 
    61         jl .Lc1ru 
    62         cmpq %r8,%rsi 
    63         jge .Lc1rz 
    64         movl $Main_g2_closure+1,%ebx 
    65         jmp *0(%rbp) 
     56        testq %r14,%r14 
     57        jl .Lc1rk 
     58        cmpq %rdi,%r14 
     59        jge .Lc1rp 
     60        testq %rsi,%rsi 
     61        jl .Lc1ru 
     62        cmpq %r8,%rsi 
     63        jge .Lc1rz 
     64        movl $Main_g2_closure+1,%ebx 
     65        jmp *0(%rbp) 
    6666.Lc1rk: 
    67         movl $Main_g1_closure+1,%ebx 
    68         jmp *0(%rbp) 
     67        movl $Main_g1_closure+1,%ebx 
     68        jmp *0(%rbp) 
    6969.Lc1rp: 
    70         movl $Main_g1_closure+1,%ebx 
    71         jmp *0(%rbp) 
     70        movl $Main_g1_closure+1,%ebx 
     71        jmp *0(%rbp) 
    7272.Lc1ru: 
    73         movl $Main_g1_closure+1,%ebx 
    74         jmp *0(%rbp) 
     73        movl $Main_g1_closure+1,%ebx 
     74        jmp *0(%rbp) 
    7575.Lc1rz: 
    76         movl $Main_g1_closure+1,%ebx 
    77         jmp *0(%rbp) 
     76        movl $Main_g1_closure+1,%ebx 
     77        jmp *0(%rbp) 
    7878}}} 
    7979 
     
    8383 
    8484Unnecessary branches could be eliminated by introducing primitive logical operators AND, OR and NOT (they will be denoted as `||#`, `&&#` and `not#` respectively). These operators would be strict and treat their logical parameters as unboxed integers (`1#` for `True` and `0#` for `False`). Result would be produced by using low-level bitwise operations. This means that if logical operators were chained together like in a given example only the final result would have to be inspected and thus only one branch would be necessary. 
     85 
     86Note (Jan Stolarek): My first thought was that introducing primitve logical operators will require changing `Bool` data type to a primitive unboxed version. This might not be the case. Please treat two solution apporaches as possibly wrong. 
    8587 
    8688=== First approach ===