https://bugs.llvm.org/show_bug.cgi?id=43065
Bug ID: 43065
Summary: needless promotion of half to float and back for
vector abs, select, shufflevector
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedb...@nondot.org
Reporter: andrew.b.ad...@gmail.com
CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
llvm-...@redking.me.uk, spatel+l...@rotateright.com
Created attachment 22403
--> https://bugs.llvm.org/attachment.cgi?id=22403&action=edit
ll that demonstrates the problem
Operations on half vectors that just shuffle data around or can be implemented
as bitwise ops needlessly promote from half to float then back again. The
specific examples I have are abs, select, and concatenating two vectors. Select
is particularly bad, because it both promotes to float and also scalarizes the
select.
It seems that just about every data-shuffling operation I try on half vectors
that could be just implemented using the i16 equivalent instructions needlessly
promotes to float first. Attempts to work around by bitcasting to i16 instead
are foiled by llvm first optimizing away the bitcast.
I have found it impossible to use the half type in x86 code for this reason,
and have resorted to lowering Halide half types i16s for the x86 and arm
backends. This is clearly suboptimal, as it makes it hard to use the
half->float conversion instructions when I *do* want to do half math, as the
intermediate half type gets propagated through any neighboring bitcasting,
triggering the issues above. It also makes it annoying to pass buffers to code
generated by backends that do half math natively (e.g. ptx).
.ll that reproduces the issue is attached.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs