[PATCH] D46683: [X86] Assume alignment of movdir64b dst argument

Gabor Buella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 11 07:26:03 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL332091: [X86] Assume alignment of movdir64b dst argument (authored by GBuella, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D46683

Files:
  cfe/trunk/lib/Headers/movdirintrin.h
  cfe/trunk/test/CodeGen/builtin-movdir.c


Index: cfe/trunk/test/CodeGen/builtin-movdir.c
===================================================================
--- cfe/trunk/test/CodeGen/builtin-movdir.c
+++ cfe/trunk/test/CodeGen/builtin-movdir.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -ffreestanding -Wall -pedantic -triple x86_64-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=X86_64 --check-prefix=CHECK
-// RUN: %clang_cc1 -ffreestanding -Wall -pedantic -triple i386-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -ffreestanding -Wall -pedantic -triple i386-unknown-unknown -target-feature +movdiri -target-feature +movdir64b %s -emit-llvm -o - | FileCheck %s --check-prefix=X86 --check-prefix=CHECK
 
 #include <x86intrin.h>
 #include <stdint.h>
@@ -22,6 +22,11 @@
 
 void test_dir64b(void *dst, const void *src) {
   // CHECK-LABEL: test_dir64b
+  // CHECK: [[PTRINT1:%.+]] = ptrtoint
+  // X86: [[MASKEDPTR1:%.+]] = and i32 [[PTRINT1]], 63
+  // X86: [[MASKCOND1:%.+]] = icmp eq i32 [[MASKEDPTR1]], 0
+  // X86_64: [[MASKEDPTR1:%.+]] = and i64 [[PTRINT1]], 63
+  // X86_64: [[MASKCOND1:%.+]] = icmp eq i64 [[MASKEDPTR1]], 0
   // CHECK: call void @llvm.x86.movdir64b
   _movdir64b(dst, src);
 }
Index: cfe/trunk/lib/Headers/movdirintrin.h
===================================================================
--- cfe/trunk/lib/Headers/movdirintrin.h
+++ cfe/trunk/lib/Headers/movdirintrin.h
@@ -47,10 +47,15 @@
 
 #endif /* __x86_64__ */
 
-// Move 64 bytes as direct store
+/*
+ * movdir64b - Move 64 bytes as direct store.
+ * The destination must be 64 byte aligned, and the store is atomic.
+ * The source address has no alignment requirement, and the load from
+ * the source address is not atomic.
+ */
 static __inline__ void
 __attribute__((__always_inline__, __nodebug__,  __target__("movdir64b")))
-_movdir64b (void *__dst, const void *__src)
+_movdir64b (void *__dst __attribute__((align_value(64))), const void *__src)
 {
   __builtin_ia32_movdir64b(__dst, __src);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46683.146322.patch
Type: text/x-patch
Size: 2104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180511/73fd98b6/attachment.bin>


More information about the cfe-commits mailing list