[llvm-bugs] [Bug 41312] New: [SLP] Missed icmp/fcmp allof/anyof reductions
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Mar 29 14:15:39 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41312
Bug ID: 41312
Summary: [SLP] Missed icmp/fcmp allof/anyof reductions
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: a.bataev at hotmail.com, dtemirbulatov at gmail.com,
llvm-bugs at lists.llvm.org, spatel+llvm at rotateright.com
We should be able to combine these to allof/anyof vector reductions, instead we
end up with nested branch trees and scalar selects.
https://gcc.godbolt.org/z/FImIuY
#include <x86intrin.h>
float test_merge_allof_v4sf(__v4sf t) {
if((t[0] < 0.0 && t[1] < 0.0 && t[2] < 0.0 && t[3] < 0.0) ||
(t[0] > 1.0 && t[1] > 1.0 && t[2] > 1.0 && t[3] > 1.0))
return 0;
return t[0] + t[1];
}
float test_merge_anyof_v4sf(__v4sf t) {
if((t[0] < 0.0 || t[1] < 0.0 || t[2] < 0.0 || t[3] < 0.0) ||
(t[0] > 1.0 || t[1] > 1.0 || t[2] > 1.0 || t[3] > 1.0))
return 0;
return t[0] + t[1];
}
float test_separate_allof_v4sf(__v4sf t) {
if((t[0] < 0.0 && t[1] < 0.0 && t[2] < 0.0 && t[3] < 0.0))
return 0;
if((t[0] > 1.0 && t[1] > 1.0 && t[2] > 1.0 && t[3] > 1.0))
return 0;
return t[0] + t[1];
}
float test_separate_anyof_v4sf(__v4sf t) {
if((t[0] < 0.0 || t[1] < 0.0 || t[2] < 0.0 || t[3] < 0.0))
return 0;
if((t[0] > 1.0 || t[1] > 1.0 || t[2] > 1.0 || t[3] > 1.0))
return 0;
return t[0] + t[1];
}
int test_separate_allof_v4si(__v4si t) {
if((t[0] < 1 && t[1] < 1 && t[2] < 1 && t[3] < 1))
return 0;
if((t[0] > 255 && t[1] > 255 && t[2] > 255 && t[3] > 255))
return 0;
return t[0] + t[1];
}
int test_separate_anyof_v4si(__v4si t) {
if((t[0] < 1 || t[1] < 1 || t[2] < 1 || t[3] < 1))
return 0;
if((t[0] > 255 || t[1] > 255 || t[2] > 255 || t[3] > 255))
return 0;
return t[0] + t[1];
}
--
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/20190329/b2541597/attachment.html>
More information about the llvm-bugs
mailing list