Souper says:
; Function: fn1
%0:i16 = var
%1:i32 = sext %0
%2:i32 = subnsw 37606:i32, %1
%3:i1 = slt %2, 1:i32
cand %3 0:i1
COMMAND: /home/regehr/souper/build/souper -stp-path=/usr/local/bin/stp reduce_693/foo.bc
LLVM says:
define void @fn1() #0 {
entry:
%0 = load i16* @b, align 2, !tbaa !1
%conv = sext i16 %0 to i32
%sub = sub nsw i32 37606, %conv
%cmp = icmp slt i32 %sub, 1
%conv1 = zext i1 %cmp to i32
store i32 %conv1, i32* @a, align 4, !tbaa !5
ret void
}
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -c -w -emit-llvm -O3 reduce_693/foo.c -o reduce_693/foo.bc
C source code:
int a;
short b;
void fn1() { a = 0 >= 37606 - b; }
x86-64 from LLVM:
fn1: # @fn1
movswl b(%rip), %eax
movl $37606, %ecx # imm = 0x92E6
subl %eax, %ecx
testl %ecx, %ecx
setle %al
movzbl %al, %eax
movl %eax, a(%rip)
retq
COMMAND: /home/regehr/souper/third_party/llvm/Debug/bin/clang -w -O3 reduce_693/foo.c -S -o -
x86-64 from GCC:
fn1:
movl $0, a(%rip)
ret
COMMAND: gcc -w -O3 reduce_693/foo.c -S -o -