[PATCH] Finish assembly support for Intel SHA Extensions
Craig Topper
craig.topper at gmail.com
Sat Sep 14 08:26:51 PDT 2013
Do you plan to add the intrinsics as well?
On Friday, September 13, 2013, Craig Topper wrote:
> No % sign on the right most xmm0 in the aliases. Intel syntax doens't use
> it. Otherwise LGTM.
>
>
> On Fri, Sep 13, 2013 at 10:46 AM, Ben Langmuir <ben.langmuir at intel.com>wrote:
>
> SHA256RNDS2 aliases with explicit xmm0
>
> Hi craig.topper,
>
> http://llvm-reviews.chandlerc.com/D1663
>
> CHANGE SINCE LAST DIFF
> http://llvm-reviews.chandlerc.com/D1663?vs=4242&id=4287#toc
>
> Files:
> lib/Target/X86/X86InstrSSE.td
> test/MC/Disassembler/X86/x86-64.txt
> test/MC/X86/x86_64-encoding.s
>
> Index: lib/Target/X86/X86InstrSSE.td
> ===================================================================
> --- lib/Target/X86/X86InstrSSE.td
> +++ lib/Target/X86/X86InstrSSE.td
> @@ -7324,6 +7324,17 @@
> // SHA-NI Instructions
>
> //===----------------------------------------------------------------------===//
>
> +multiclass SHAI_binop<bits<8> Opc, string OpcodeStr> {
> + def rr : I<Opc, MRMSrcReg, (outs VR128:$dst),
> + (ins VR128:$src1, VR128:$src2),
> + !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), []>,
> T8;
> +
> + let mayLoad = 1 in
> + def rm : I<Opc, MRMSrcMem, (outs VR128:$dst),
> + (ins VR128:$src1, i128mem:$src2),
> + !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), []>,
> T8;
> +}
> +
> let Constraints = "$src1 = $dst", hasSideEffects = 0, Predicates =
> [HasSHA] in {
> def SHA1RNDS4rri : Ii8<0xCC, MRMSrcReg, (outs VR128:$dst),
> (ins VR128:$src1, VR128:$src2, i8imm:$src3),
> @@ -7334,8 +7345,24 @@
> (ins VR128:$src1, i128mem:$src2, i8imm:$src3),
> "sha1rnds4\t{$src3, $src2, $dst|$dst, $src2,
> $src3}",
> []>, TA;
> +
> + defm SHA1NEXTE : SHAI_binop<0xC8, "sha1nexte">;
> + defm SHA1MSG1 : SHAI_binop<0xC9, "sha1msg1">;
> + defm SHA1MSG2 : SHAI_binop<0xCA, "sha1msg2">;
> +
> + let Uses=[XMM0] in
> + defm SHA256RNDS2 : SHAI_binop<0xCB, "sha256rnds2">;
> +
> + defm SHA256MSG1 : SHAI_binop<0xCC, "sha256msg1">;
> + defm SHA256MSG2 : SHAI_binop<0xCD, "sha256msg2">;
> }
>
> +// Aliases with explicit %xmm0
> +def : InstAlias<"sha256rnds2\t{%xmm0, $src2, $dst|$dst, $src2, %xmm0}",
> + (SHA256RNDS2rr VR128:$dst, VR128:$src2)>;
> +def : InstAlias<"sha256rnds2\t{%xmm0, $src2, $dst|$dst, $src2, %xmm0}",
> + (SHA256RNDS2rm VR128:$dst, i128mem:$src2)>;
> +
>
> //===----------------------------------------------------------------------===//
> // AES-NI Instructions
>
> //===----------------------------------------------------------------------===//
> Index: test/MC/Disassembler/X86/x86-64.txt
> ===================================================================
> --- test/MC/Disassembler/X86/x86-64.txt
> +++ test/MC/Disassembler/X86/x86-64.txt
> @@ -162,4 +162,40 @@
> 0x0f 0x3a 0xcc 0xd1 0x01
>
> # CHECK: sha1rnds4 $1, (%rax), %xmm2
> -0x0f 0x3a 0xcc 0x10 0x01
> \ No newline at end of file
> +0x0f 0x3a 0xcc 0x10 0x01
> +
> +# CHECK: sha1nexte %xmm1, %xmm2
> +0x0f 0x38 0xc8 0xd1
> +
> +# CHECK: sha1nexte (%rax), %xmm2
> +0x0f 0x38 0xc8 0x10
> +
> +# CHECK: sha1msg1 %xmm1, %xmm2
> +0x0f 0x38 0xc9 0xd1
> +
> +# CHECK: sha1msg1 (%rax), %xmm2
> +0x0f 0x38 0xc9 0x10
> +
> +# CHECK: sha1msg2 %xmm1, %xmm2
> +0x0f 0x38 0xca 0xd1
> +
> +# CHECK: sha1msg2 (%rax), %xmm2
> +0x0f 0x38 0xca 0x10
> +
> +# CHECK: sha256rnds2 (%rax), %xmm2
> +0x0f 0x38 0xcb 0x10
> +
> +# CHECK: sha256rnds2 %xmm1, %xmm2
> +0x0f 0x38 0xcb 0xd1
> +
> +# CHECK: sha256msg1 %xmm1, %xmm2
> +0x0f 0x38 0xcc 0xd1
> +
> +# CHECK: sha256msg1 (%rax), %xmm2
> +0x0f 0x38 0xcc 0x10
> +
> +# CHECK: sha256msg2 %xmm1, %xmm2
> +0x0f 0x38 0xcd 0xd1
> +
> +# CHECK: sha256msg2 (%rax), %xmm2
> +0x0f 0x38 0xcd 0x10
> \ No newline at end of file
> Index: test/MC/X86/x86_64-encoding.s
> ===================================================================
> --- test/MC/X86/x86_64-encoding.s
> +++ test/MC/X86/x86_64-encoding.s
> @@ -128,6 +128,58 @@
> // CHECK: encoding: [0x0f,0x3a,0xcc,0x10,0x01]
> sha1rnds4 $1, (%rax), %xmm2
>
> +// CHECK: sha1nexte %xmm1, %xmm2
> +// CHECK: encoding: [0x0f,0x38,0xc8,0xd1]
> +sha1nexte %xmm1, %xmm2
> +
> +// CHECK: sha1msg1 %xmm
>
> --
> ~Craig
>
--
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130914/41cbe477/attachment.html>
More information about the llvm-commits
mailing list