[llvm] r183090 - Sparc: When storing 0, use %g0 directly in the store instruction instead of
Jakob Stoklund Olesen
stoklund at 2pi.dk
Mon Jun 3 09:45:16 PDT 2013
On Jun 2, 2013, at 5:21 PM, Venkatraman Govindaraju <venkatra at cs.wisc.edu> wrote:
> Author: venkatra
> Date: Sun Jun 2 19:21:54 2013
> New Revision: 183090
>
> URL: http://llvm.org/viewvc/llvm-project?rev=183090&view=rev
> Log:
> Sparc: When storing 0, use %g0 directly in the store instruction instead of
> using two instructions (sethi and store).
>
> Modified:
> llvm/trunk/lib/Target/Sparc/SparcInstr64Bit.td
> llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td
> llvm/trunk/test/CodeGen/SPARC/64bit.ll
> llvm/trunk/test/CodeGen/SPARC/basictest.ll
>
> Modified: llvm/trunk/lib/Target/Sparc/SparcInstr64Bit.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstr64Bit.td?rev=183090&r1=183089&r2=183090&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/Sparc/SparcInstr64Bit.td (original)
> +++ llvm/trunk/lib/Target/Sparc/SparcInstr64Bit.td Sun Jun 2 19:21:54 2013
> @@ -286,6 +286,10 @@ def : Pat<(truncstorei16 i64:$src, ADDRr
> def : Pat<(truncstorei32 i64:$src, ADDRrr:$addr), (STrr ADDRrr:$addr, $src)>;
> def : Pat<(truncstorei32 i64:$src, ADDRri:$addr), (STri ADDRri:$addr, $src)>;
>
> +// store 0, addr -> store %g0, addr
> +def : Pat<(store (i64 0), ADDRrr:$dst), (STXrr ADDRrr:$dst, (i64 G0))>;
> +def : Pat<(store (i64 0), ADDRri:$dst), (STXri ADDRri:$dst, (i64 G0))>;
> +
> } // Predicates = [Is64Bit]
Nice!
I originally had a pattern that simply mapped 0 -> %g0, but that caused problems with two-address instructions like the selects.
AFAICT, this is the only place where the pattern actually helps anyway.
Thanks,
/jakob
More information about the llvm-commits
mailing list