Souper says:
; Function: fn1
%0:i32 = var
%1:i32 = lshr 1:i32, %0
%2:i1 = ne 7:i32, %1
cand %2 1:i1
COMMAND: /home/regehr/souper/build/souper -stp-path=/usr/local/bin/stp reduce_455/foo.bc
LLVM says:
define i32 @fn1() #0 {
entry:
%0 = load i32* @a, align 4, !tbaa !1
%shr = lshr i32 1, %0
store i32 %shr, i32* @b, align 4, !tbaa !1
%not.cmp = icmp ne i32 %shr, 7
%. = zext i1 %not.cmp to i32
ret i32 %.
}
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -c -w -emit-llvm -O3 reduce_455/foo.c -o reduce_455/foo.bc
C source code:
int a, b;
int fn1() {
b = 1 >> a;
if (b != 7)
return 1;
return 0;
}
x86-64 from LLVM:
fn1: # @fn1
movb a(%rip), %cl
movl $1, %eax
shrl %cl, %eax
cmpl $7, %eax
movl %eax, b(%rip)
setne %al
movzbl %al, %eax
retq
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -w -O3 reduce_455/foo.c -S -o -
x86-64 from GCC:
fn1:
movl a(%rip), %ecx
movl $1, %eax
sarl %cl, %eax
movl %eax, b(%rip)
movl $1, %eax
ret
COMMAND: gcc -w -O3 reduce_455/foo.c -S -o -