diff options
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.patch | 139 |
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 @@ | |||
1 | From 8f0efd692eb8db06d6c00b759c872bd2170b7f7b Mon Sep 17 00:00:00 2001 | ||
2 | From: "H.J. Lu" <hjl.tools@gmail.com> | ||
3 | Date: Sat, 6 Jan 2018 22:29:56 -0800 | ||
4 | Subject: [PATCH 07/12] x86: Add 'V' register operand modifier | ||
5 | |||
6 | Add 'V', a special modifier which prints the name of the full integer | ||
7 | register without '%'. For | ||
8 | |||
9 | extern void (*func_p) (void); | ||
10 | |||
11 | void | ||
12 | foo (void) | ||
13 | { | ||
14 | asm ("call __x86_indirect_thunk_%V0" : : "a" (func_p)); | ||
15 | } | ||
16 | |||
17 | it generates: | ||
18 | |||
19 | foo: | ||
20 | movq func_p(%rip), %rax | ||
21 | call __x86_indirect_thunk_rax | ||
22 | ret | ||
23 | |||
24 | gcc/ | ||
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 | |||
34 | gcc/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 | |||
41 | Upstream-Status: Pending | ||
42 | |||
43 | Signed-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 | |||
52 | diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c | ||
53 | index 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': | ||
104 | diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi | ||
105 | index 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 | |||
118 | diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c | ||
119 | new file mode 100644 | ||
120 | index 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 | -- | ||
138 | 2.7.4 | ||
139 | |||