[llvm-bugs] [Bug 36036] New: [DAGCombine] Failure to recognise alternative ISD::ABS pattern
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jan 22 08:27:13 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=36036
Bug ID: 36036
Summary: [DAGCombine] Failure to recognise alternative ISD::ABS
pattern
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: llvm-bugs at lists.llvm.org, spatel+llvm at rotateright.com
__v4si abs(__v4si v) {
__m128i sign = _mm_srai_epi32( v, 31 );
return _mm_xor_si128( _mm_add_epi32( v, sign ), sign );
}
__v4si abs_alt(__v4si v) {
__m128i sign = _mm_srai_epi32( v, 31 );
return _mm_sub_epi32( _mm_xor_si128( v, sign ), sign );
}
define <4 x i32> @abs(<4 x i32>) {
%2 = icmp slt <4 x i32> %0, zeroinitializer
%3 = sub <4 x i32> zeroinitializer, %0
%4 = select <4 x i1> %2, <4 x i32> %3, <4 x i32> %0
ret <4 x i32> %4
}
define <4 x i32> @abs_alt(<4 x i32>) {
%2 = ashr <4 x i32> %0, <i32 31, i32 31, i32 31, i32 31>
%3 = xor <4 x i32> %2, %0
%4 = sub <4 x i32> %3, %2
ret <4 x i32> %4
}
llc -mcpu=btver2
abs:
vpabsd %xmm0, %xmm0
retq
abs_alt:
vpsrad $31, %xmm0, %xmm1
vpxor %xmm0, %xmm1, %xmm0
vpsubd %xmm1, %xmm0, %xmm0
retq
--
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/20180122/fede70ca/attachment-0001.html>
More information about the llvm-bugs
mailing list