https://bugs.llvm.org/show_bug.cgi?id=51975

            Bug ID: 51975
           Summary: Cost modelling for load-cast
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

We currently don't costmodel the fact that some casts
(mainly sext/zext, but also  nt<->fp) can be folded into the load:
https://godbolt.org/z/vs7sx4nWz

This leads to rather pessimistic cost estimates,
and e.g. potentially affects LV.

Preceding question: does `X86TTIImpl::getCastInstrCost()`
have the right costs for e.g. `sext <8 x i16> to <8 x i32>`?
All `ISD::SIGN_EXTEND` in `AVX2ConversionTbl` are 2+,
for which target is that true?
I'd expect at least the s/zext's to cost 1.

Roughly, i suppose the solution matches that of the LOAD+BSWAP modelling,
i.e. if the cast is a single user of the load, then model it as free,
and when modelling the load which has a single cast user, then do ${MAGIC},

Where ${MAGIC} depends on the answer to the "Preceding question":
if the casts should cost 1, then we only need to adjust the load op sizes,
without increasing the load cost,
else i guess we need to report `max(load cost, cast cost)`?

Does this make sense?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to