;; IRET support
UNSPEC_INTERRUPT_RETURN
+
+ ;; For MOVDIRI and MOVDIR64B support
+ UNSPEC_MOVDIRI
+ UNSPEC_MOVDIR64B
])
(define_c_enum "unspecv" [
UNSPECV_SETSSBSY
UNSPECV_CLRSSBSY
- ;; For MOVDIRI and MOVDIR64B support
- UNSPECV_MOVDIRI
- UNSPECV_MOVDIR64B
-
;; For TSXLDTRK support
UNSPECV_XSUSLDTRK
UNSPECV_XRESLDTRK
;; MOVDIRI and MOVDIR64B
(define_insn "movdiri<mode>"
- [(unspec_volatile:SWI48 [(match_operand:SWI48 0 "memory_operand" "m")
- (match_operand:SWI48 1 "register_operand" "r")]
- UNSPECV_MOVDIRI)]
+ [(set (match_operand:SWI48 0 "memory_operand" "=m")
+ (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")]
+ UNSPEC_MOVDIRI))]
"TARGET_MOVDIRI"
"movdiri\t{%1, %0|%0, %1}"
[(set_attr "type" "other")])
(define_insn "@movdir64b_<mode>"
- [(unspec_volatile:XI [(match_operand:P 0 "register_operand" "r")
- (match_operand:XI 1 "memory_operand")]
- UNSPECV_MOVDIR64B)]
+ [(set (mem:XI (match_operand:P 0 "register_operand" "r"))
+ (unspec:XI [(match_operand:XI 1 "memory_operand" "m")]
+ UNSPEC_MOVDIR64B))]
"TARGET_MOVDIR64B"
"movdir64b\t{%1, %0|%0, %1}"
[(set_attr "type" "other")])
--- /dev/null
+/* { dg-do run { target movdir } } */
+/* { dg-options "-mmovdir64b -O2" } */
+
+#include <x86intrin.h>
+#include <string.h>
+
+unsigned long long int src[8] = {1, 2, 3, 4, 5, 6, 7, 8};
+unsigned long long int dest[8] __attribute__ ((aligned (64)))
+ = {-1, -1, -1, -1, -1, -1, -1, -1};
+
+int
+main ()
+{
+ if (!__builtin_cpu_supports ("movdir64b"))
+ return 0;
+
+ _movdir64b (dest, src);
+
+ if (memcmp (dest, src, sizeof (dest)) != 0)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+/* { dg-do run { target movdir } } */
+/* { dg-options "-mmovdiri -O2" } */
+
+#include <x86intrin.h>
+
+unsigned int dest = -1;
+
+int
+main ()
+{
+ if (!__builtin_cpu_supports ("movdiri"))
+ return 0;
+
+ _directstoreu_u32 (&dest, 0xbadbeef);
+
+ if (dest != 0xbadbeef)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+/* { dg-do run { target { movdir && { ! ia32 } } } } */
+/* { dg-options "-mmovdiri -O2" } */
+
+#include <x86intrin.h>
+
+unsigned long long int dest = -1LL;
+
+int
+main ()
+{
+ if (!__builtin_cpu_supports ("movdiri"))
+ return 0;
+
+ _directstoreu_u64 (&dest, 0x12345678badbeef);
+
+ if (dest != 0x12345678badbeef)
+ abort ();
+
+ return 0;
+}
int i;
}]
}
+
+# Return 1 if we're able to assemble movdiri and movdir64b
+
+proc check_effective_target_movdir { } {
+ return [check_no_compiler_messages movdir object {
+ void
+ foo (unsigned int *d, unsigned int s)
+ {
+ __builtin_ia32_directstoreu_u32 (d, s);
+ }
+ void
+ bar (void *d, const void *s)
+ {
+ __builtin_ia32_movdir64b (d, s);
+ }
+ } "-mmovdiri -mmovdir64b" ]
+}