[PATCH] D140365: [SelectionDAG] Correctly widen bitcast of scalar to vector for big endian

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 19:26:07 PST 2022


nemanjai created this revision.
nemanjai added reviewers: efriedma, RKSimon, lebedev.ri, PowerPC.
Herald added a subscriber: hiraditya.
Herald added a project: All.
nemanjai requested review of this revision.
Herald added a project: LLVM.

For big endian targets that need a node such as this:
`v2i8 = bitcast i16:tN`

legalized by:

1. Promoting the `i16` input type
2. Widening the `v2i8` result type

The result will be incorrect because the legalizer will promote the input type and then produce a `scalar_to_vector` from that wider type to a vector of N elements of that type. That puts the desired bits into the low order bytes of element zero and they need to be in the high order bytes on big endian systems.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140365

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  llvm/test/CodeGen/PowerPC/vec_conv_i8_to_fp32_elts.ll
  llvm/test/CodeGen/PowerPC/widen-vec-correctly-be.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140365.484155.patch
Type: text/x-patch
Size: 5044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221220/7adc5681/attachment.bin>


More information about the llvm-commits mailing list