*julia> **@code_llvm(b^a)*
define i1 @"julia_^_21646"(i1, i1) {
top:
%2 = xor i1 %1, true
%3 = or i1 %0, %2
ret i1 %3
}
On Friday, October 7, 2016 at 10:56:26 AM UTC-3, Kevin Liu wrote:
>
> Sorry, no need, I got this
>
> *julia> **@code_llvm(a<=b)*
>
>
> define i1 @"julia_<=_21637"(i1, i1) {
>
> top:
>
> %2 = xor i1 %0, true
>
> %3 = or i1 %1, %2
>
> ret i1 %3
>
> }
>
>
> *julia> **@code_llvm(ifelse(a,b,true))*
>
>
> define i1 @julia_ifelse_21636(i1, i1, i1) {
>
> top:
>
> %3 = select i1 %0, i1 %1, i1 %2
>
> ret i1 %3
>
> }
>
>
> How do you read this output?
>
> On Friday, October 7, 2016 at 10:50:57 AM UTC-3, Kevin Liu wrote:
>>
>> 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
>>>>>
>>>>