[RISCV] Re-define sha256, Zksed, and Zksh intrinsics to use i32 types.
authorCraig Topper <craig.topper@sifive.com>
Mon, 17 Jul 2023 15:58:29 +0000 (08:58 -0700)
committerCraig Topper <craig.topper@sifive.com>
Mon, 17 Jul 2023 15:58:29 +0000 (08:58 -0700)
commita64b3e92c7cb0dd474e0ecbdb9fb86c29487451f
tree8dc406ab315be84f537bb8e0d8e8a97f94012dc2
parentbaba13e9a19deff981bf5fc5534966ebf05de278
[RISCV] Re-define sha256, Zksed, and Zksh intrinsics to use i32 types.

Previously we returned i32 on RV32 and i64 on RV64. The instructions
only consume 32 bits and only produce 32 bits. For RV64, the result
is sign extended to 64 bits like *W instructions.

This patch removes this detail from the interface to improve
portability and consistency. This matches the proposal for scalar
intrinsics here https://github.com/riscv-non-isa/riscv-c-api-doc/pull/44

I've included IR autoupgrade support as well.

I'll be doing this for other builtins/intrinsics that currently use
'long' in other patches.

Reviewed By: VincentWu

Differential Revision: https://reviews.llvm.org/D154647
25 files changed:
clang/include/clang/Basic/BuiltinsRISCV.def
clang/lib/CodeGen/CGBuiltin.cpp
clang/test/CodeGen/RISCV/rvk-intrinsics/riscv32-zknh.c
clang/test/CodeGen/RISCV/rvk-intrinsics/riscv32-zksed.c [deleted file]
clang/test/CodeGen/RISCV/rvk-intrinsics/riscv32-zksh.c [deleted file]
clang/test/CodeGen/RISCV/rvk-intrinsics/riscv64-zknh.c
clang/test/CodeGen/RISCV/rvk-intrinsics/riscv64-zksed.c [deleted file]
clang/test/CodeGen/RISCV/rvk-intrinsics/riscv64-zksh.c [deleted file]
clang/test/CodeGen/RISCV/rvk-intrinsics/zksed.c [new file with mode: 0644]
clang/test/CodeGen/RISCV/rvk-intrinsics/zksh.c [new file with mode: 0644]
llvm/include/llvm/IR/IntrinsicsRISCV.td
llvm/lib/IR/AutoUpgrade.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.h
llvm/lib/Target/RISCV/RISCVInstrInfoZk.td
llvm/test/CodeGen/RISCV/rv32zknh-intrinsic.ll
llvm/test/CodeGen/RISCV/rv32zksed-intrinsic.ll
llvm/test/CodeGen/RISCV/rv32zksh-intrinsic.ll
llvm/test/CodeGen/RISCV/rv64zknh-intrinsic-autoupgrade.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rv64zknh-intrinsic.ll
llvm/test/CodeGen/RISCV/rv64zksed-intrinsic-autoupgrade2.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rv64zksed-intrinsic.ll
llvm/test/CodeGen/RISCV/rv64zksh-intrinsic-autoupgrade.ll [new file with mode: 0644]
llvm/test/CodeGen/RISCV/rv64zksh-intrinsic.ll
llvm/test/CodeGen/RISCV/sextw-removal.ll