[llvm-bugs] [Bug 39479] New: Failure to simplify select(-1, +1, cond)*b -> select(-b, b, cond)
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 29 07:18:24 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39479
Bug ID: 39479
Summary: Failure to simplify select(-1,+1,cond)*b ->
select(-b,b,cond)
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: filcab at gmail.com, llvm-bugs at lists.llvm.org,
spatel+llvm at rotateright.com, tilkax at gmail.com
#include <math.h>
int sel_mul_s32(bool a, int b)
{
return (a ? -1 : 1) * b;
}
float sel_mul_f32(bool a, float b)
{
return (a ? -1 : 1) * b;
}
https://godbolt.org/z/nGT8f_
clang:
_Z11sel_mul_s32bi: # @_Z11sel_mul_s32bi
xorb $1, %dil
movzbl %dil, %eax
leal -1(%rax,%rax), %eax
imull %esi, %eax
retq
_Z11sel_mul_f32bf: # @_Z11sel_mul_f32bf
testl %edi, %edi
jne .LBB1_1
vmovss .LCPI1_1(%rip), %xmm1 # xmm1 = mem[0],zero,zero,zero
vmulss %xmm0, %xmm1, %xmm0
retq
.LBB1_1:
vmovss .LCPI1_0(%rip), %xmm1 # xmm1 = mem[0],zero,zero,zero
vmulss %xmm0, %xmm1, %xmm0
retq
gcc:
_Z11sel_mul_s32bi:
testb %dil, %dil
movl %esi, %eax
je .L6
negl %eax
.L6:
ret
_Z11sel_mul_f32bf:
testb %dil, %dil
je .L13
vxorps .LC0(%rip), %xmm0, %xmm0
.L13:
ret
--
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/20181029/d4b8a2fe/attachment.html>
More information about the llvm-bugs
mailing list