]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: Change prefetchi output template
authorHaochen Jiang <haochen.jiang@intel.com>
Mon, 22 Jul 2024 06:06:18 +0000 (14:06 +0800)
committerHaochen Jiang <haochen.jiang@intel.com>
Tue, 23 Jul 2024 05:50:31 +0000 (13:50 +0800)
For prefetchi instructions, RIP-relative address is explicitly mentioned
for operand and assembler obeys that rule strictly. This makes
instruction like:

prefetchit0 bar

got illegal for assembler, which should be a broad usage for prefetchi.

Change to %a to explicitly add (%rip) after function label to make it
legal in assembler so that it could pass to linker to get the real address.

gcc/ChangeLog:

* config/i386/i386.md (prefetchi): Change to %a.

gcc/testsuite/ChangeLog:

* gcc.target/i386/prefetchi-1.c: Check (%rip).

gcc/config/i386/i386.md
gcc/testsuite/gcc.target/i386/prefetchi-1.c

index 90d3aa450f05473c9d628ef0d1c527233a6228c2..6207036a2a01d650ddc9e01a953fc46b966206aa 100644 (file)
   "TARGET_PREFETCHI && TARGET_64BIT"
 {
   static const char * const patterns[2] = {
-    "prefetchit1\t%0", "prefetchit0\t%0"
+    "prefetchit1\t%a0", "prefetchit0\t%a0"
   };
 
   int locality = INTVAL (operands[1]);
index 80f25e70e8e33a4d7c5de845218272141dc966bd..03dfdc55e86c9d97bd1ef4b111326f9ca758cfd0 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-do compile { target { ! ia32 } } } */
 /* { dg-options "-mprefetchi -O2" } */
-/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit0\[ \\t\]+" 2 } } */
-/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit1\[ \\t\]+" 2 } } */
+/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit0\[ \\t\]+bar\\(%rip\\)" 2 } } */
+/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit1\[ \\t\]+bar\\(%rip\\)" 2 } } */
 
 #include <x86intrin.h>