Souper says:
; Function: fn1
%0:i16 = var
%1:i32 = sext %0
%2:i32 = and 4294959104:i32, %1
%3:i1 = ne 40960:i32, %2
cand %3 1:i1
COMMAND: /home/regehr/souper/build/souper -stp-path=/usr/local/bin/stp reduce_51/foo.bc
LLVM says:
define void @fn1() #0 {
entry:
%0 = load i16* @a, align 2, !tbaa !1
%conv = sext i16 %0 to i32
%shr.mask = and i32 %conv, -8192
%cmp = icmp ne i32 %shr.mask, 40960
%conv1 = zext i1 %cmp to i32
store i32 %conv1, i32* @b, align 4, !tbaa !5
ret void
}
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -c -w -emit-llvm -O3 reduce_51/foo.c -o reduce_51/foo.bc
C source code:
short a;
int b;
void fn1() { b = a >> 13 != 5; }
x86-64 from LLVM:
fn1: # @fn1
movswl a(%rip), %eax
andl $-8192, %eax # imm = 0xFFFFFFFFFFFFE000
cmpl $40960, %eax # imm = 0xA000
setne %al
movzbl %al, %eax
movl %eax, b(%rip)
retq
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -w -O3 reduce_51/foo.c -S -o -
x86-64 from GCC:
fn1:
movl $1, b(%rip)
ret
COMMAND: gcc -w -O3 reduce_51/foo.c -S -o -