Displaying 3 results from an estimated 3 matches for "cmp_inv".
Did you mean:
cmp_dev
2017 Jul 13
2
failing to optimize boolean ops on cmps
.../xor) that fail to handle compare patterns with the equivalent
bitwise logic. Example:
define i8 @or_and_not(i8 %a, i8 %b) {
%nota = xor i8 %a, -1
%and = and i8 %nota, %b
%res = or i8 %and, %a
ret i8 %res
}
define i1 @or_and_cmp_not(i32 %a, i32 %b, i1 %c) {
%cmp = icmp sgt i32 %a, %b
%cmp_inv = icmp sle i32 %a, %b ; this is 'not' of %cmp
%and = and i1 %c, %cmp_inv
%res = or i1 %cmp, %and
ret i1 %res
}
$ ./opt -instcombine hidden_not.ll -S
define i8 @or_and_not(i8 %a, i8 %b) {
%res = or i8 %b, %a
ret i8 %res
}
define i1 @or_and_cmp_not(i32 %a, i32 %b, i1 %c) {
%cmp...
2017 Jul 13
2
failing to optimize boolean ops on cmps
...gt;> define i8 @or_and_not(i8 %a, i8 %b) {
>> %nota = xor i8 %a, -1
>> %and = and i8 %nota, %b
>> %res = or i8 %and, %a
>> ret i8 %res
>> }
>>
>> define i1 @or_and_cmp_not(i32 %a, i32 %b, i1 %c) {
>> %cmp = icmp sgt i32 %a, %b
>> %cmp_inv = icmp sle i32 %a, %b ; this is 'not' of %cmp
>> %and = and i1 %c, %cmp_inv
>> %res = or i1 %cmp, %and
>> ret i1 %res
>> }
>>
>> $ ./opt -instcombine hidden_not.ll -S
>>
>> define i8 @or_and_not(i8 %a, i8 %b) {
>> %res = or i8 %b...
2017 Jul 14
2
failing to optimize boolean ops on cmps
...%nota = xor i8 %a, -1
> %and = and i8 %nota, %b
> %res = or i8 %and, %a
> ret i8 %res
> }
>
> define i1 @or_and_cmp_not(i32 %a, i32 %b, i1 %c) {
> %cmp = icmp sgt i32 %a, %b
> %cmp_inv = icmp sle i32 %a, %b ; this is 'not' of %cmp
> %and = and i1 %c, %cmp_inv
> %res = or i1 %cmp, %and
> ret i1 %res
> }
>
> $ ./opt -instcombine hidden_not.ll -S
>
> define i8 @or_and_not(i8...