[SelectionDAG][AVR] Add support for lrint and lround intrinsics
authorAyke van Laethem <aykevanlaethem@gmail.com>
Sun, 1 Jan 2023 18:05:35 +0000 (19:05 +0100)
committerAyke van Laethem <aykevanlaethem@gmail.com>
Sun, 8 Jan 2023 17:56:07 +0000 (18:56 +0100)
commit0408b131eb66ef842e7d57c1a0410a2a14f891ac
treedd9129758b8b665b00dd86860b2f1c9044534b56
parent167338de9687a8e65672001aa4c4f2e62cf45a76
[SelectionDAG][AVR] Add support for lrint and lround intrinsics

Integer legalization already supported splitting the output integer of
llround and llrint, but did not support this for lround and lrint yet.
This is not a problem for 32-bit architectures, but for 8/16-bit
architectures like AVR it results in a crash like this:

    ExpandIntegerResult #0: t7: i32 = lround t6

    LLVM ERROR: Do not know how to expand the result of this operator!

This patch simply add lrint/lround to the list of ISD opcodes to expand.

Fixes https://github.com/llvm/llvm-project/issues/59573.

Differential Revision: https://reviews.llvm.org/D140822
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
llvm/test/CodeGen/AVR/llrint.ll [new file with mode: 0644]
llvm/test/CodeGen/AVR/llround-conv.ll [new file with mode: 0644]
llvm/test/CodeGen/AVR/lrint.ll [new file with mode: 0644]
llvm/test/CodeGen/AVR/lround-conv.ll [new file with mode: 0644]