[SPARC] Mark the %g0 register as constant & use it to materialize zeros
authorKoakuma <koachan@protonmail.com>
Wed, 7 Dec 2022 18:25:38 +0000 (13:25 -0500)
committerBrad Smith <brad@comstyle.com>
Wed, 7 Dec 2022 18:34:13 +0000 (13:34 -0500)
commit2c41310fc146a1f609147c65ac5f30e5a57e84a8
tree4cb3e85449ea5bcd1f3dadc637d57caf8f03f646
parentbbfbec94b10699d473c106d85d5a48ff5d69e721
[SPARC] Mark the %g0 register as constant & use it to materialize zeros

Materialize zeros by copying from %g0, which is now marked as constant.

This makes it possible for some common operations (like integer negation) to be
performed in fewer instructions.

This continues @arichardson's patch at D132561.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D138887
17 files changed:
llvm/lib/Target/Sparc/SparcInstr64Bit.td
llvm/lib/Target/Sparc/SparcInstrInfo.td
llvm/lib/Target/Sparc/SparcRegisterInfo.td
llvm/test/CodeGen/SPARC/64bit.ll
llvm/test/CodeGen/SPARC/64cond.ll
llvm/test/CodeGen/SPARC/atomics.ll
llvm/test/CodeGen/SPARC/bigreturn.ll
llvm/test/CodeGen/SPARC/cttz.ll
llvm/test/CodeGen/SPARC/float-constants.ll
llvm/test/CodeGen/SPARC/fshl.ll
llvm/test/CodeGen/SPARC/inlineasm.ll
llvm/test/CodeGen/SPARC/missinglabel.ll
llvm/test/CodeGen/SPARC/smulo-128-legalisation-lowering.ll
llvm/test/CodeGen/SPARC/tailcall.ll
llvm/test/CodeGen/SPARC/umulo-128-legalisation-lowering.ll
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/sparc_generated_funcs.ll.generated.expected
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/sparc_generated_funcs.ll.nogenerated.expected