Skip to content

Commit 8ff81bb

Browse files
nathanchancechenhuacai
authored andcommitted
LoongArch: Drop unused parse_r and parse_v macros
When building with CONFIG_LTO_CLANG_FULL, there are several errors due to the way that parse_r is defined with an __asm__ statement in a header: ld.lld: error: ld-temp.o <inline asm>:105:1: macro 'parse_r' is already defined .macro parse_r var r ^ This was an issue for arch/mips as well, which was resolved by commit 67512a8 ("MIPS: Avoid macro redefinitions"). However, parse_r is unused in arch/loongarch after commit 83d8b38 ("LoongArch: Simplify the invtlb wrappers"), so doing the same change does not make much sense now. Just remove parse_r (and parse_v, which is also unused) to resolve the redefinition error. If it needs to be brought back due to an actual use, it should be brought back with the same changes as the aforementioned arch/mips commit. Closes: ClangBuiltLinux#1924 Reviewed-by: WANG Xuerui <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 9d17855 commit 8ff81bb

File tree

2 files changed

+0
-150
lines changed

2 files changed

+0
-150
lines changed

arch/loongarch/include/asm/asmmacro.h

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -10,113 +10,6 @@
1010
#include <asm/fpregdef.h>
1111
#include <asm/loongarch.h>
1212

13-
.macro parse_v var val
14-
\var = \val
15-
.endm
16-
17-
.macro parse_r var r
18-
\var = -1
19-
.ifc \r, $r0
20-
\var = 0
21-
.endif
22-
.ifc \r, $r1
23-
\var = 1
24-
.endif
25-
.ifc \r, $r2
26-
\var = 2
27-
.endif
28-
.ifc \r, $r3
29-
\var = 3
30-
.endif
31-
.ifc \r, $r4
32-
\var = 4
33-
.endif
34-
.ifc \r, $r5
35-
\var = 5
36-
.endif
37-
.ifc \r, $r6
38-
\var = 6
39-
.endif
40-
.ifc \r, $r7
41-
\var = 7
42-
.endif
43-
.ifc \r, $r8
44-
\var = 8
45-
.endif
46-
.ifc \r, $r9
47-
\var = 9
48-
.endif
49-
.ifc \r, $r10
50-
\var = 10
51-
.endif
52-
.ifc \r, $r11
53-
\var = 11
54-
.endif
55-
.ifc \r, $r12
56-
\var = 12
57-
.endif
58-
.ifc \r, $r13
59-
\var = 13
60-
.endif
61-
.ifc \r, $r14
62-
\var = 14
63-
.endif
64-
.ifc \r, $r15
65-
\var = 15
66-
.endif
67-
.ifc \r, $r16
68-
\var = 16
69-
.endif
70-
.ifc \r, $r17
71-
\var = 17
72-
.endif
73-
.ifc \r, $r18
74-
\var = 18
75-
.endif
76-
.ifc \r, $r19
77-
\var = 19
78-
.endif
79-
.ifc \r, $r20
80-
\var = 20
81-
.endif
82-
.ifc \r, $r21
83-
\var = 21
84-
.endif
85-
.ifc \r, $r22
86-
\var = 22
87-
.endif
88-
.ifc \r, $r23
89-
\var = 23
90-
.endif
91-
.ifc \r, $r24
92-
\var = 24
93-
.endif
94-
.ifc \r, $r25
95-
\var = 25
96-
.endif
97-
.ifc \r, $r26
98-
\var = 26
99-
.endif
100-
.ifc \r, $r27
101-
\var = 27
102-
.endif
103-
.ifc \r, $r28
104-
\var = 28
105-
.endif
106-
.ifc \r, $r29
107-
\var = 29
108-
.endif
109-
.ifc \r, $r30
110-
\var = 30
111-
.endif
112-
.ifc \r, $r31
113-
\var = 31
114-
.endif
115-
.iflt \var
116-
.error "Unable to parse register name \r"
117-
.endif
118-
.endm
119-
12013
.macro cpu_save_nonscratch thread
12114
stptr.d s0, \thread, THREAD_REG23
12215
stptr.d s1, \thread, THREAD_REG24

arch/loongarch/include/asm/loongarch.h

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,49 +12,6 @@
1212
#ifndef __ASSEMBLY__
1313
#include <larchintrin.h>
1414

15-
/*
16-
* parse_r var, r - Helper assembler macro for parsing register names.
17-
*
18-
* This converts the register name in $n form provided in \r to the
19-
* corresponding register number, which is assigned to the variable \var. It is
20-
* needed to allow explicit encoding of instructions in inline assembly where
21-
* registers are chosen by the compiler in $n form, allowing us to avoid using
22-
* fixed register numbers.
23-
*
24-
* It also allows newer instructions (not implemented by the assembler) to be
25-
* transparently implemented using assembler macros, instead of needing separate
26-
* cases depending on toolchain support.
27-
*
28-
* Simple usage example:
29-
* __asm__ __volatile__("parse_r addr, %0\n\t"
30-
* "#invtlb op, 0, %0\n\t"
31-
* ".word ((0x6498000) | (addr << 10) | (0 << 5) | op)"
32-
* : "=r" (status);
33-
*/
34-
35-
/* Match an individual register number and assign to \var */
36-
#define _IFC_REG(n) \
37-
".ifc \\r, $r" #n "\n\t" \
38-
"\\var = " #n "\n\t" \
39-
".endif\n\t"
40-
41-
__asm__(".macro parse_r var r\n\t"
42-
"\\var = -1\n\t"
43-
_IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3)
44-
_IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7)
45-
_IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11)
46-
_IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15)
47-
_IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19)
48-
_IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23)
49-
_IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27)
50-
_IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31)
51-
".iflt \\var\n\t"
52-
".error \"Unable to parse register name \\r\"\n\t"
53-
".endif\n\t"
54-
".endm");
55-
56-
#undef _IFC_REG
57-
5815
/* CPUCFG */
5916
#define read_cpucfg(reg) __cpucfg(reg)
6017

0 commit comments

Comments
 (0)