[PATCH] D139618: [AArch64][SVE][Fixed length] Fix div miscompile

Peter Waller via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 03:34:51 PST 2022


peterwaller-arm created this revision.
peterwaller-arm added reviewers: paulwalker-arm, sdesmalen, david-arm.
Herald added subscribers: ctetreau, psnobl, hiraditya, kristof.beyls, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: All.
peterwaller-arm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The prior code worked before SVE DIV was enabled 128 bit vectors.
With 128 bit vectors, when run on a 256 bit machine, it would split and
do a signed unpack, but this resulted in one full vector and one empty
vector with a half-sized predicate. The effect was that only half the
elements were treated correctly.

The fix is to bisect the vector, sign extend, do the division, truncate
and then concat.

Fixes #59357.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139618

Files:
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/test/CodeGen/AArch64/sve-fixed-length-int-div.ll
  llvm/test/CodeGen/AArch64/sve-fixed-length-int-rem.ll
  llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-int-div.ll
  llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-int-rem.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139618.481226.patch
Type: text/x-patch
Size: 99021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221208/87b8ff81/attachment.bin>


More information about the llvm-commits mailing list