63 lines
2.1 KiB
Diff
63 lines
2.1 KiB
Diff
|
|
From 59e07c6c77dcc92d274ca6156b8916f66035dce8 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Haochen Jiang <haochen.jiang@intel.com>
|
||
|
|
Date: Mon, 22 Jul 2024 14:06:18 +0800
|
||
|
|
Subject: [PATCH 1/2] i386: Change prefetchi output template
|
||
|
|
|
||
|
|
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).
|
||
|
|
|
||
|
|
Reference:
|
||
|
|
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=
|
||
|
|
062e46a813799684c6f900815fd22451d6294ae1
|
||
|
|
---
|
||
|
|
gcc/config/i386/i386.md | 2 +-
|
||
|
|
gcc/testsuite/gcc.target/i386/prefetchi-1.c | 4 ++--
|
||
|
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
|
||
|
|
index f08c2cfb1..1b733008e 100644
|
||
|
|
--- a/gcc/config/i386/i386.md
|
||
|
|
+++ b/gcc/config/i386/i386.md
|
||
|
|
@@ -22917,7 +22917,7 @@
|
||
|
|
"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]);
|
||
|
|
diff --git a/gcc/testsuite/gcc.target/i386/prefetchi-1.c b/gcc/testsuite/gcc.target/i386/prefetchi-1.c
|
||
|
|
index 80f25e70e..03dfdc55e 100644
|
||
|
|
--- a/gcc/testsuite/gcc.target/i386/prefetchi-1.c
|
||
|
|
+++ b/gcc/testsuite/gcc.target/i386/prefetchi-1.c
|
||
|
|
@@ -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>
|
||
|
|
|
||
|
|
--
|
||
|
|
2.31.1
|
||
|
|
|