summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-6.4/backport/0007-x86-Add-V-register-operand-modifier.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-6.4/backport/0007-x86-Add-V-register-operand-modifier.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-6.4/backport/0007-x86-Add-V-register-operand-modifier.patch139
1 files changed, 139 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-6.4/backport/0007-x86-Add-V-register-operand-modifier.patch b/meta/recipes-devtools/gcc/gcc-6.4/backport/0007-x86-Add-V-register-operand-modifier.patch
new file mode 100644
index 0000000000..cec84fefb2
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-6.4/backport/0007-x86-Add-V-register-operand-modifier.patch
@@ -0,0 +1,139 @@
1From 8f0efd692eb8db06d6c00b759c872bd2170b7f7b Mon Sep 17 00:00:00 2001
2From: "H.J. Lu" <hjl.tools@gmail.com>
3Date: Sat, 6 Jan 2018 22:29:56 -0800
4Subject: [PATCH 07/12] x86: Add 'V' register operand modifier
5
6Add 'V', a special modifier which prints the name of the full integer
7register without '%'. For
8
9extern void (*func_p) (void);
10
11void
12foo (void)
13{
14 asm ("call __x86_indirect_thunk_%V0" : : "a" (func_p));
15}
16
17it generates:
18
19foo:
20 movq func_p(%rip), %rax
21 call __x86_indirect_thunk_rax
22 ret
23
24gcc/
25
26 Backport from mainline
27 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
28
29 * config/i386/i386.c (print_reg): Print the name of the full
30 integer register without '%'.
31 (ix86_print_operand): Handle 'V'.
32 * doc/extend.texi: Document 'V' modifier.
33
34gcc/testsuite/
35
36 Backport from mainline
37 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
38
39 * gcc.target/i386/indirect-thunk-register-4.c: New test.
40
41Upstream-Status: Pending
42
43Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
44
45---
46 gcc/config/i386/i386.c | 13 ++++++++++++-
47 gcc/doc/extend.texi | 3 +++
48 gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c | 13 +++++++++++++
49 3 files changed, 28 insertions(+), 1 deletion(-)
50 create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c
51
52diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
53index 34e26a3..eeca7e5 100644
54--- a/gcc/config/i386/i386.c
55+++ b/gcc/config/i386/i386.c
56@@ -16869,6 +16869,7 @@ put_condition_code (enum rtx_code code, machine_mode mode, bool reverse,
57 If CODE is 'h', pretend the reg is the 'high' byte register.
58 If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op.
59 If CODE is 'd', duplicate the operand for AVX instruction.
60+ If CODE is 'V', print naked full integer register name without %.
61 */
62
63 void
64@@ -16879,7 +16880,7 @@ print_reg (rtx x, int code, FILE *file)
65 unsigned int regno;
66 bool duplicated;
67
68- if (ASSEMBLER_DIALECT == ASM_ATT)
69+ if (ASSEMBLER_DIALECT == ASM_ATT && code != 'V')
70 putc ('%', file);
71
72 if (x == pc_rtx)
73@@ -16922,6 +16923,14 @@ print_reg (rtx x, int code, FILE *file)
74 && regno != FPSR_REG
75 && regno != FPCR_REG);
76
77+ if (code == 'V')
78+ {
79+ if (GENERAL_REGNO_P (regno))
80+ msize = GET_MODE_SIZE (word_mode);
81+ else
82+ error ("'V' modifier on non-integer register");
83+ }
84+
85 duplicated = code == 'd' && TARGET_AVX;
86
87 switch (msize)
88@@ -17035,6 +17044,7 @@ print_reg (rtx x, int code, FILE *file)
89 & -- print some in-use local-dynamic symbol name.
90 H -- print a memory address offset by 8; used for sse high-parts
91 Y -- print condition for XOP pcom* instruction.
92+ V -- print naked full integer register name without %.
93 + -- print a branch hint as 'cs' or 'ds' prefix
94 ; -- print a semicolon (after prefixes due to bug in older gas).
95 ~ -- print "i" if TARGET_AVX2, "f" otherwise.
96@@ -17259,6 +17269,7 @@ ix86_print_operand (FILE *file, rtx x, int code)
97 case 'X':
98 case 'P':
99 case 'p':
100+ case 'V':
101 break;
102
103 case 's':
104diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
105index 2cb6bd1..76ba1d4 100644
106--- a/gcc/doc/extend.texi
107+++ b/gcc/doc/extend.texi
108@@ -8511,6 +8511,9 @@ The table below shows the list of supported modifiers and their effects.
109 @tab @code{2}
110 @end multitable
111
112+@code{V} is a special modifier which prints the name of the full integer
113+register without @code{%}.
114+
115 @anchor{x86floatingpointasmoperands}
116 @subsubsection x86 Floating-Point @code{asm} Operands
117
118diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c
119new file mode 100644
120index 0000000..f0cd9b7
121--- /dev/null
122+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c
123@@ -0,0 +1,13 @@
124+/* { dg-do compile } */
125+/* { dg-options "-O2 -mindirect-branch=keep -fno-pic" } */
126+
127+extern void (*func_p) (void);
128+
129+void
130+foo (void)
131+{
132+ asm("call __x86_indirect_thunk_%V0" : : "a" (func_p));
133+}
134+
135+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_eax" { target ia32 } } } */
136+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_rax" { target { ! ia32 } } } } */
137--
1382.7.4
139