[PATCH] D43960: [X86] Reject xmm16-31 in inline asm constraints when AVX512 is disabled

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 2 10:22:13 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL326596: [X86] Reject xmm16-31 in inline asm constraints when AVX512 is disabled (authored by ctopper, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43960?vs=136576&id=136789#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43960

Files:
  llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
  llvm/trunk/test/CodeGen/X86/asm-reject-xmm16.ll


Index: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
@@ -39160,6 +39160,15 @@
     return Res;
   }
 
+  // Make sure it isn't a register that requires AVX512.
+  if (!Subtarget.hasAVX512() && isFRClass(*Res.second) &&
+      TRI->getEncodingValue(Res.first) & 0x10) {
+    // Register requires EVEX prefix.
+    Res.first = 0;
+    Res.second = nullptr;
+    return Res;
+  }
+
   // Otherwise, check to see if this is a register class of the wrong value
   // type.  For example, we want to map "{ax},i32" -> {eax}, we don't want it to
   // turn into {ax},{dx}.
Index: llvm/trunk/test/CodeGen/X86/asm-reject-xmm16.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/asm-reject-xmm16.ll
+++ llvm/trunk/test/CodeGen/X86/asm-reject-xmm16.ll
@@ -0,0 +1,8 @@
+; RUN: not llc -o /dev/null %s 2>&1 | FileCheck %s
+target triple = "x86_64--"
+
+; CHECK: error: couldn't allocate output register for constraint '{xmm16}'
+define i64 @blup() {
+  %v = tail call i64 asm "", "={xmm16},0"(i64 0)
+  ret i64 %v
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43960.136789.patch
Type: text/x-patch
Size: 1223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180302/bd2e885b/attachment.bin>


More information about the llvm-commits mailing list