[llvm-bugs] [Bug 42876] New: bool != less efficient than bool ==
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Aug 2 14:17:06 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42876
Bug ID: 42876
Summary: bool != less efficient than bool ==
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: RISC-V
Assignee: unassignedbugs at nondot.org
Reporter: efriedma at quicinc.com
CC: llvm-bugs at lists.llvm.org, llvm-dev at redking.me.uk,
rofirrim at gmail.com
void a(_Bool a, _Bool b, void c()) { if (a==b) c(); }
void a2(_Bool a, _Bool b, void c()) { if (a!=b) c(); }
Build with clang -O2 --target=riscv32. Output:
a: # @a
# %bb.0: # %entry
addi sp, sp, -16
sw ra, 12(sp)
bne a0, a1, .LBB0_2
[...]
a2: # @a2
# %bb.0: # %entry
addi sp, sp, -16
sw ra, 12(sp)
xor a0, a0, a1
addi a1, zero, 1
bne a0, a1, .LBB1_2
Something similar happens on some other targets; on x86 and 32-bit ARM, there's
an extra "cmp".
It looks like something weird is happening in target-independent SelectionDAG;
I haven't tried to dig further.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190802/190c22aa/attachment.html>
More information about the llvm-bugs
mailing list