[llvm] r217173 - X86: cpuid and xgetbv write to 32-bit registers, not 64-bit

Reid Kleckner rnk at google.com
Thu Sep 4 10:18:04 PDT 2014


Craig, I suspect there are other similar issues in this file, like the
xsave xrstor instruction definitions. How do we normally deal with this
kind of thing?


On Thu, Sep 4, 2014 at 9:58 AM, Reid Kleckner <reid at kleckner.net> wrote:

> Author: rnk
> Date: Thu Sep  4 11:58:25 2014
> New Revision: 217173
>
> URL: http://llvm.org/viewvc/llvm-project?rev=217173&view=rev
> Log:
> X86: cpuid and xgetbv write to 32-bit registers, not 64-bit
>
> This fixes an issue where MS inline assembly containing xgetbv wouldn't
> be marked as clobbering EAX:EDX. Test for that forthcoming on the Clang
> side.
>
> Modified:
>     llvm/trunk/lib/Target/X86/X86InstrSystem.td
>
> Modified: llvm/trunk/lib/Target/X86/X86InstrSystem.td
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSystem.td?rev=217173&r1=217172&r2=217173&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86InstrSystem.td (original)
> +++ llvm/trunk/lib/Target/X86/X86InstrSystem.td Thu Sep  4 11:58:25 2014
> @@ -462,11 +462,7 @@ def LMSW16m : I<0x01, MRM6m, (outs), (in
>                  "lmsw{w}\t$src", [], IIC_LMSW_REG>, TB;
>
>  let Defs = [EAX, EBX, ECX, EDX], Uses = [EAX, ECX] in
> -  def CPUID32 : I<0xA2, RawFrm, (outs), (ins), "cpuid", [], IIC_CPUID>,
> TB,
> -  Requires<[Not64BitMode]>;
> -let Defs = [RAX, RBX, RCX, RDX], Uses = [RAX, RCX] in
> -  def CPUID64 : I<0xA2, RawFrm, (outs), (ins), "cpuid", [], IIC_CPUID>,
> TB,
> -  Requires<[In64BitMode]>;
> +  def CPUID : I<0xA2, RawFrm, (outs), (ins), "cpuid", [], IIC_CPUID>, TB;
>  } // SchedRW
>
>
>  //===----------------------------------------------------------------------===//
> @@ -479,10 +475,10 @@ def WBINVD : I<0x09, RawFrm, (outs), (in
>
>  //===----------------------------------------------------------------------===//
>  // XSAVE instructions
>  let SchedRW = [WriteSystem] in {
> -let Defs = [RDX, RAX], Uses = [RCX] in
> +let Defs = [EDX, EAX], Uses = [ECX] in
>    def XGETBV : I<0x01, MRM_D0, (outs), (ins), "xgetbv", []>, TB;
>
> -let Uses = [RDX, RAX, RCX] in
> +let Uses = [EDX, EAX, ECX] in
>    def XSETBV : I<0x01, MRM_D1, (outs), (ins), "xsetbv", []>, TB;
>
>  let Uses = [RDX, RAX] in {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140904/c4dbd7c2/attachment.html>


More information about the llvm-commits mailing list