[Backport] Backport patch from gcc-14.3.0
This commit is contained in:
parent
5b8bae136d
commit
c439b088c6
88
GCC14-1003-i386-Add-non-optimize-prefetchi-intrins.patch
Normal file
88
GCC14-1003-i386-Add-non-optimize-prefetchi-intrins.patch
Normal file
@ -0,0 +1,88 @@
|
||||
From b4524c4430ba9771265bd9fc31e69a3f35dfe117 Mon Sep 17 00:00:00 2001
|
||||
From: Haochen Jiang <haochen.jiang@intel.com>
|
||||
Date: Thu, 25 Jul 2024 16:16:05 +0800
|
||||
Subject: [PATCH] i386: Add non-optimize prefetchi intrins
|
||||
|
||||
Under -O0, with the "newly" introduced intrins, the variable will be
|
||||
transformed as mem instead of the origin symbol_ref. The compiler will
|
||||
then treat the operand as invalid and turn the operation into nop, which
|
||||
is not expected. Use macro for non-optimize to keep the variable as
|
||||
symbol_ref just as how prefetch intrin does.
|
||||
|
||||
gcc/ChangeLog:
|
||||
|
||||
* config/i386/prfchiintrin.h
|
||||
(_m_prefetchit0): Add macro for non-optimized option.
|
||||
(_m_prefetchit1): Ditto.
|
||||
|
||||
gcc/testsuite/ChangeLog:
|
||||
|
||||
* gcc.target/i386/prefetchi-1b.c: New test.
|
||||
---
|
||||
gcc/config/i386/prfchiintrin.h | 9 +++++++
|
||||
gcc/testsuite/gcc.target/i386/prefetchi-1b.c | 26 ++++++++++++++++++++
|
||||
2 files changed, 35 insertions(+)
|
||||
create mode 100644 gcc/testsuite/gcc.target/i386/prefetchi-1b.c
|
||||
|
||||
diff --git a/gcc/config/i386/prfchiintrin.h b/gcc/config/i386/prfchiintrin.h
|
||||
index dfca89c7d16..d6580e504c0 100644
|
||||
--- a/gcc/config/i386/prfchiintrin.h
|
||||
+++ b/gcc/config/i386/prfchiintrin.h
|
||||
@@ -37,6 +37,7 @@
|
||||
#define __DISABLE_PREFETCHI__
|
||||
#endif /* __PREFETCHI__ */
|
||||
|
||||
+#ifdef __OPTIMIZE__
|
||||
extern __inline void
|
||||
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
||||
_m_prefetchit0 (void* __P)
|
||||
@@ -50,6 +51,14 @@ _m_prefetchit1 (void* __P)
|
||||
{
|
||||
__builtin_ia32_prefetchi (__P, 2);
|
||||
}
|
||||
+#else
|
||||
+#define _m_prefetchit0(P) \
|
||||
+ __builtin_ia32_prefetchi(P, 3)
|
||||
+
|
||||
+#define _m_prefetchit1(P) \
|
||||
+ __builtin_ia32_prefetchi(P, 2)
|
||||
+
|
||||
+#endif
|
||||
|
||||
#ifdef __DISABLE_PREFETCHI__
|
||||
#undef __DISABLE_PREFETCHI__
|
||||
diff --git a/gcc/testsuite/gcc.target/i386/prefetchi-1b.c b/gcc/testsuite/gcc.target/i386/prefetchi-1b.c
|
||||
new file mode 100644
|
||||
index 00000000000..93139554d3c
|
||||
--- /dev/null
|
||||
+++ b/gcc/testsuite/gcc.target/i386/prefetchi-1b.c
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* { dg-do compile { target { ! ia32 } } } */
|
||||
+/* { dg-options "-mprefetchi -O0" } */
|
||||
+/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit0\[ \\t\]+bar\\(%rip\\)" 1 } } */
|
||||
+/* { dg-final { scan-assembler-times "\[ \\t\]+prefetchit1\[ \\t\]+bar\\(%rip\\)" 1 } } */
|
||||
+
|
||||
+#include <x86intrin.h>
|
||||
+
|
||||
+int
|
||||
+bar (int a)
|
||||
+{
|
||||
+ return a + 1;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+foo1 (int b)
|
||||
+{
|
||||
+ _m_prefetchit0 (bar);
|
||||
+ return bar (b) + 1;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+foo2 (int b)
|
||||
+{
|
||||
+ _m_prefetchit1 (bar);
|
||||
+ return bar (b) + 1;
|
||||
+}
|
||||
--
|
||||
2.31.1
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
Summary: Various compilers (C, C++, Objective-C, ...)
|
||||
Name: %{?_scl_prefix}gcc%{gcc_ver}
|
||||
Version: 14.2.1
|
||||
Release: 1
|
||||
Release: 2
|
||||
# libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
|
||||
# GCC Runtime Exception.
|
||||
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
|
||||
@ -171,6 +171,7 @@ Provides: %{?_scl_prefix}gcc%{gcc_ver}(major) = %{gcc_major}
|
||||
|
||||
Patch1001: GCC14-1001-libstdc++-compat.patch
|
||||
Patch1002: GCC14-1002-change-gcc-version.patch
|
||||
Patch1003: GCC14-1003-i386-Add-non-optimize-prefetchi-intrins.patch
|
||||
# On ARM EABI systems, we do want -gnueabi to be part of the
|
||||
# target triple.
|
||||
%global nonsharedver 48
|
||||
@ -2241,6 +2242,9 @@ end
|
||||
%doc rpm.doc/changelogs/libcc1/ChangeLog*
|
||||
|
||||
%changelog
|
||||
* Thu Aug 22 2024 Hu, Lin <lin1.hu@intel.com> - 14.2.1-2
|
||||
- [Backport] Backport fix prefetchi from gcc-14.3.0
|
||||
|
||||
* Mon Aug 12 2024 zhaoshujian <zhaoshujian@huawei.com> - 14.2.1-1
|
||||
- Init gcc toolset gcc 14.2.1
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user