https://bugs.llvm.org/show_bug.cgi?id=43014
Bug ID: 43014
Summary: Reuse ZF flags from xor; remove cmp
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedb...@nondot.org
Reporter: david.bolvan...@gmail.com
CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
llvm-...@redking.me.uk, spatel+l...@rotateright.com
#include <stdlib.h>
#include <stdio.h>
int p;
__attribute_noinline__ int foo(int x, int y) {
p = x ^ y;
if (x - y == 0) abort();
return 0;
}
int main(int argc, char**argv) {
foo(argc, atoi(argv[1]));
printf("p = %d\n", p);
}
foo: # @foo
.cfi_startproc
# %bb.0: # %entry
pushq %rax
.cfi_def_cfa_offset 16
movl %esi, %eax
xorl %edi, %eax
movl %eax, p(%rip)
cmpl %esi, %edi
je .LBB0_2
XOR sets ZF flag so.. I tried to remove cmp and compiled hand modified asm..
foo: # @foo
.cfi_startproc
# %bb.0: # %entry
pushq %rax
.cfi_def_cfa_offset 16
movl %esi, %eax
xorl %edi, %eax
movl %eax, p(%rip)
jz .LBB0_2
and test case still works as expected.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs