Jeffrey, can you show the expression you put inside @code_llvm() and 
@code_native() for evaluation? 

On Friday, October 7, 2016 at 2:26:56 AM UTC-3, Jeffrey Sarnoff wrote:
>
> Hi Jussi,
>
> Your version compiles down more neatly than the ifelse version. On my 
> system, BenchmarkTools gives nearly identical results; I don't know why, 
> but the ifelse version is consistently a smidge faster (~%2, relative 
> speed). Here is the llvm code and local native code for each, your version 
> looks more tidy.  
>
>
> ```
> implies(p::Bool, q::Bool) = (p <= q)          implies(p::Bool, q::Bool) 
> = ifelse( p, q, true )
>
> # llvm
>
>   %2 = xor i8 %0, 1                                %2 = and i8 %0, 1
>   %3 = or i8 %2, %1                                %3 = icmp eq i8 %2, 0
>   ret i8 %3                                        %4 = select i1 %3, i8 
> 1, i8 %1
>                                                    ret i8 %3
>
> # native with some common code removed
>
>         xorb   $1, %dil                            testb  $1, %dil
> orb    %sil, %dil                          movb   $1, %al
>         movb   %dil, %al                           je     L15
>         popq   %rbp                                movb   %sil, %al
>         retq                                 L15:  popq   %rbp
>                                                    retq
> ```
>
>
>
>
> On Friday, October 7, 2016 at 12:22:23 AM UTC-4, Jussi Piitulainen wrote:
>>
>>
>> implies(p::Bool, q::Bool) = p <= q
>>
>>
>>
>> torstai 6. lokakuuta 2016 19.10.51 UTC+3 Kevin Liu kirjoitti:
>>>
>>> How is an implication represented in Julia? 
>>>
>>>
>>> https://en.wikipedia.org/wiki/Material_conditional#Definitions_of_the_material_conditional
>>>
>>

Reply via email to