http://llvm.org/bugs/show_bug.cgi?id=21610
Bug ID: 21610
Summary: Different IR if intermediate variable used for fcmp +
select
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
I expect these 2 functions to produce the same optimized IR, but they currently
end up using a different fcmp type.
float max_uge_f32_0(float a, float b)
{
bool cmp = !(a < b);
return cmp ? b : a;
}
float max_uge_f32_2(float a, float b)
{
return !(a < b) ? b : a;
}
clang -O3 for this produces:
define float @max_uge_f32_0(float %a, float %b) #0 {
%1 = fcmp uge float %a, %b
%2 = select i1 %1, float %b, float %a
ret float %2
}
define float @max_uge_f32_2(float %a, float %b) #0 {
%1 = fcmp olt float %a, %b
%2 = select i1 %1, float %a, float %b
ret float %2
}
I expect the second's results for the first, swapping the select operands and
using the ordered comparison. However, the first version is using the original
select order with the unordered compare.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs