[Bug target/107731] loongarch Operand Modifiers are not documented
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107731 chenglulu changed: What|Removed |Added Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #9 from chenglulu --- Fixed
[Bug target/107731] loongarch Operand Modifiers are not documented
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107731 --- Comment #8 from CVS Commits --- The master branch has been updated by LuluCheng : https://gcc.gnu.org/g:b5ea0f071aca505c82cc8c062e57bf9892900277 commit r13-5319-gb5ea0f071aca505c82cc8c062e57bf9892900277 Author: Lulu Cheng Date: Wed Jan 18 11:06:56 2023 +0800 LoongArch: Fixed a compilation failure with '%c' in inline assembly [PR107731]. Co-authored-by: Yang Yujie PR target/107731 gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_classify_address): Add precessint for CONST_INT. (loongarch_print_operand_reloc): Operand modifier 'c' is supported. (loongarch_print_operand): Increase the processing of '%c'. * doc/extend.texi: Adds documents for LoongArch operand modifiers. And port the public operand modifiers information to this document. gcc/testsuite/ChangeLog: * gcc.target/loongarch/tst-asm-const.c: Moved to... * gcc.target/loongarch/pr107731.c: ...here.
[Bug target/107731] loongarch Operand Modifiers are not documented
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107731 --- Comment #7 from chenglulu --- (In reply to Andrew Pinski from comment #3) > MIPS nor RISCV does not define a %c either. These two architectures can also fail under the following conditions: void test(void) { asm (".long %c0" ::"i"(0x12345678)); }
[Bug target/107731] loongarch Operand Modifiers are not documented
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107731 --- Comment #6 from chenglulu --- (In reply to Andrew Pinski from comment #1) > %c does not mean anything in loongarch. > > The codes are not documented in the documentation for loonarch though but > they currently only documented in loongarch.cc: >'A' Print a _DB suffix if the memory model requires a release. >'b' Print the address of a memory operand, without offset. >'C' Print the integer branch condition for comparison OP. >'d' Print CONST_INT OP in decimal. >'F' Print the FPU branch condition for comparison OP. >'G' Print a DBAR insn if the memory model requires a release. >'H' Print address 52-61bit relocation associated with OP. >'h' Print the high-part relocation associated with OP. >'i' Print i if the operand is not a register. >'L' Print the low-part relocation associated with OP. >'m' Print one less than CONST_INT OP in decimal. >'N' Print the inverse of the integer branch condition for comparison OP. >'r' Print address 12-31bit relocation associated with OP. >'R' Print address 32-51bit relocation associated with OP. >'T' Print 'f' for (eq:CC ...), 't' for (ne:CC ...), > 'z' for (eq:?I ...), 'n' for (ne:?I ...). >'t' Like 'T', but with the EQ/NE cases reversed >'V' Print exact log2 of CONST_INT OP element 0 of a replicated > CONST_VECTOR in decimal. >'W' Print the inverse of the FPU branch condition for comparison OP. >'X' Print CONST_INT OP in hexadecimal format. >'x' Print the low 16 bits of CONST_INT OP in hexadecimal format. >'Y' Print loongarch_fp_conditions[INTVAL (OP)] >'y' Print exact log2 of CONST_INT OP in decimal. >'Z' Print OP and a comma for 8CC, otherwise print nothing. >'z' Print $0 if OP is zero, otherwise print OP normally. */ Sorry, I'll put the ones that will be used in the document.(In reply to Xi Ruoyao from comment #2) > (In reply to Andrew Pinski from comment #1) > > %c does not mean anything in loongarch. > > > > The codes are not documented in the documentation for loonarch though but > > they currently only documented in loongarch.cc: > >'A' Print a _DB suffix if the memory model requires a release. > >'b' Print the address of a memory operand, without offset. > >'C' Print the integer branch condition for comparison OP. > >'d' Print CONST_INT OP in decimal. > >'F' Print the FPU branch condition for comparison OP. > >'G' Print a DBAR insn if the memory model requires a release. > >'H' Print address 52-61bit relocation associated with OP. > >'h' Print the high-part relocation associated with OP. > >'i' Print i if the operand is not a register. > >'L' Print the low-part relocation associated with OP. > >'m' Print one less than CONST_INT OP in decimal. > >'N' Print the inverse of the integer branch condition for comparison OP. > >'r' Print address 12-31bit relocation associated with OP. > >'R' Print address 32-51bit relocation associated with OP. > >'T' Print 'f' for (eq:CC ...), 't' for (ne:CC ...), > > 'z' for (eq:?I ...), 'n' for (ne:?I ...). > >'t' Like 'T', but with the EQ/NE cases reversed > >'V' Print exact log2 of CONST_INT OP element 0 of a replicated > > CONST_VECTOR in decimal. > >'W' Print the inverse of the FPU branch condition for comparison OP. > >'X' Print CONST_INT OP in hexadecimal format. > >'x' Print the low 16 bits of CONST_INT OP in hexadecimal format. > >'Y' Print loongarch_fp_conditions[INTVAL (OP)] > >'y' Print exact log2 of CONST_INT OP in decimal. > >'Z' Print OP and a comma for 8CC, otherwise print nothing. > >'z' Print $0 if OP is zero, otherwise print OP normally. */ > > Interestingly it "worked" with GCC 12.2... (In reply to Xi Ruoyao from comment #5) > (In reply to Andrew Pinski from comment #4) > > (In reply to Xi Ruoyao from comment #2) > > > Interestingly it "worked" with GCC 12.2... > > No it does not work. I guess I typed the test command in a wrong SSH > session... I have found the error cause, I will push patch later
[Bug target/107731] loongarch Operand Modifiers are not documented
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107731 --- Comment #5 from Xi Ruoyao --- (In reply to Andrew Pinski from comment #4) > (In reply to Xi Ruoyao from comment #2) > > Interestingly it "worked" with GCC 12.2... No it does not work. I guess I typed the test command in a wrong SSH session...
[Bug target/107731] loongarch Operand Modifiers are not documented
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107731 --- Comment #4 from Andrew Pinski --- (In reply to Xi Ruoyao from comment #2) > Interestingly it "worked" with GCC 12.2... I don't see how it could work though. 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4499) default: 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4500) switch (code) 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4501){ 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4502)case REG: 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4503) { 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4504)unsigned int regno = REGNO (op); 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4505)if (letter && letter != 'z') 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4506) output_operand_lossage ("invalid use of '%%%c'", letter); 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4507)fprintf (file, "%s", reg_names[regno]); 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4508) } 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4509) break; 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4510) 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4511)case MEM: 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4512) if (letter == 'D') 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4513) output_address (GET_MODE (op), 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4514) plus_constant (Pmode, XEXP (op, 0), 4)); 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4515) else if (letter == 'b') 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4516){ 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4517) gcc_assert (REG_P (XEXP (op, 0))); 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4518) loongarch_print_operand (file, XEXP (op, 0), 0); 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4519)} 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4520) else if (letter && letter != 'z') 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4521) output_operand_lossage ("invalid use of '%%%c'", letter); 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4522) else 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4523) output_address (GET_MODE (op), XEXP (op, 0)); 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4524) break; 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4525) 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4526)default: 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4527) if (letter == 'z' && op == CONST0_RTX (GET_MODE (op))) 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4528)fputs (reg_names[GP_REG_FIRST], file); 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4529) else if (letter && letter != 'z') 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4530) output_operand_lossage ("invalid use of '%%%c'", letter); 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4531) else 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4532) output_addr_const (file, loongarch_strip_unspec_address (op)); 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4533) break; 62ec3b5352b3 (chenglulu 2021-11-27 14:58:21 +0800 4534)}
[Bug target/107731] loongarch Operand Modifiers are not documented
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107731 --- Comment #3 from Andrew Pinski --- MIPS nor RISCV does not define a %c either.
[Bug target/107731] loongarch Operand Modifiers are not documented
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107731 --- Comment #2 from Xi Ruoyao --- (In reply to Andrew Pinski from comment #1) > %c does not mean anything in loongarch. > > The codes are not documented in the documentation for loonarch though but > they currently only documented in loongarch.cc: >'A' Print a _DB suffix if the memory model requires a release. >'b' Print the address of a memory operand, without offset. >'C' Print the integer branch condition for comparison OP. >'d' Print CONST_INT OP in decimal. >'F' Print the FPU branch condition for comparison OP. >'G' Print a DBAR insn if the memory model requires a release. >'H' Print address 52-61bit relocation associated with OP. >'h' Print the high-part relocation associated with OP. >'i' Print i if the operand is not a register. >'L' Print the low-part relocation associated with OP. >'m' Print one less than CONST_INT OP in decimal. >'N' Print the inverse of the integer branch condition for comparison OP. >'r' Print address 12-31bit relocation associated with OP. >'R' Print address 32-51bit relocation associated with OP. >'T' Print 'f' for (eq:CC ...), 't' for (ne:CC ...), > 'z' for (eq:?I ...), 'n' for (ne:?I ...). >'t' Like 'T', but with the EQ/NE cases reversed >'V' Print exact log2 of CONST_INT OP element 0 of a replicated > CONST_VECTOR in decimal. >'W' Print the inverse of the FPU branch condition for comparison OP. >'X' Print CONST_INT OP in hexadecimal format. >'x' Print the low 16 bits of CONST_INT OP in hexadecimal format. >'Y' Print loongarch_fp_conditions[INTVAL (OP)] >'y' Print exact log2 of CONST_INT OP in decimal. >'Z' Print OP and a comma for 8CC, otherwise print nothing. >'z' Print $0 if OP is zero, otherwise print OP normally. */ Interestingly it "worked" with GCC 12.2...
[Bug target/107731] loongarch Operand Modifiers are not documented
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107731 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2022-11-17 Keywords||documentation Ever confirmed|0 |1 Summary|error: invalid 'asm': |loongarch Operand Modifiers |invalid use of '%c' |are not documented --- Comment #1 from Andrew Pinski --- %c does not mean anything in loongarch. The codes are not documented in the documentation for loonarch though but they currently only documented in loongarch.cc: 'A' Print a _DB suffix if the memory model requires a release. 'b' Print the address of a memory operand, without offset. 'C' Print the integer branch condition for comparison OP. 'd' Print CONST_INT OP in decimal. 'F' Print the FPU branch condition for comparison OP. 'G' Print a DBAR insn if the memory model requires a release. 'H' Print address 52-61bit relocation associated with OP. 'h' Print the high-part relocation associated with OP. 'i' Print i if the operand is not a register. 'L' Print the low-part relocation associated with OP. 'm' Print one less than CONST_INT OP in decimal. 'N' Print the inverse of the integer branch condition for comparison OP. 'r' Print address 12-31bit relocation associated with OP. 'R' Print address 32-51bit relocation associated with OP. 'T' Print 'f' for (eq:CC ...), 't' for (ne:CC ...), 'z' for (eq:?I ...), 'n' for (ne:?I ...). 't' Like 'T', but with the EQ/NE cases reversed 'V' Print exact log2 of CONST_INT OP element 0 of a replicated CONST_VECTOR in decimal. 'W' Print the inverse of the FPU branch condition for comparison OP. 'X' Print CONST_INT OP in hexadecimal format. 'x' Print the low 16 bits of CONST_INT OP in hexadecimal format. 'Y' Print loongarch_fp_conditions[INTVAL (OP)] 'y' Print exact log2 of CONST_INT OP in decimal. 'Z' Print OP and a comma for 8CC, otherwise print nothing. 'z' Print $0 if OP is zero, otherwise print OP normally. */